Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@onestream.live>2022-03-25 17:52:08 +0300
committerGuillaume Desmottes <guillaume.desmottes@onestream.live>2022-03-28 11:55:24 +0300
commite53515cc1483e3a98543393f65d66faaab60ef54 (patch)
treea4f8a7197d73744f484acf32350696afbc869c7f
parent2f116591f0a384cd9806c3cb18ed947bd3c272d2 (diff)
uriplaylistbin: fix deadlock when shutting down
The probes on srcpad was not removed which was preventing the element to reach the NULL state.
-rw-r--r--utils/uriplaylistbin/src/uriplaylistbin/imp.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs
index 445b1e24a..1124f3b4d 100644
--- a/utils/uriplaylistbin/src/uriplaylistbin/imp.rs
+++ b/utils/uriplaylistbin/src/uriplaylistbin/imp.rs
@@ -608,6 +608,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)]
@@ -936,6 +947,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)
}
}