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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1994>
This commit is contained in:
Sebastian Dröge 2024-12-17 16:18:15 +02:00
parent 73663d7352
commit 248b7ac059

View file

@ -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::<super::BaseWebRTCSink>()
.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: {}",