mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-29 06:50:59 +00:00
utils/togglerecord: fix race condition in sink_chain when segment is pending
In `sink_chain` when the Segment is pending, attempting to lock rec state could lead to a dead lock because the stream state is already locked while the main stream state was not locked.
This commit is contained in:
parent
a1c89dd17b
commit
7c909e59a9
1 changed files with 7 additions and 0 deletions
|
@ -1216,6 +1216,12 @@ impl ToggleRecord {
|
||||||
};
|
};
|
||||||
|
|
||||||
let out_running_time = {
|
let out_running_time = {
|
||||||
|
let main_state = if stream != self.main_stream {
|
||||||
|
Some(self.main_stream.state.lock())
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let mut state = stream.state.lock();
|
let mut state = stream.state.lock();
|
||||||
|
|
||||||
if state.discont_pending {
|
if state.discont_pending {
|
||||||
|
@ -1260,6 +1266,7 @@ impl ToggleRecord {
|
||||||
|
|
||||||
// Unlock before pushing
|
// Unlock before pushing
|
||||||
drop(state);
|
drop(state);
|
||||||
|
drop(main_state);
|
||||||
|
|
||||||
for e in events.drain(..) {
|
for e in events.drain(..) {
|
||||||
stream.srcpad.push_event(e);
|
stream.srcpad.push_event(e);
|
||||||
|
|
Loading…
Reference in a new issue