mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-14 06:11:10 +00:00
fallbackswitch: prevent deadlocks in chain function
Calling schedule_timeout() may result in handle_timeout() being called right away, which will need pad state locks which was still hold in chain(). Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1329>
This commit is contained in:
parent
2e4135ceff
commit
c9c49dc54c
1 changed files with 6 additions and 1 deletions
|
@ -829,11 +829,14 @@ impl FallbackSwitch {
|
|||
is_active = self.active_sinkpad.lock().as_ref() == Some(pad);
|
||||
}
|
||||
|
||||
let mut pad_state = pad_imp.state.lock();
|
||||
let pad_state = pad_imp.state.lock();
|
||||
if pad_state.flushing {
|
||||
debug!(CAT, imp: self, "Flushing");
|
||||
return Err(gst::FlowError::Flushing);
|
||||
}
|
||||
// calling schedule_timeout() may result in handle_timeout() being called right away,
|
||||
// which will need pad state locks, so drop it now to prevent deadlocks.
|
||||
drop(pad_state);
|
||||
|
||||
if is_active {
|
||||
if start_running_time
|
||||
|
@ -879,6 +882,8 @@ impl FallbackSwitch {
|
|||
}
|
||||
}
|
||||
|
||||
let mut pad_state = pad_imp.state.lock();
|
||||
|
||||
if let Some(running_time) = end_running_time {
|
||||
pad_state.current_running_time = Some(running_time);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue