dashdemux: Fix SEEK of multi-period On-Demand profile
authorSeungha Yang <sh.yang@lge.com>
Thu, 23 Mar 2017 23:16:35 +0000 (08:16 +0900)
committerSebastian Dröge <sebastian@centricular.com>
Sun, 9 Apr 2017 07:54:01 +0000 (10:54 +0300)
For each period, media presentation is the relative to the
period-start time. So SIDX seek position should be target seek
position minus period-start. Also, if presentationTimeOffset
is defined, the value should be compensated

https://bugzilla.gnome.org/show_bug.cgi?id=780397

ext/dash/gstdashdemux.c

index 782c191c5d833820925f041d1bee838c23bd2dca..93e19000f83668705f0546ab5279816378da0cb8 100644 (file)
@@ -1341,6 +1341,18 @@ gst_dash_demux_stream_seek (GstAdaptiveDemuxStream * stream, gboolean forward,
       forward, flags, ts, final_ts);
 
   if (gst_mpd_client_has_isoff_ondemand_profile (dashdemux->client)) {
+    GstClockTime period_start, offset;
+
+    period_start = gst_mpd_parser_get_period_start_time (dashdemux->client);
+    offset =
+        gst_mpd_parser_get_stream_presentation_offset (dashdemux->client,
+        dashstream->index);
+
+    if (G_UNLIKELY (ts < period_start))
+      ts = offset;
+    else
+      ts += offset - period_start;
+
     if (last_index != dashstream->active_stream->segment_index ||
         last_repeat != dashstream->active_stream->segment_repeat_index) {
       GST_LOG_OBJECT (stream->pad,