From dcb072ee2319cf672e60c8c17731d3103930242b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 23 Sep 2024 19:04:53 +0300 Subject: [PATCH] webrtc: livekit: Set connection earlier during setup Otherwise it's not available yet when handling the initial participants that are already in the session when joining. Part-of: --- net/webrtc/src/livekit_signaller/imp.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/net/webrtc/src/livekit_signaller/imp.rs b/net/webrtc/src/livekit_signaller/imp.rs index 75b07f8e..1d8c68f2 100644 --- a/net/webrtc/src/livekit_signaller/imp.rs +++ b/net/webrtc/src/livekit_signaller/imp.rs @@ -672,6 +672,16 @@ impl SignallableImpl for Signaller { } }); + let connection = Connection { + signal_client, + signal_task, + pending_tracks: Default::default(), + early_candidates: Some(Vec::new()), + channels: None, + participants: HashMap::default(), + }; + *imp.connection.lock().unwrap() = Some(connection); + if imp.is_subscriber() { imp.obj() .emit_by_name::<()>("session-started", &[&"unique", &"unique"]); @@ -724,19 +734,6 @@ impl SignallableImpl for Signaller { ), ); - let connection = Connection { - signal_client, - signal_task, - pending_tracks: Default::default(), - early_candidates: Some(Vec::new()), - channels: None, - participants: HashMap::default(), - }; - - if let Ok(mut sc) = imp.connection.lock() { - *sc = Some(connection); - } - imp.obj().emit_by_name::<()>( "session-requested", &[