dashdemux: Fix critical error output when Initialization has no URL
authorArthur Shipkowski <art@videon-central.com>
Mon, 6 May 2013 21:08:54 +0000 (17:08 -0400)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Mon, 1 Jul 2013 21:51:30 +0000 (18:51 -0300)
Issue evinced by
http://yt-dash-mse-test.commondatastorage.googleapis.com/car-20120827-manifest.mpd
which produces output like ** (gst-launch-1.0:8060): CRITICAL **:
gst_mpdparser_get_initializationURL: assertion `InitializationURL->sourceURL
!= NULL' failed

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

ext/dash/gstmpdparser.c

index aa17910..c1a03b9 100644 (file)
@@ -116,8 +116,8 @@ static gchar *gst_mpdparser_parse_baseURL (GstMpdClient * client,
     GstActiveStream * stream, gchar ** query);
 static gchar *gst_mpdparser_get_mediaURL (GstActiveStream * stream,
     GstSegmentURLNode * segmentURL);
-static gchar *gst_mpdparser_get_initializationURL (GstURLType *
-    InitializationURL);
+static const gchar *gst_mpdparser_get_initializationURL (
+    GstActiveStream * stream, GstURLType * InitializationURL);
 static gchar *gst_mpdparser_build_URL_from_template (const gchar * url_template,
     const gchar * id, guint number, guint bandwidth, guint64 time);
 static gboolean gst_mpd_client_add_media_segment (GstActiveStream * stream,
@@ -2368,13 +2368,19 @@ gst_mpdparser_get_mediaURL (GstActiveStream * stream,
   return segmentURL->media;
 }
 
-static gchar *
-gst_mpdparser_get_initializationURL (GstURLType * InitializationURL)
+static const gchar *
+gst_mpdparser_get_initializationURL (GstActiveStream * stream,
+    GstURLType * InitializationURL)
 {
+  const gchar *url_prefix;
+
+  g_return_val_if_fail (stream != NULL, NULL);
   g_return_val_if_fail (InitializationURL != NULL, NULL);
-  g_return_val_if_fail (InitializationURL->sourceURL != NULL, NULL);
 
-  return InitializationURL->sourceURL;
+  url_prefix = InitializationURL->sourceURL ? InitializationURL->sourceURL :
+      stream->baseURL;
+
+  return url_prefix;
 }
 
 static gchar *
@@ -3363,7 +3369,7 @@ gst_mpd_client_get_next_header (GstMpdClient * client, gchar ** uri,
   *uri = NULL;
   if (stream->cur_segment_base && stream->cur_segment_base->Initialization) {
     *uri =
-        g_strdup (gst_mpdparser_get_initializationURL (stream->cur_segment_base->
+        g_strdup (gst_mpdparser_get_initializationURL (stream, stream->cur_segment_base->
         Initialization));
     if (stream->cur_segment_base->Initialization->range) {
       *range_start =