From 50dd519c4f99e162fc1bca3b9d85eb056a2fa78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Laignel?= Date: Wed, 27 Sep 2023 15:10:30 +0200 Subject: [PATCH] net/webrtcsrc: define signaller property as CONSTRUCT_ONLY The "signaller" property used to be defined as MUTABLE_READY which meant that the property was always set after `constructed()` was called. Since `connect_signaller()` was called from `constructed()`, only the default signaller was used. This commit sets the "signaller" property as CONSTRUCT_ONLY. Using a builder, this property will now be set before the call to `constructed()`. Part-of: --- docs/plugins/gst_plugins_cache.json | 4 ++-- net/webrtc/src/webrtcsrc/imp.rs | 12 +++++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json index 11bf5b56..558c387e 100644 --- a/docs/plugins/gst_plugins_cache.json +++ b/docs/plugins/gst_plugins_cache.json @@ -6505,9 +6505,9 @@ "blurb": "The Signallable object to use to handle WebRTC Signalling", "conditionally-available": false, "construct": false, - "construct-only": false, + "construct-only": true, "controllable": false, - "mutable": "ready", + "mutable": "null", "readable": true, "type": "GstRSWebRTCSignallableIface", "writable": true diff --git a/net/webrtc/src/webrtcsrc/imp.rs b/net/webrtc/src/webrtcsrc/imp.rs index ddf5aa8e..a9d6d38c 100644 --- a/net/webrtc/src/webrtcsrc/imp.rs +++ b/net/webrtc/src/webrtcsrc/imp.rs @@ -66,7 +66,7 @@ impl ObjectImpl for WebRTCSrc { .default_value(DEFAULT_STUN_SERVER) .build(), glib::ParamSpecObject::builder::("signaller") - .flags(glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY) + .flags(glib::ParamFlags::READWRITE | glib::ParamFlags::CONSTRUCT_ONLY) .blurb("The Signallable object to use to handle WebRTC Signalling") .build(), glib::ParamSpecBoxed::builder::("meta") @@ -102,8 +102,14 @@ impl ObjectImpl for WebRTCSrc { fn set_property(&self, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) { match pspec.name() { "signaller" => { - self.settings.lock().unwrap().signaller = - value.get::().expect("type checked upstream"); + let signaller = value + .get::>() + .expect("type checked upstream"); + if let Some(signaller) = signaller { + self.settings.lock().unwrap().signaller = signaller; + } + // else: signaller not set as a construct property + // => use default Signaller } "video-codecs" => { self.settings.lock().unwrap().video_codecs = value