mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-03-01 02:51:04 +00:00
sink: Add a new-webrtcbin
signal
Allowing user to add a data channel for example
This commit is contained in:
parent
444ee40f09
commit
63337c7df1
1 changed files with 28 additions and 1 deletions
|
@ -1396,7 +1396,7 @@ impl WebRTCSink {
|
||||||
|
|
||||||
let mut consumer = Consumer {
|
let mut consumer = Consumer {
|
||||||
pipeline: pipeline.clone(),
|
pipeline: pipeline.clone(),
|
||||||
webrtcbin,
|
webrtcbin: webrtcbin.clone(),
|
||||||
webrtc_pads: HashMap::new(),
|
webrtc_pads: HashMap::new(),
|
||||||
peer_id: peer_id.to_string(),
|
peer_id: peer_id.to_string(),
|
||||||
congestion_controller: match settings.cc_heuristic {
|
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)?;
|
pipeline.set_state(gst::State::Playing)?;
|
||||||
|
|
||||||
state.consumers.insert(peer_id.to_string(), consumer);
|
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<Vec<glib::subclass::Signal>> = 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) {
|
fn constructed(&self, obj: &Self::Type) {
|
||||||
self.parent_constructed(obj);
|
self.parent_constructed(obj);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue