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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1324>
This commit is contained in:
François Laignel 2023-09-27 15:10:30 +02:00 committed by GStreamer Marge Bot
parent 785c9557c8
commit 50dd519c4f
2 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -66,7 +66,7 @@ impl ObjectImpl for WebRTCSrc {
.default_value(DEFAULT_STUN_SERVER)
.build(),
glib::ParamSpecObject::builder::<Signallable>("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::<gst::Structure>("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::<Signallable>().expect("type checked upstream");
let signaller = value
.get::<Option<Signallable>>()
.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