mpdparser: fix period start time scaling
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Mon, 7 Sep 2015 11:09:41 +0000 (12:09 +0100)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Mon, 7 Sep 2015 11:52:03 +0000 (12:52 +0100)
This GstStreamPeriod start value is expressed in nanoseconds,
and the glib time addition function expects microseconds.
There seems to have been a confusion with GstPeriodNode's start
field, which is expressed in milliseconds.

Additionally, add a warning if the timestamp modification did
not succeed, and NULL was returned.

ext/dash/gstmpdparser.c

index ea5dc6b..c604c45 100644 (file)
@@ -4563,9 +4563,14 @@ gst_mpd_client_get_next_segment_availability_end_time (GstMpdClient * client,
   if (stream_period && stream_period->period) {
     GstDateTime *t =
         gst_mpd_client_add_time_difference (availability_start_time,
-        stream_period->start * 1000);
+        stream_period->start / 1000);
     gst_date_time_unref (availability_start_time);
     availability_start_time = t;
+
+    if (availability_start_time == NULL) {
+      GST_WARNING_OBJECT (client, "Failed to offset availability_start_time");
+      return NULL;
+    }
   }
 
   offset = (1 + seg_idx) * seg_duration;