mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-25 19:40:29 +00:00
uriplaylistbin: fix deadlock when shutting down
The probes on srcpad was not removed which was preventing the element to reach the NULL state.
This commit is contained in:
parent
e0d05353e8
commit
ab96219c19
1 changed files with 29 additions and 0 deletions
|
@ -607,6 +607,17 @@ impl Item {
|
|||
_ => panic!("invalid state: {:?}", inner.state),
|
||||
}
|
||||
}
|
||||
|
||||
fn sender(&self) -> crossbeam_channel::Sender<bool> {
|
||||
let inner = self.inner.lock().unwrap();
|
||||
|
||||
match &inner.state {
|
||||
ItemState::WaitingForStreamsynchronizerEos { sender, .. } => sender.clone(),
|
||||
ItemState::WaitingForPads { sender, .. } => sender.clone(),
|
||||
ItemState::Blocked { sender, .. } => sender.clone(),
|
||||
_ => panic!("invalid state: {:?}", inner.state),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
@ -935,6 +946,24 @@ impl ElementImpl for UriPlaylistBin {
|
|||
}
|
||||
}
|
||||
|
||||
if transition == gst::StateChange::PausedToReady {
|
||||
let mut state_guard = self.state.lock().unwrap();
|
||||
let state = state_guard.as_mut().unwrap();
|
||||
|
||||
// The probe callback owns a ref on the item and so on the sender as well.
|
||||
// As a result we have to explicitly unblock all receivers as dropping the sender
|
||||
// is not enough.
|
||||
if let Some(item) = state.waiting_for_ss_eos.take() {
|
||||
let _ = item.sender().send(false);
|
||||
}
|
||||
if let Some(item) = state.waiting_for_pads.take() {
|
||||
let _ = item.sender().send(false);
|
||||
}
|
||||
if let Some(item) = state.blocked.take() {
|
||||
let _ = item.sender().send(false);
|
||||
}
|
||||
}
|
||||
|
||||
self.parent_change_state(element, transition)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue