dash: Fix computing `repeat_index` when seeking in stream with a start !=0 on the...
authorThibault Saunier <tsaunier@igalia.com>
Tue, 20 Sep 2022 18:32:52 +0000 (15:32 -0300)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 27 Oct 2022 19:45:44 +0000 (19:45 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3159>

subprojects/gst-plugins-bad/ext/dash/gstmpdclient.c
subprojects/gst-plugins-good/ext/adaptivedemux2/dash/gstmpdclient.c

index 68ea759..8938ce7 100644 (file)
@@ -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;
 
index 3a7ed98..50af5ea 100644 (file)
@@ -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;