mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-06-09 17:59:23 +00:00
fallbackswitch: Make sure to flush/reset pads during pad (de)activation
Otherwise this can potentially deadlock or delay state changes for a longer time.
This commit is contained in:
parent
1f7126a8a1
commit
00411523d4
|
@ -535,6 +535,21 @@ impl FallbackSwitch {
|
|||
.expect("Failed to wait async");
|
||||
}
|
||||
|
||||
fn sink_activatemode(
|
||||
pad: &super::FallbackSwitchSinkPad,
|
||||
_mode: gst::PadMode,
|
||||
activate: bool,
|
||||
) -> Result<(), gst::LoggableError> {
|
||||
let mut pad_state = pad.imp().state.lock();
|
||||
if activate {
|
||||
pad_state.reset();
|
||||
} else {
|
||||
pad_state.flush_start();
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn sink_chain(
|
||||
&self,
|
||||
pad: &super::FallbackSwitchSinkPad,
|
||||
|
@ -1387,6 +1402,9 @@ impl ElementImpl for FallbackSwitch {
|
|||
|fallbackswitch, element| fallbackswitch.sink_query(pad, element, query),
|
||||
)
|
||||
})
|
||||
.activatemode_function(|pad, _parent, mode, activate| {
|
||||
Self::sink_activatemode(pad, mode, activate)
|
||||
})
|
||||
.build();
|
||||
|
||||
pad.set_active(true).unwrap();
|
||||
|
|
Loading…
Reference in a new issue