diff options
author | Branko Subasic <branko@axis.com> | 2011-12-21 17:43:10 +0100 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2011-12-21 18:14:26 +0100 |
commit | a7d6690f92e6c739d3b3e28d99d1f7840f8c59d9 (patch) | |
tree | 0e626b9a9824c7df1a5cbdabbab693aa433e8b2a /gst/matroska | |
parent | 628ae5c1a1001f02de605d89b753759fce4ed5c8 (diff) |
matroskademux: do not consider duration of non-finalized file
... to avoid it clamping requested seek position.
Non-finalized file case, determined by whether
_parse_blockgroup_or_simpleblock ever updates the segment duration.
Fixes #652195.
Diffstat (limited to 'gst/matroska')
-rw-r--r-- | gst/matroska/matroska-demux.c | 18 | ||||
-rw-r--r-- | gst/matroska/matroska-demux.h | 3 |
2 files changed, 21 insertions, 0 deletions
diff --git a/gst/matroska/matroska-demux.c b/gst/matroska/matroska-demux.c index 2ce2d7656..e80febcb5 100644 --- a/gst/matroska/matroska-demux.c +++ b/gst/matroska/matroska-demux.c @@ -480,6 +480,8 @@ gst_matroska_demux_reset (GstElement * element) gst_buffer_unref (demux->common.cached_buffer); demux->common.cached_buffer = NULL; } + + demux->invalid_duration = FALSE; } static GstBuffer * @@ -1928,6 +1930,16 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux, * segment when we close the current segment. */ memcpy (&seeksegment, &demux->common.segment, sizeof (GstSegment)); + /* pull mode without index means that the actual duration is not known, + * we might be playing a file that's still being recorded + * so, invalidate our current duration, which is only a moving target, + * and should not be used to clamp anything */ + if (!demux->streaming && !demux->common.index && + demux->invalid_duration) { + gst_segment_set_duration (&seeksegment, GST_FORMAT_TIME, + GST_CLOCK_TIME_NONE); + } + if (event) { GST_DEBUG_OBJECT (demux, "configuring seek"); gst_segment_set_seek (&seeksegment, rate, format, flags, @@ -1942,6 +1954,11 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux, } } + /* restore segment duration (if any effect), + * would be determined again when parsing, but anyway ... */ + gst_segment_set_duration (&seeksegment, GST_FORMAT_TIME, + demux->common.segment.duration); + flush = ! !(flags & GST_SEEK_FLAG_FLUSH); keyunit = ! !(flags & GST_SEEK_FLAG_KEY_UNIT); @@ -3501,6 +3518,7 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux, gst_element_post_message (GST_ELEMENT_CAST (demux), gst_message_new_duration (GST_OBJECT_CAST (demux), GST_FORMAT_TIME, GST_CLOCK_TIME_NONE)); + demux->invalid_duration = TRUE; } else { GST_OBJECT_UNLOCK (demux); } diff --git a/gst/matroska/matroska-demux.h b/gst/matroska/matroska-demux.h index 2b08b2e39..22093ea4a 100644 --- a/gst/matroska/matroska-demux.h +++ b/gst/matroska/matroska-demux.h @@ -95,6 +95,9 @@ typedef struct _GstMatroskaDemux { /* gap handling */ guint64 max_gap_time; + + /* for non-finalized files, with invalid segment duration */ + gboolean invalid_duration; } GstMatroskaDemux; typedef struct _GstMatroskaDemuxClass { |