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
This commit is contained in:
Guillaume Desmottes 2022-03-25 14:33:02 +01:00
parent 111257b81c
commit 2f116591f0

View file

@ -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);
}
});