mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-22 18:16:28 +00:00
onvifmetadataparse: Reset state in PAUSED->READY after pad deactivation
Otherwise the clock id will simply be overridden instead of unscheduling it, and if the streaming thread of the source pad currently waits on it then it will wait potentially for a very long time and deactivating the pad would wait for that to happen. Also unschedule the clock id on `Drop` of the state to be one the safe side and not simply forget about it. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1526>
This commit is contained in:
parent
70adedb142
commit
7757e06e36
1 changed files with 17 additions and 5 deletions
|
@ -153,6 +153,14 @@ impl Default for State {
|
|||
}
|
||||
}
|
||||
|
||||
impl Drop for State {
|
||||
fn drop(&mut self) {
|
||||
if let Some(clock_wait) = self.clock_wait.take() {
|
||||
clock_wait.unschedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct OnvifMetadataParse {
|
||||
srcpad: gst::Pad,
|
||||
sinkpad: gst::Pad,
|
||||
|
@ -1595,14 +1603,18 @@ impl ElementImpl for OnvifMetadataParse {
|
|||
) -> Result<gst::StateChangeSuccess, gst::StateChangeError> {
|
||||
gst::trace!(CAT, imp: self, "Changing state {:?}", transition);
|
||||
|
||||
if matches!(
|
||||
transition,
|
||||
gst::StateChange::PausedToReady | gst::StateChange::ReadyToPaused
|
||||
) {
|
||||
if matches!(transition, gst::StateChange::ReadyToPaused) {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
*state = State::default();
|
||||
}
|
||||
|
||||
self.parent_change_state(transition)
|
||||
let res = self.parent_change_state(transition)?;
|
||||
|
||||
if matches!(transition, gst::StateChange::PausedToReady) {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
*state = State::default();
|
||||
}
|
||||
|
||||
Ok(res)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue