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
This commit is contained in:
Thiago Santos 2013-07-30 22:06:38 -03:00
parent 646ba6b3df
commit ac07f8577b

View file

@ -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,13 +672,24 @@ 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
gst_dash_demux_setup_all_streams (GstDashDemux * demux)
@ -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: