From 248b7ac0596767b021d4ed14f98f731d1f496dc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 17 Dec 2024 16:18:15 +0200 Subject: [PATCH] webrtcsink: Configure custom host/port on the signaller when running signalling server internally Otherwise it just tries connecting to the default URL, which doesn't work if either the host or the port are changed. Part-of: --- net/webrtc/src/webrtcsink/imp.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index f7489b95..50205e5a 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -5450,6 +5450,31 @@ impl WebRTCSink { let settings = self.settings.lock().unwrap().clone(); if settings.run_signalling_server { + // Configure our own signalling server as URI on the signaller + { + let signaller = self + .obj() + .upcast_ref::() + .imp() + .settings + .lock() + .unwrap() + .signaller + .clone(); + + // Map UNSPECIFIED addresses to localhost + let host = match settings.signalling_server_host.as_str() { + "0.0.0.0" => "127.0.0.1".to_string(), + "::" | "[::]" => "[::1]".to_string(), + host => host.to_string(), + }; + + signaller.set_property( + "uri", + format!("ws://{}:{}", host, settings.signalling_server_port), + ); + } + if let Err(err) = LazyLock::force(&SIGNALLING_LOGGING) { Err(anyhow!( "failed signalling server logging initialization: {}",