diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c index 38f36dba7d..a79cc1d8a7 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux-stream.c @@ -63,6 +63,8 @@ gst_adaptive_demux2_stream_init (GstAdaptiveDemux2Stream * stream) stream->fragment_bitrates = g_malloc0 (sizeof (guint64) * NUM_LOOKBACK_FRAGMENTS); + stream->start_position = stream->current_position = GST_CLOCK_TIME_NONE; + gst_segment_init (&stream->parse_segment, GST_FORMAT_TIME); } diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c index bd7aa360ed..490399a138 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/gstadaptivedemux.c @@ -1812,6 +1812,16 @@ gst_adaptive_demux_prepare_streams (GstAdaptiveDemux * demux, GST_TIME_ARGS (period_start), GST_STIME_ARGS (min_stream_time), &demux->segment); + /* Synchronize stream start/current positions */ + if (min_stream_time == GST_CLOCK_STIME_NONE) + min_stream_time = period_start; + else + min_stream_time += period_start; + for (iter = new_streams; iter; iter = g_list_next (iter)) { + GstAdaptiveDemux2Stream *stream = iter->data; + stream->start_position = stream->current_position = min_stream_time; + } + for (iter = new_streams; iter; iter = g_list_next (iter)) { GstAdaptiveDemux2Stream *stream = iter->data; stream->compute_segment = TRUE;