mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 04:56:14 +00:00
matroska: demux: update stream_start_time
The stream_start_time can be less than the first detected. In case of B-Frame based media, the first frame PTS might be greater than the next one. Need to keep the segment.start if a seek has been performed. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1030>
This commit is contained in:
parent
65deef0b0c
commit
508a565163
1 changed files with 14 additions and 4 deletions
|
@ -4611,6 +4611,7 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
|
||||||
gboolean delta_unit = FALSE;
|
gboolean delta_unit = FALSE;
|
||||||
guint64 duration = 0;
|
guint64 duration = 0;
|
||||||
gint64 lace_time = 0;
|
gint64 lace_time = 0;
|
||||||
|
gboolean keep_seek_start = TRUE;
|
||||||
GstEvent *protect_event;
|
GstEvent *protect_event;
|
||||||
|
|
||||||
stream = g_ptr_array_index (demux->common.src, stream_num);
|
stream = g_ptr_array_index (demux->common.src, stream_num);
|
||||||
|
@ -4639,6 +4640,15 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* need to refresh segment info ASAP */
|
/* need to refresh segment info ASAP */
|
||||||
|
if (GST_CLOCK_TIME_IS_VALID (lace_time)
|
||||||
|
&& GST_CLOCK_TIME_IS_VALID (demux->stream_start_time)
|
||||||
|
&& lace_time < demux->stream_start_time) {
|
||||||
|
keep_seek_start =
|
||||||
|
(demux->common.segment.start > demux->stream_start_time);
|
||||||
|
demux->stream_start_time = lace_time;
|
||||||
|
demux->need_segment = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
if (GST_CLOCK_TIME_IS_VALID (lace_time) && demux->need_segment) {
|
if (GST_CLOCK_TIME_IS_VALID (lace_time) && demux->need_segment) {
|
||||||
GstSegment *segment = &demux->common.segment;
|
GstSegment *segment = &demux->common.segment;
|
||||||
guint64 clace_time;
|
guint64 clace_time;
|
||||||
|
@ -4651,10 +4661,10 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
|
||||||
GST_TIME_ARGS (lace_time));
|
GST_TIME_ARGS (lace_time));
|
||||||
}
|
}
|
||||||
clace_time = MAX (lace_time, demux->stream_start_time);
|
clace_time = MAX (lace_time, demux->stream_start_time);
|
||||||
if (GST_CLOCK_TIME_IS_VALID (demux->common.segment.position) &&
|
if (keep_seek_start
|
||||||
demux->common.segment.position != 0) {
|
&& GST_CLOCK_TIME_IS_VALID (demux->common.segment.position)
|
||||||
GST_DEBUG_OBJECT (demux,
|
&& demux->common.segment.position != 0) {
|
||||||
"using stored seek position %" GST_TIME_FORMAT,
|
GST_DEBUG_OBJECT (demux, "using stored seek position %" GST_TIME_FORMAT,
|
||||||
GST_TIME_ARGS (demux->common.segment.position));
|
GST_TIME_ARGS (demux->common.segment.position));
|
||||||
clace_time = demux->common.segment.position;
|
clace_time = demux->common.segment.position;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue