net/webrtc: src: don't set stun-server on webrtcbin when our property is None

... otherwise an error occurs about the stun-server address being an empty
string which doesn't comply with the expected address format.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1202>
This commit is contained in:
François Laignel 2023-04-30 13:04:26 +02:00
parent de1c8ece43
commit eca269cbf2

View file

@ -458,13 +458,13 @@ impl WebRTCSrc {
fn prepare(&self) -> Result<(), Error> {
let webrtcbin = gst::ElementFactory::make("webrtcbin")
.property("bundle-policy", gst_webrtc::WebRTCBundlePolicy::MaxBundle)
.property(
"stun-server",
&self.settings.lock().unwrap().stun_server.to_value(),
)
.build()
.with_context(|| "Failed to make element webrtcbin".to_string())?;
if let Some(stun_server) = self.settings.lock().unwrap().stun_server.as_ref() {
webrtcbin.set_property("stun-server", stun_server);
}
let bin = gst::Bin::new(None);
bin.connect_pad_removed(glib::clone!(@weak self as this => move |_, pad|
this.state.lock().unwrap().flow_combiner.remove_pad(pad);