mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-26 13:31:00 +00:00
webrtcsink: further refactor connection to stats signals
- Stop passing webrtcbin around without using it - Stop using glib::closure as clippy complains when using a unit type default-return Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1217>
This commit is contained in:
parent
e13124a426
commit
44a395f134
1 changed files with 9 additions and 6 deletions
|
@ -2192,21 +2192,24 @@ impl BaseWebRTCSink {
|
|||
if session.congestion_controller.is_some() {
|
||||
let session_id_str = session_id.to_string();
|
||||
rtpbin.connect_closure("on-new-ssrc", true,
|
||||
glib::closure!(@weak-allow-none element, @weak-allow-none webrtcbin
|
||||
glib::closure!(@weak-allow-none element,
|
||||
=> move |rtpbin: gst::Object, session_id: u32, _src: u32| {
|
||||
let rtp_session = rtpbin.emit_by_name::<gst::Element>("get-session", &[&session_id]);
|
||||
|
||||
let element = element.expect("on-new-ssrc emitted when webrtcsink has been disposed?");
|
||||
let webrtcbin = webrtcbin.unwrap();
|
||||
let mut state = element.imp().state.lock().unwrap();
|
||||
if let Some(session) = state.sessions.get_mut(&session_id_str) {
|
||||
|
||||
if session.stats_sigid.is_none() {
|
||||
let session_id_str = session_id_str.clone();
|
||||
let element = element.downgrade();
|
||||
session.stats_sigid = Some(rtp_session.connect_notify(Some("twcc-stats"),
|
||||
glib::clone!(@strong session_id_str, @weak webrtcbin, @weak element => @default-return (), move |sess, pspec| {
|
||||
// Run the Loss-based control algorithm on new peer TWCC feedbacks
|
||||
element.imp().process_loss_stats(&element, &session_id_str, &sess.property::<gst::Structure>(pspec.name()));
|
||||
})
|
||||
move |sess, pspec| {
|
||||
if let Some(element) = element.upgrade() {
|
||||
// Run the Loss-based control algorithm on new peer TWCC feedbacks
|
||||
element.imp().process_loss_stats(&element, &session_id_str, &sess.property::<gst::Structure>(pspec.name()));
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue