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.
This commit is contained in:
parent
628ae5c1a1
commit
a7d6690f92
@ -480,6 +480,8 @@ gst_matroska_demux_reset (GstElement * element)
|
|||||||
gst_buffer_unref (demux->common.cached_buffer);
|
gst_buffer_unref (demux->common.cached_buffer);
|
||||||
demux->common.cached_buffer = NULL;
|
demux->common.cached_buffer = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
demux->invalid_duration = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstBuffer *
|
static GstBuffer *
|
||||||
@ -1928,6 +1930,16 @@ gst_matroska_demux_handle_seek_event (GstMatroskaDemux * demux,
|
|||||||
* segment when we close the current segment. */
|
* segment when we close the current segment. */
|
||||||
memcpy (&seeksegment, &demux->common.segment, sizeof (GstSegment));
|
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) {
|
if (event) {
|
||||||
GST_DEBUG_OBJECT (demux, "configuring seek");
|
GST_DEBUG_OBJECT (demux, "configuring seek");
|
||||||
gst_segment_set_seek (&seeksegment, rate, format, flags,
|
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);
|
flush = ! !(flags & GST_SEEK_FLAG_FLUSH);
|
||||||
keyunit = ! !(flags & GST_SEEK_FLAG_KEY_UNIT);
|
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_element_post_message (GST_ELEMENT_CAST (demux),
|
||||||
gst_message_new_duration (GST_OBJECT_CAST (demux),
|
gst_message_new_duration (GST_OBJECT_CAST (demux),
|
||||||
GST_FORMAT_TIME, GST_CLOCK_TIME_NONE));
|
GST_FORMAT_TIME, GST_CLOCK_TIME_NONE));
|
||||||
|
demux->invalid_duration = TRUE;
|
||||||
} else {
|
} else {
|
||||||
GST_OBJECT_UNLOCK (demux);
|
GST_OBJECT_UNLOCK (demux);
|
||||||
}
|
}
|
||||||
|
@ -95,6 +95,9 @@ typedef struct _GstMatroskaDemux {
|
|||||||
|
|
||||||
/* gap handling */
|
/* gap handling */
|
||||||
guint64 max_gap_time;
|
guint64 max_gap_time;
|
||||||
|
|
||||||
|
/* for non-finalized files, with invalid segment duration */
|
||||||
|
gboolean invalid_duration;
|
||||||
} GstMatroskaDemux;
|
} GstMatroskaDemux;
|
||||||
|
|
||||||
typedef struct _GstMatroskaDemuxClass {
|
typedef struct _GstMatroskaDemuxClass {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user