diff options
author | Guillaume Desmottes <guillaume.desmottes@onestream.live> | 2022-03-25 16:33:02 +0300 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@onestream.live> | 2022-03-28 11:53:56 +0300 |
commit | 2f116591f0a384cd9806c3cb18ed947bd3c272d2 (patch) | |
tree | 6b7a775d90d865f38962778ddd094d997507cab4 | |
parent | 111257b81c06fae0562c4a30fa28736bc24cfc78 (diff) |
uriplaylistbin: fix race when handling topology change
Keep the state mutex during the whole decodebin pad-added callback.
Fix a race when we were checking if state.waiting_for_ss_eos was set and
it was removed before we actually processed the item.
Fix #184
-rw-r--r-- | utils/uriplaylistbin/src/uriplaylistbin/imp.rs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs index e3a1756bf..445b1e24a 100644 --- a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs +++ b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs @@ -1051,14 +1051,10 @@ impl UriPlaylistBin { None => return, }; let imp = element.imp(); + let mut state_guard = imp.state.lock().unwrap(); + let state = state_guard.as_mut().unwrap(); - let item = { - let mut state_guard = imp.state.lock().unwrap(); - let state = state_guard.as_mut().unwrap(); - state.waiting_for_ss_eos.as_ref().cloned() - }; - - if let Some(item) = item { + if let Some(item) = state.waiting_for_ss_eos.as_ref() { // block pad until streamsynchronizer is eos let element_weak = element.downgrade(); let receiver = item.receiver(); @@ -1092,6 +1088,7 @@ impl UriPlaylistBin { item.add_blocked_pad(src_pad.clone()); } else { + drop(state_guard); imp.process_decodebin_pad(src_pad); } }); |