mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 13:01:07 +00:00
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:
parent
88edc93a8a
commit
e0d05353e8
1 changed files with 4 additions and 7 deletions
|
@ -1050,14 +1050,10 @@ impl UriPlaylistBin {
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
let imp = element.imp();
|
let imp = element.imp();
|
||||||
|
let mut state_guard = imp.state.lock().unwrap();
|
||||||
|
let state = state_guard.as_mut().unwrap();
|
||||||
|
|
||||||
let item = {
|
if let Some(item) = state.waiting_for_ss_eos.as_ref() {
|
||||||
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 {
|
|
||||||
// block pad until streamsynchronizer is eos
|
// block pad until streamsynchronizer is eos
|
||||||
let element_weak = element.downgrade();
|
let element_weak = element.downgrade();
|
||||||
let receiver = item.receiver();
|
let receiver = item.receiver();
|
||||||
|
@ -1091,6 +1087,7 @@ impl UriPlaylistBin {
|
||||||
|
|
||||||
item.add_blocked_pad(src_pad.clone());
|
item.add_blocked_pad(src_pad.clone());
|
||||||
} else {
|
} else {
|
||||||
|
drop(state_guard);
|
||||||
imp.process_decodebin_pad(src_pad);
|
imp.process_decodebin_pad(src_pad);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue