summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2017-04-25 17:11:27 +0300
committerSebastian Dröge <sebastian@centricular.com>2017-05-08 18:11:28 +0200
commit8b63cb82194d18218413ac6b6d129fbb9fa74feb (patch)
treee667604be38305d6a2b36599b4588f15768035fd
parenta9dc4cb1170ffe48fd9409a1b92f913cff8ede97 (diff)
downloadgstreamer-plugins-good-8b63cb82194d18218413ac6b6d129fbb9fa74feb.tar.gz
qtdemux: Don't perform seeks with inconsistent seek values
If gst_segment_do_seek() fails, we shouldn't try seeking on that resulting segment but just error out. Crashes further down the line otherwise.
-rw-r--r--gst/isomp4/qtdemux.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gst/isomp4/qtdemux.c b/gst/isomp4/qtdemux.c
index 1f73cb0f1..91523e1ba 100644
--- a/gst/isomp4/qtdemux.c
+++ b/gst/isomp4/qtdemux.c
@@ -1562,6 +1562,7 @@ gst_qtdemux_do_seek (GstQTDemux * qtdemux, GstPad * pad, GstEvent * event)
GstSegment seeksegment;
guint32 seqnum = 0;
GstEvent *flush_event;
+ gboolean ret;
if (event) {
GST_DEBUG_OBJECT (qtdemux, "doing seek with event");
@@ -1608,13 +1609,19 @@ gst_qtdemux_do_seek (GstQTDemux * qtdemux, GstPad * pad, GstEvent * event)
if (event) {
/* configure the segment with the seek variables */
GST_DEBUG_OBJECT (qtdemux, "configuring seek");
- gst_segment_do_seek (&seeksegment, rate, format, flags,
- cur_type, cur, stop_type, stop, &update);
+ if (!gst_segment_do_seek (&seeksegment, rate, format, flags,
+ cur_type, cur, stop_type, stop, &update)) {
+ ret = FALSE;
+ GST_ERROR_OBJECT (qtdemux, "inconsistent seek values, doing nothing");
+ } else {
+ /* now do the seek */
+ ret = gst_qtdemux_perform_seek (qtdemux, &seeksegment, seqnum, flags);
+ }
+ } else {
+ /* now do the seek */
+ ret = gst_qtdemux_perform_seek (qtdemux, &seeksegment, seqnum, flags);
}
- /* now do the seek, this actually never returns FALSE */
- gst_qtdemux_perform_seek (qtdemux, &seeksegment, seqnum, flags);
-
/* prepare for streaming again */
if (flush) {
flush_event = gst_event_new_flush_stop (TRUE);
@@ -1642,7 +1649,7 @@ gst_qtdemux_do_seek (GstQTDemux * qtdemux, GstPad * pad, GstEvent * event)
GST_PAD_STREAM_UNLOCK (qtdemux->sinkpad);
- return TRUE;
+ return ret;
/* ERRORS */
no_format: