mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-24 02:50:34 +00:00
sccparse, mccparse: fix deadlock on seek
Don't try to pause the sinkpad task while holding the state lock, that's a bit rude.
This commit is contained in:
parent
46651e31c4
commit
2131d5bfda
2 changed files with 30 additions and 30 deletions
|
@ -961,9 +961,7 @@ impl MccParse {
|
|||
}
|
||||
|
||||
fn perform_seek(&self, event: &gst::event::Seek, element: &super::MccParse) -> bool {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
||||
if state.pull.is_none() {
|
||||
if self.state.lock().unwrap().pull.is_none() {
|
||||
gst_error!(CAT, obj: element, "seeking is only supported in pull mode");
|
||||
return false;
|
||||
}
|
||||
|
@ -996,19 +994,7 @@ impl MccParse {
|
|||
return false;
|
||||
}
|
||||
|
||||
let pull = state.pull.as_ref().unwrap();
|
||||
|
||||
if start_type == gst::SeekType::Set {
|
||||
start = start.min(pull.duration).unwrap_or(start);
|
||||
}
|
||||
|
||||
if stop_type == gst::SeekType::Set {
|
||||
stop = stop.min(pull.duration).unwrap_or(stop);
|
||||
}
|
||||
|
||||
state.seeking = true;
|
||||
let seek_seqnum = event.get_seqnum();
|
||||
state.seek_seqnum = Some(seek_seqnum);
|
||||
|
||||
let event = gst::event::FlushStart::builder()
|
||||
.seqnum(seek_seqnum)
|
||||
|
@ -1026,6 +1012,20 @@ impl MccParse {
|
|||
|
||||
self.sinkpad.pause_task().unwrap();
|
||||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
let pull = state.pull.as_ref().unwrap();
|
||||
|
||||
if start_type == gst::SeekType::Set {
|
||||
start = start.min(pull.duration).unwrap_or(start);
|
||||
}
|
||||
|
||||
if stop_type == gst::SeekType::Set {
|
||||
stop = stop.min(pull.duration).unwrap_or(stop);
|
||||
}
|
||||
|
||||
state.seeking = true;
|
||||
state.seek_seqnum = Some(seek_seqnum);
|
||||
|
||||
state = self.flush(state);
|
||||
|
||||
let event = gst::event::FlushStop::builder(true)
|
||||
|
|
|
@ -830,9 +830,7 @@ impl SccParse {
|
|||
}
|
||||
|
||||
fn perform_seek(&self, event: &gst::event::Seek, element: &super::SccParse) -> bool {
|
||||
let mut state = self.state.lock().unwrap();
|
||||
|
||||
if state.pull.is_none() {
|
||||
if self.state.lock().unwrap().pull.is_none() {
|
||||
gst_error!(CAT, obj: element, "seeking is only supported in pull mode");
|
||||
return false;
|
||||
}
|
||||
|
@ -865,19 +863,7 @@ impl SccParse {
|
|||
return false;
|
||||
}
|
||||
|
||||
let pull = state.pull.as_ref().unwrap();
|
||||
|
||||
if start_type == gst::SeekType::Set {
|
||||
start = start.min(pull.duration).unwrap_or(start);
|
||||
}
|
||||
|
||||
if stop_type == gst::SeekType::Set {
|
||||
stop = stop.min(pull.duration).unwrap_or(stop);
|
||||
}
|
||||
|
||||
state.seeking = true;
|
||||
let seek_seqnum = event.get_seqnum();
|
||||
state.seek_seqnum = Some(seek_seqnum);
|
||||
|
||||
let event = gst::event::FlushStart::builder()
|
||||
.seqnum(seek_seqnum)
|
||||
|
@ -895,6 +881,20 @@ impl SccParse {
|
|||
|
||||
self.sinkpad.pause_task().unwrap();
|
||||
|
||||
let mut state = self.state.lock().unwrap();
|
||||
let pull = state.pull.as_ref().unwrap();
|
||||
|
||||
if start_type == gst::SeekType::Set {
|
||||
start = start.min(pull.duration).unwrap_or(start);
|
||||
}
|
||||
|
||||
if stop_type == gst::SeekType::Set {
|
||||
stop = stop.min(pull.duration).unwrap_or(stop);
|
||||
}
|
||||
|
||||
state.seeking = true;
|
||||
state.seek_seqnum = Some(seek_seqnum);
|
||||
|
||||
state = self.flush(state);
|
||||
|
||||
let event = gst::event::FlushStop::builder(true)
|
||||
|
|
Loading…
Reference in a new issue