diff options
author | Thiago Santos <thiago.sousa.santos@collabora.com> | 2013-07-30 22:06:38 -0300 |
---|---|---|
committer | Thiago Santos <thiago.sousa.santos@collabora.com> | 2013-07-30 22:06:38 -0300 |
commit | ac07f8577bd63a77848ed6339810a72f56663326 (patch) | |
tree | 6660d42209b710f928db019bcfa9646b00fdfa07 | |
parent | 646ba6b3df8f363723715f8bac2092c8fb07648d (diff) |
dashdemux: properly error out when manifest has no streams
Post an error message when the manifest is parsed and no valid streams
are found be activated and used.
Fixes #704308
-rw-r--r-- | ext/dash/gstdashdemux.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index c3a442ca6..e2b746ef4 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -646,16 +646,19 @@ gst_dash_demux_src_event (GstPad * pad, GstObject * parent, GstEvent * event) return gst_pad_event_default (pad, parent, event); } -static void +static gboolean gst_dash_demux_setup_mpdparser_streams (GstDashDemux * demux, GstMpdClient * client) { GList *listLang = NULL; guint i, nb_audio; gchar *lang; + gboolean has_streams = FALSE; if (!gst_mpd_client_setup_streaming (client, GST_STREAM_VIDEO, "")) GST_INFO_OBJECT (demux, "No video adaptation set found"); + else + has_streams = TRUE; nb_audio = gst_mpdparser_get_list_and_nb_of_audio_language (client, &listLang); @@ -669,12 +672,23 @@ gst_dash_demux_setup_mpdparser_streams (GstDashDemux * demux, gst_mpdparser_get_nb_adaptationSet (client)); if (!gst_mpd_client_setup_streaming (client, GST_STREAM_AUDIO, lang)) GST_INFO_OBJECT (demux, "No audio adaptation set found"); + else + has_streams = TRUE; - if (gst_mpdparser_get_nb_adaptationSet (client) > nb_audio) + if (gst_mpdparser_get_nb_adaptationSet (client) > nb_audio) { if (!gst_mpd_client_setup_streaming (client, - GST_STREAM_APPLICATION, lang)) + GST_STREAM_APPLICATION, lang)) { GST_INFO_OBJECT (demux, "No application adaptation set found"); + } else { + has_streams = TRUE; + } + } + } + if (!has_streams) { + GST_ELEMENT_ERROR (demux, STREAM, DEMUX, ("Manifest has no playable " + "streams"), ("No streams could be activated from the manifest")); } + return has_streams; } static gboolean @@ -687,7 +701,9 @@ gst_dash_demux_setup_all_streams (GstDashDemux * demux) /* clean old active stream list, if any */ gst_active_streams_free (demux->client); - gst_dash_demux_setup_mpdparser_streams (demux, demux->client); + if (!gst_dash_demux_setup_mpdparser_streams (demux, demux->client)) { + return FALSE; + } GST_DEBUG_OBJECT (demux, "Creating stream objects"); for (i = 0; i < gst_mpdparser_get_nb_active_stream (demux->client); i++) { @@ -1216,7 +1232,7 @@ gst_dash_demux_stream_loop (GstDashDemux * demux) break; } } else { - GST_DEBUG_OBJECT (demux, "Non buffers have preference %p", item->object); + GST_DEBUG_OBJECT (demux, "Non buffers have preference %" GST_PTR_FORMAT, item->object); selected_stream = stream; break; } @@ -1534,7 +1550,11 @@ gst_dash_demux_refresh_mpd (GstDashDemux * demux) } } - gst_dash_demux_setup_mpdparser_streams (demux, new_client); + if (!gst_dash_demux_setup_mpdparser_streams (demux, new_client)) { + GST_ERROR_OBJECT (demux, "Failed to setup streams on manifest " + "update"); + return GST_FLOW_ERROR; + } /* update the streams to play from the next segment */ for (iter = demux->streams; iter; iter = g_slist_next (iter)) { @@ -1735,6 +1755,7 @@ gst_dash_demux_download_loop (GstDashDemux * demux) demux->client->update_failed_count = 0; quit: + GST_DEBUG_OBJECT (demux, "Finishing download loop"); return; cancelled: |