whipsink: Request pads with webrtcbin's pad templates and not our own

It's invalid to request pads with a pad template that is not part of the
element, and results in a critical warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1223>
This commit is contained in:
Sebastian Dröge 2023-05-24 16:55:47 +03:00 committed by GStreamer Marge Bot
parent 44a395f134
commit e3c46b40a0

View file

@ -130,11 +130,12 @@ impl ElementImpl for WhipSink {
fn request_new_pad( fn request_new_pad(
&self, &self,
templ: &gst::PadTemplate, _templ: &gst::PadTemplate,
name: Option<&str>, name: Option<&str>,
caps: Option<&gst::Caps>, caps: Option<&gst::Caps>,
) -> Option<gst::Pad> { ) -> Option<gst::Pad> {
let wb_sink_pad = self.webrtcbin.request_pad(templ, name, caps)?; let webrtcsink_templ = self.webrtcbin.pad_template("sink_%u").unwrap();
let wb_sink_pad = self.webrtcbin.request_pad(&webrtcsink_templ, name, caps)?;
let sink_pad = gst::GhostPad::builder(gst::PadDirection::Sink) let sink_pad = gst::GhostPad::builder(gst::PadDirection::Sink)
.name(wb_sink_pad.name()) .name(wb_sink_pad.name())
.build(); .build();