mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
utils/togglerecord: fix race condition checking other streams EOS state
Function `check_and_update_stream_start` checks whether other streams reached EOS. The stream being checked might already have locked its state. If it's about to check other streams too, this results in a deadlock. The problem was due to the `main_state` guard being dropped handling event `StreamStart` checking whether the main stream is EOS: ```rust let main_is_eos = if let Some(main_state) = main_state { main_state.eos } else { false }; ``` In the above code, `main_state` main state is comsumed and dropped after evaluating `main_state.eos`. This is also the case before handling event `Eos`. This revealed another deadlock handling event `Eos` which is under investigation.
This commit is contained in:
parent
82d969190f
commit
a1c89dd17b
1 changed files with 6 additions and 10 deletions
|
@ -1410,11 +1410,9 @@ impl ToggleRecord {
|
|||
let mut state = stream.state.lock();
|
||||
state.eos = false;
|
||||
|
||||
let main_is_eos = if let Some(main_state) = main_state {
|
||||
main_state.eos
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let main_is_eos = main_state
|
||||
.as_ref()
|
||||
.map_or(false, |main_state| main_state.eos);
|
||||
|
||||
if !main_is_eos {
|
||||
let mut rec_state = self.state.lock();
|
||||
|
@ -1438,11 +1436,9 @@ impl ToggleRecord {
|
|||
let mut state = stream.state.lock();
|
||||
state.eos = true;
|
||||
|
||||
let main_is_eos = if let Some(main_state) = main_state {
|
||||
main_state.eos
|
||||
} else {
|
||||
true
|
||||
};
|
||||
let main_is_eos = main_state
|
||||
.as_ref()
|
||||
.map_or(true, |main_state| main_state.eos);
|
||||
|
||||
if main_is_eos {
|
||||
let mut rec_state = self.state.lock();
|
||||
|
|
Loading…
Reference in a new issue