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:
authorMathieu Duponchelle <mathieu@centricular.com>2020-12-03 01:13:55 +0300
committerSebastian Dröge <slomo@coaxion.net>2020-12-07 13:47:14 +0300
commit2131d5bfda964a062127ed859ce8d28e17f0e450 (patch)
tree712679eb3486c375ab540a23e51708e4a03daf41 /video/closedcaption
parent46651e31c4b7466e27ea7e81d932150fd74f23ce (diff)
sccparse, mccparse: fix deadlock on seek
Don't try to pause the sinkpad task while holding the state lock, that's a bit rude.
Diffstat (limited to 'video/closedcaption')
-rw-r--r--video/closedcaption/src/mcc_parse/imp.rs30
-rw-r--r--video/closedcaption/src/scc_parse/imp.rs30
2 files changed, 30 insertions, 30 deletions
diff --git a/video/closedcaption/src/mcc_parse/imp.rs b/video/closedcaption/src/mcc_parse/imp.rs
index c26f8b59f..9a855e87c 100644
--- a/video/closedcaption/src/mcc_parse/imp.rs
+++ b/video/closedcaption/src/mcc_parse/imp.rs
@@ -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)
diff --git a/video/closedcaption/src/scc_parse/imp.rs b/video/closedcaption/src/scc_parse/imp.rs
index d04d3a162..4eb55911d 100644
--- a/video/closedcaption/src/scc_parse/imp.rs
+++ b/video/closedcaption/src/scc_parse/imp.rs
@@ -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)