webrtcsrc: Made producer-peer-id optional

It may be necessary for some signalling clients but the source element
doesn't need to depend on it.

Also, the value will fall back to the pad's MSID for the first argument
to the request-encoded-filter gobject signal when it isn't available
from the signalling client.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1477>
This commit is contained in:
Jordan Yelloz 2024-02-26 11:34:39 -07:00
parent 47ba068966
commit 594400a7f5

View file

@ -211,7 +211,7 @@ impl ObjectImpl for BaseWebRTCSrc {
vec![ vec![
/** /**
* BaseWebRTCSrc::request-encoded-filter: * BaseWebRTCSrc::request-encoded-filter:
* @producer_id: Identifier of the producer * @producer_id: (nullable): Identifier of the producer
* @pad_name: The name of the output pad * @pad_name: The name of the output pad
* @allowed_caps: the allowed caps for the output pad * @allowed_caps: the allowed caps for the output pad
* *
@ -404,7 +404,11 @@ impl BaseWebRTCSrc {
.expect("Adding ghostpad to the bin should always work"); .expect("Adding ghostpad to the bin should always work");
if let Some(srcpad) = srcpad { if let Some(srcpad) = srcpad {
let producer_id = self.signaller().property::<String>("producer-peer-id"); let producer_id = self
.signaller()
.property::<Option<String>>("producer-peer-id")
.or_else(|| pad.property("msid"));
let encoded_filter = self.obj().emit_by_name::<Option<gst::Element>>( let encoded_filter = self.obj().emit_by_name::<Option<gst::Element>>(
"request-encoded-filter", "request-encoded-filter",
&[&producer_id, &srcpad.name(), &srcpad.allowed_caps()], &[&producer_id, &srcpad.name(), &srcpad.allowed_caps()],