webrtcsink: fix navigation data channel

At some point, presumably recently, the data channel stopped being
requested in Ready, making webrtcbin refuse to create it.

There was quite a lot of churn recently so I couldn't pinpoint the
breaking commit easily.

Fix by simply restoring the correct behavior of requesting the channel
after going to the Ready state

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/issues/341

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1180>
This commit is contained in:
Mathieu Duponchelle 2023-04-14 14:24:23 +02:00
parent 47159ad3c2
commit dbdb9bc164

View file

@ -2220,10 +2220,6 @@ impl BaseWebRTCSink {
}
});
if settings.enable_data_channel_navigation {
state.navigation_handler = Some(NavigationEventHandler::new(&element, &webrtcbin));
}
state.sessions.insert(session_id.to_string(), session);
let mut streams: Vec<InputStream> = state.streams.values().cloned().collect();
@ -2303,6 +2299,9 @@ impl BaseWebRTCSink {
.await;
}
}
let enable_data_channel_navigation = settings_clone.enable_data_channel_navigation;
drop(settings_clone);
{
@ -2327,6 +2326,12 @@ impl BaseWebRTCSink {
return;
}
if enable_data_channel_navigation {
let mut state = this.state.lock().unwrap();
state.navigation_handler =
Some(NavigationEventHandler::new(&element, &webrtcbin));
}
// This is intentionally emitted with the pipeline in the Ready state,
// so that application code can create data channels at the correct
// moment.