From 3f26bb9154134e6b0dd3d80d85ca9cefc7853051 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Olivier=20Cr=C3=AAte?= Date: Mon, 10 Jun 2013 18:01:14 -0400 Subject: [PATCH] dashdemux: Handle case without an initialization segment If no initialization segment is defined, then don't print a critical or a warning, just ignore it. https://bugzilla.gnome.org/show_bug.cgi?id=701961 --- ext/dash/gstdashdemux.c | 26 +++++++++++++++----------- ext/dash/gstmpdparser.c | 8 +++++--- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/ext/dash/gstdashdemux.c b/ext/dash/gstdashdemux.c index 0efd04a..b8a5432 100644 --- a/ext/dash/gstdashdemux.c +++ b/ext/dash/gstdashdemux.c @@ -1728,18 +1728,24 @@ gst_dash_demux_get_next_header (GstDashDemux * demux, guint stream_idx) initializationURL, range_start, range_end); /* check if we have an index */ - if (gst_mpd_client_get_next_header_index (demux->client, &initializationURL, - stream_idx, &range_start, &range_end)) { - GST_INFO_OBJECT (demux, "Fetching index %s %" G_GINT64_FORMAT "-%" - G_GINT64_FORMAT, initializationURL, range_start, range_end); - index_buffer = gst_dash_demux_download_header_fragment (demux, stream_idx, + if (header_buffer + && gst_mpd_client_get_next_header_index (demux->client, + &initializationURL, stream_idx, &range_start, &range_end)) { + GST_INFO_OBJECT (demux, + "Fetching index %s %" G_GINT64_FORMAT "-%" G_GINT64_FORMAT, + initializationURL, range_start, range_end); + index_buffer = + gst_dash_demux_download_header_fragment (demux, stream_idx, initializationURL, range_start, range_end); } - if (index_buffer && header_buffer) { + if (header_buffer == NULL) { + GST_WARNING_OBJECT (demux, "Unable to fetch header"); + return NULL; + } + + if (index_buffer) { header_buffer = gst_buffer_append (header_buffer, index_buffer); - } else if (index_buffer) { - gst_buffer_unref (index_buffer); } return header_buffer; @@ -1975,9 +1981,7 @@ gst_dash_demux_get_next_fragment (GstDashDemux * demux) if (selected_stream->need_header) { /* We need to fetch a new header */ if ((header_buffer = - gst_dash_demux_get_next_header (demux, stream_idx)) == NULL) { - GST_WARNING_OBJECT (demux, "Unable to fetch header"); - } else { + gst_dash_demux_get_next_header (demux, stream_idx)) != NULL) { buffer = gst_buffer_append (header_buffer, buffer); } selected_stream->need_header = FALSE; diff --git a/ext/dash/gstmpdparser.c b/ext/dash/gstmpdparser.c index cedb4a2..e46e741 100644 --- a/ext/dash/gstmpdparser.c +++ b/ext/dash/gstmpdparser.c @@ -3437,9 +3437,11 @@ gst_mpd_client_get_next_header (GstMpdClient * client, gchar ** uri, && stream_period->period->SegmentTemplate->initialization) { initialization = stream_period->period->SegmentTemplate->initialization; } - *uri = gst_mpdparser_build_URL_from_template (initialization, - stream->cur_representation->id, 0, - stream->cur_representation->bandwidth, 0); + if (initialization) { + *uri = gst_mpdparser_build_URL_from_template (initialization, + stream->cur_representation->id, 0, + stream->cur_representation->bandwidth, 0); + } } GST_MPD_CLIENT_UNLOCK (client); -- 2.7.4