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/1508>
This commit is contained in:
Jordan Yelloz 2024-02-26 11:34:39 -07:00 committed by Sebastian Dröge
parent 55b74c9a9a
commit 048d51d9d9

View file

@ -211,7 +211,7 @@ impl ObjectImpl for BaseWebRTCSrc {
vec![
/**
* 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
* @allowed_caps: the allowed caps for the output pad
*
@ -404,7 +404,11 @@ impl BaseWebRTCSrc {
.expect("Adding ghostpad to the bin should always work");
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>>(
"request-encoded-filter",
&[&producer_id, &srcpad.name(), &srcpad.allowed_caps()],