mpdparser: tests: added test for gst_mpd_client_get_last_fragment_timestamp_end
authorFlorin Apostol <florin.apostol@oregan.net>
Mon, 16 Nov 2015 17:25:21 +0000 (17:25 +0000)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 18 Nov 2015 07:50:26 +0000 (09:50 +0200)
The timestamp for last fragment is incorrectly retrieved if segment templates
are used.

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

tests/check/elements/dash_mpd.c

index b2091e3..1f4ae3b 100644 (file)
@@ -4389,6 +4389,7 @@ GST_START_TEST (dash_mpdparser_segment_template)
   GstClockTime expectedTimestamp;
   GstClockTime periodStartTime;
   GstClockTime offset;
+  GstClockTime lastFragmentTimestampEnd;
   const gchar *xml =
       "<?xml version=\"1.0\"?>"
       "<MPD xmlns=\"urn:mpeg:dash:schema:mpd:2011\""
@@ -4464,6 +4465,17 @@ GST_START_TEST (dash_mpdparser_segment_template)
 
   gst_media_fragment_info_clear (&fragment);
 
+  /*
+   * Period starts at 10s.
+   * MPD has a duration of 3h3m30s, so period duration is 3h3m20s.
+   * We expect the last fragment to end at period start + period duration: 3h3m30s
+   */
+  expectedTimestamp = duration_to_ms (0, 0, 0, 3, 3, 30, 0);
+  gst_mpd_client_get_last_fragment_timestamp_end (mpdclient, 0,
+      &lastFragmentTimestampEnd);
+  assert_equals_uint64 (lastFragmentTimestampEnd,
+      expectedTimestamp * GST_MSECOND);
+
   gst_mpd_client_free (mpdclient);
 }