From 1d3685e366709d951c63b134a27403848296088d Mon Sep 17 00:00:00 2001 From: s-hamdananwar Date: Thu, 18 Sep 2025 13:33:16 -0400 Subject: [PATCH 1/2] fix: apply original participant fields in data messages --- livekit/src/rtc_engine/rtc_session.rs | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/livekit/src/rtc_engine/rtc_session.rs b/livekit/src/rtc_engine/rtc_session.rs index a95c3aa27..08a58867a 100644 --- a/livekit/src/rtc_engine/rtc_session.rs +++ b/livekit/src/rtc_engine/rtc_session.rs @@ -1042,15 +1042,13 @@ impl SessionInner { // Participant SID and identity used to be defined on user packet, but // they have been moved to the packet root. For backwards compatibility, // we take the user packet's values if the top-level fields are not set. - let participant_sid = participant_sid - .is_none() - .then_some(user.participant_sid) - .and_then(|sid| sid.try_into().ok()); - let participant_identity = participant_identity - .is_none() - .then_some(user.participant_identity) - .and_then(|identity| identity.try_into().ok()); - + let participant_sid = participant_sid.or_else(|| { + user.participant_sid.try_into().ok() + }); + let participant_identity = participant_identity.or_else(|| { + user.participant_identity.try_into().ok() + }); + self.emitter.send(SessionEvent::Data { kind, participant_sid, From 07fe24140146b9fbf66532eaa351eac134467d52 Mon Sep 17 00:00:00 2001 From: s-hamdananwar Date: Thu, 18 Sep 2025 13:49:09 -0400 Subject: [PATCH 2/2] code formatting --- livekit/src/rtc_engine/rtc_session.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/livekit/src/rtc_engine/rtc_session.rs b/livekit/src/rtc_engine/rtc_session.rs index 08a58867a..0bd6f10a7 100644 --- a/livekit/src/rtc_engine/rtc_session.rs +++ b/livekit/src/rtc_engine/rtc_session.rs @@ -1042,13 +1042,10 @@ impl SessionInner { // Participant SID and identity used to be defined on user packet, but // they have been moved to the packet root. For backwards compatibility, // we take the user packet's values if the top-level fields are not set. - let participant_sid = participant_sid.or_else(|| { - user.participant_sid.try_into().ok() - }); - let participant_identity = participant_identity.or_else(|| { - user.participant_identity.try_into().ok() - }); - + let participant_sid = + participant_sid.or_else(|| user.participant_sid.try_into().ok()); + let participant_identity = + participant_identity.or_else(|| user.participant_identity.try_into().ok()); self.emitter.send(SessionEvent::Data { kind, participant_sid,