diff --git a/net/hlssink3/src/hlsbasesink.rs b/net/hlssink3/src/hlsbasesink.rs index 1b970cde..7175c8a1 100644 --- a/net/hlssink3/src/hlsbasesink.rs +++ b/net/hlssink3/src/hlsbasesink.rs @@ -211,10 +211,9 @@ impl ObjectImpl for HlsBaseSink { Some(imp.new_file_stream(&playlist_location).ok().to_value()) }) - .accumulator(|_hint, ret, value| { + .accumulator(|_hint, _acc, value| { // First signal handler wins - *ret = value.clone(); - false + std::ops::ControlFlow::Break(value.clone()) }) .build(), glib::subclass::Signal::builder(SIGNAL_GET_FRAGMENT_STREAM) @@ -227,10 +226,9 @@ impl ObjectImpl for HlsBaseSink { Some(imp.new_file_stream(&fragment_location).ok().to_value()) }) - .accumulator(|_hint, ret, value| { + .accumulator(|_hint, _acc, value| { // First signal handler wins - *ret = value.clone(); - false + std::ops::ControlFlow::Break(value.clone()) }) .build(), glib::subclass::Signal::builder(SIGNAL_DELETE_FRAGMENT) @@ -244,10 +242,9 @@ impl ObjectImpl for HlsBaseSink { imp.delete_fragment(&fragment_location); Some(true.to_value()) }) - .accumulator(|_hint, ret, value| { + .accumulator(|_hint, _acc, value| { // First signal handler wins - *ret = value.clone(); - false + std::ops::ControlFlow::Break(value.clone()) }) .build(), ] diff --git a/net/hlssink3/src/hlscmafsink/imp.rs b/net/hlssink3/src/hlscmafsink/imp.rs index f462bb34..0d856a1d 100644 --- a/net/hlssink3/src/hlscmafsink/imp.rs +++ b/net/hlssink3/src/hlscmafsink/imp.rs @@ -232,10 +232,9 @@ impl ObjectImpl for HlsCmafSink { Some(imp.new_file_stream(&init_location).ok().to_value()) }) - .accumulator(|_hint, ret, value| { + .accumulator(|_hint, _acc, value| { // First signal handler wins - *ret = value.clone(); - false + std::ops::ControlFlow::Break(value.clone()) }) .build(), glib::subclass::Signal::builder(SIGNAL_NEW_PLAYLIST) diff --git a/net/rtp/src/basedepay/imp.rs b/net/rtp/src/basedepay/imp.rs index 90df05b1..67eb8c9c 100644 --- a/net/rtp/src/basedepay/imp.rs +++ b/net/rtp/src/basedepay/imp.rs @@ -1947,12 +1947,11 @@ impl ObjectImpl for RtpBaseDepay2 { glib::subclass::Signal::builder("request-extension") .param_types([u32::static_type(), String::static_type()]) .return_type::() - .accumulator(|_hint, acc, val| { - if matches!(val.get::>(), Ok(Some(_))) { - *acc = val.clone(); - false + .accumulator(|_hint, _acc, value| { + if matches!(value.get::>(), Ok(Some(_))) { + std::ops::ControlFlow::Break(value.clone()) } else { - true + std::ops::ControlFlow::Continue(value.clone()) } }) .class_handler(|args| { diff --git a/net/rtp/src/basepay/imp.rs b/net/rtp/src/basepay/imp.rs index 32208bf2..94df3e3f 100644 --- a/net/rtp/src/basepay/imp.rs +++ b/net/rtp/src/basepay/imp.rs @@ -1985,12 +1985,11 @@ impl ObjectImpl for RtpBasePay2 { glib::subclass::Signal::builder("request-extension") .param_types([u32::static_type(), String::static_type()]) .return_type::() - .accumulator(|_hint, acc, val| { - if matches!(val.get::>(), Ok(Some(_))) { - *acc = val.clone(); - false + .accumulator(|_hint, _acc, value| { + if matches!(value.get::>(), Ok(Some(_))) { + std::ops::ControlFlow::Break(value.clone()) } else { - true + std::ops::ControlFlow::Continue(value.clone()) } }) .class_handler(|args| { diff --git a/net/webrtc/src/signaller/iface.rs b/net/webrtc/src/signaller/iface.rs index 51abefb8..65199eca 100644 --- a/net/webrtc/src/signaller/iface.rs +++ b/net/webrtc/src/signaller/iface.rs @@ -167,9 +167,9 @@ impl prelude::ObjectInterface for Signallable { }); Some(Signallable::request_meta(this).to_value()) }) - .accumulator(move |_hint, output, input| { - *output = input.clone(); - false + .accumulator(move |_hint, _acc, value| { + // First signal handler wins + std::ops::ControlFlow::Break(value.clone()) }) .build(), /** @@ -227,9 +227,9 @@ impl prelude::ObjectInterface for Signallable { Some(false.into()) }) - .accumulator(move |_hint, output, input| { - *output = input.clone(); - false + .accumulator(move |_hint, _acc, value| { + // First signal handler wins + std::ops::ControlFlow::Break(value.clone()) }) .build(), /** @@ -253,9 +253,9 @@ impl prelude::ObjectInterface for Signallable { Some(false.into()) }) - .accumulator(move |_hint, output, input| { - *output = input.clone(); - false + .accumulator(move |_hint, _acc, value| { + // First signal handler wins + std::ops::ControlFlow::Break(value.clone()) }) .build(), /** @@ -291,9 +291,9 @@ impl prelude::ObjectInterface for Signallable { Some(false.into()) }) - .accumulator(move |_hint, output, input| { - *output = input.clone(); - false + .accumulator(move |_hint, _acc, value| { + // First signal handler wins + std::ops::ControlFlow::Break(value.clone()) }) .build(), /** @@ -358,9 +358,9 @@ impl prelude::ObjectInterface for Signallable { Some(desc.clone().into()) }) - .accumulator(move |_hint, output, input| { - *output = input.clone(); - false + .accumulator(move |_hint, _acc, value| { + // First signal handler wins + std::ops::ControlFlow::Break(value.clone()) }) .build(), /** @@ -398,9 +398,9 @@ impl prelude::ObjectInterface for Signallable { Some(false.into()) }) - .accumulator(move |_hint, output, input| { - *output = input.clone(); - false + .accumulator(move |_hint, _acc, value| { + // First signal handler wins + std::ops::ControlFlow::Break(value.clone()) }) .build(), /** @@ -445,9 +445,9 @@ impl prelude::ObjectInterface for Signallable { Some(false.into()) }) - .accumulator(move |_hint, output, input| { - *output = input.clone(); - false + .accumulator(move |_hint, _acc, value| { + // First signal handler wins + std::ops::ControlFlow::Break(value.clone()) }) .build(), /** diff --git a/net/webrtc/src/webrtcsink/imp.rs b/net/webrtc/src/webrtcsink/imp.rs index 3abdb6d0..2330d3db 100644 --- a/net/webrtc/src/webrtcsink/imp.rs +++ b/net/webrtc/src/webrtcsink/imp.rs @@ -859,15 +859,15 @@ fn configure_payloader(pay: &gst::Element) { fn setup_signal_accumulator( _hint: &glib::subclass::SignalInvocationHint, - ret: &mut glib::Value, + _acc: glib::Value, value: &glib::Value, -) -> bool { +) -> std::ops::ControlFlow { let is_configured = value.get::().unwrap(); - let continue_emission = !is_configured; - - *ret = value.clone(); - - continue_emission + if !is_configured { + std::ops::ControlFlow::Continue(value.clone()) + } else { + std::ops::ControlFlow::Break(value.clone()) + } } /// Set of elements used in an EncodingChain @@ -5047,9 +5047,9 @@ impl ObjectImpl for BaseWebRTCSink { .class_handler(|args| { Some(args[3usize].get::().expect("wrong argument").to_value()) }) - .accumulator(move |_hint, output, input| { - *output = input.clone(); - false + .accumulator(move |_hint, _acc, value| { + // First signal handler wins + std::ops::ControlFlow::Break(value.clone()) }) .build(), ] diff --git a/utils/fallbackswitch/src/fallbacksrc/imp.rs b/utils/fallbackswitch/src/fallbacksrc/imp.rs index c30b17c6..01f99320 100644 --- a/utils/fallbackswitch/src/fallbacksrc/imp.rs +++ b/utils/fallbackswitch/src/fallbacksrc/imp.rs @@ -666,10 +666,9 @@ impl ObjectImpl for FallbackSrc { // Simply return the input by default Some(args[1].clone()) }) - .accumulator(|_hint, ret, value| { + .accumulator(|_hint, _acc, value| { // First signal handler wins - *ret = value.clone(); - false + std::ops::ControlFlow::Break(value.clone()) }) .build(), glib::subclass::Signal::builder("unblock")