From 8a9821e8050122fb80475d8f1a805e378bc749bd Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 20 Sep 2022 15:32:52 -0300 Subject: [PATCH] dash: Fix computing `repeat_index` when seeking in stream with a start !=0 on the first fragment Part-of: --- subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c | 5 ++++- .../gst-plugins-good/ext/adaptivedemux2/dash/gstmpdclient.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c b/subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c index 68ea7593e1..8938ce771e 100644 --- a/subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c +++ b/subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c @@ -1705,7 +1705,10 @@ gst_mpd_client_stream_seek (GstMPDClient * client, GstActiveStream * stream, GstClockTime chunk_time; selectedChunk = segment; - repeat_index = (ts - segment->start) / segment->duration; + repeat_index = + ((ts - segment->start) + + ((GstMediaSegment *) stream->segments->pdata[0])->start) / + segment->duration; chunk_time = segment->start + segment->duration * repeat_index; diff --git a/subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstmpdclient.c b/subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstmpdclient.c index 3a7ed981fd..50af5ea15a 100644 --- a/subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstmpdclient.c +++ b/subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstmpdclient.c @@ -1707,7 +1707,10 @@ gst_mpd_client2_stream_seek (GstMPDClient2 * client, GstActiveStream * stream, GstClockTime chunk_time; selectedChunk = segment; - repeat_index = (ts - segment->start) / segment->duration; + repeat_index = + ((ts - segment->start) + + ((GstMediaSegment *) stream->segments->pdata[0])->start) / + segment->duration; chunk_time = segment->start + segment->duration * repeat_index;