From cdca6c93720b0c10d0470aae28e820a252d3f217 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 31 Dec 2020 12:05:37 +0200 Subject: [PATCH] togglerecord: Check for flushing when the main stream waits for the other streams Otherwise it would not wake up and return when shutting down the element. --- utils/togglerecord/src/togglerecord/imp.rs | 28 ++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/utils/togglerecord/src/togglerecord/imp.rs b/utils/togglerecord/src/togglerecord/imp.rs index f9fce4d4..2ccc955e 100644 --- a/utils/togglerecord/src/togglerecord/imp.rs +++ b/utils/togglerecord/src/togglerecord/imp.rs @@ -497,12 +497,14 @@ impl ToggleRecord { // instead. drop(rec_state); - while !self.other_streams.lock().0.iter().all(|s| { - let s = s.state.lock(); - s.eos - || (s.current_running_time.is_some() - && s.current_running_time >= current_running_time) - }) { + while !state.flushing + && !self.other_streams.lock().0.iter().all(|s| { + let s = s.state.lock(); + s.eos + || (s.current_running_time.is_some() + && s.current_running_time >= current_running_time) + }) + { gst_log!(CAT, obj: pad, "Waiting for other streams to stop"); self.main_stream_cond.wait(&mut state); } @@ -582,12 +584,14 @@ impl ToggleRecord { // go EOS instead. drop(rec_state); - while !self.other_streams.lock().0.iter().all(|s| { - let s = s.state.lock(); - s.eos - || (s.current_running_time.is_some() - && s.current_running_time >= current_running_time) - }) { + while !state.flushing + && !self.other_streams.lock().0.iter().all(|s| { + let s = s.state.lock(); + s.eos + || (s.current_running_time.is_some() + && s.current_running_time >= current_running_time) + }) + { gst_log!(CAT, obj: pad, "Waiting for other streams to start"); self.main_stream_cond.wait(&mut state); }