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 88edc93a8a
commit e0d05353e8

View file

@ -1050,14 +1050,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();
@ -1091,6 +1087,7 @@ impl UriPlaylistBin {
item.add_blocked_pad(src_pad.clone());
} else {
drop(state_guard);
imp.process_decodebin_pad(src_pad);
}
});