dashdemux: prevent assertion when duration is unknown
authorThiago Santos <thiago.sousa.santos@collabora.com>
Wed, 3 Jul 2013 22:11:45 +0000 (19:11 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Wed, 3 Jul 2013 22:11:45 +0000 (19:11 -0300)
Duration from segment being unknown is a issue from the MPD and not
a programming issue, so the assert isn't useful here. Instead check
and return an error code so the caller can fallback to alternatives

ext/dash/gstmpdparser.c

index e9fb433..94c8f4c 100644 (file)
@@ -3566,7 +3566,8 @@ gst_mpd_client_get_segment_index_at_time (GstMpdClient * client,
 
   /* TODO: Assumes all fragments are roughly the same duration */
   seg_duration = gst_mpd_client_get_next_fragment_duration (client, stream);
-  g_assert (seg_duration > 0);
+  if (seg_duration == 0)
+    return -1;
   return diff / seg_duration;
 }