diff --git a/plugins/src/webrtcsink/imp.rs b/plugins/src/webrtcsink/imp.rs index 2b6b0d5e..8ba3e564 100644 --- a/plugins/src/webrtcsink/imp.rs +++ b/plugins/src/webrtcsink/imp.rs @@ -1396,7 +1396,7 @@ impl WebRTCSink { let mut consumer = Consumer { pipeline: pipeline.clone(), - webrtcbin, + webrtcbin: webrtcbin.clone(), webrtc_pads: HashMap::new(), peer_id: peer_id.to_string(), congestion_controller: match settings.cc_heuristic { @@ -1455,6 +1455,10 @@ impl WebRTCSink { } }); + pipeline.set_state(gst::State::Ready)?; + + element.emit_by_name("new-webrtcbin", &[&peer_id.to_value(), &webrtcbin.to_value()])?; + pipeline.set_state(gst::State::Playing)?; state.consumers.insert(peer_id.to_string(), consumer); @@ -2024,6 +2028,29 @@ impl ObjectImpl for WebRTCSink { } } + fn signals() -> &'static [glib::subclass::Signal] { + static SIGNALS: Lazy> = Lazy::new(|| { + vec![ + /* + * RsWebRTCSink::new-webrtcbin: + * @peer_id: Identifier of the peer associated with the consumer added + * @webrtcbin: The new webrtcbin + * + * This signal can be used to tweak @webrtcbin, creating a data + * channel for example. + */ + glib::subclass::Signal::builder( + "new-webrtcbin", + &[String::static_type().into(), gst::Element::static_type().into()], + glib::types::Type::UNIT.into(), + ) + .build(), + ] + }); + + SIGNALS.as_ref() + } + fn constructed(&self, obj: &Self::Type) { self.parent_constructed(obj);