diff options
author | Jan Schmidt <jan@centricular.com> | 2017-02-09 00:54:07 +1100 |
---|---|---|
committer | Jan Schmidt <jan@centricular.com> | 2017-02-09 10:50:22 +1100 |
commit | 69d2f80954bf3b1432b22cb9bd982dd090c6b7c2 (patch) | |
tree | dffa68cc073b05f7b71f6177c5fdb47cdc8d6c1b /gst-libs | |
parent | 4a0bb14d9c502120492c1cf107ca46f38c774f9b (diff) | |
download | gstreamer-plugins-bad-69d2f80954bf3b1432b22cb9bd982dd090c6b7c2.tar.gz |
adaptivedemux: Handle errors from prepared_streams too
Check both active and prepared_streams when we receive an
error on the bus, so we post errors for streams that are
still pre-rolling
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/adaptivedemux/gstadaptivedemux.c | 69 |
1 files changed, 43 insertions, 26 deletions
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c index 5c94ede5b..a63be65f0 100644 --- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c +++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c @@ -827,7 +827,7 @@ gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg) switch (GST_MESSAGE_TYPE (msg)) { case GST_MESSAGE_ERROR:{ GList *iter; - GstAdaptiveDemuxStream *stream; + GstAdaptiveDemuxStream *stream = NULL; GError *err = NULL; gchar *debug = NULL; gchar *new_error = NULL; @@ -836,38 +836,55 @@ gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg) GST_MANIFEST_LOCK (demux); for (iter = demux->streams; iter; iter = g_list_next (iter)) { - stream = iter->data; + GstAdaptiveDemuxStream *cur = iter->data; if (gst_object_has_as_ancestor (GST_MESSAGE_SRC (msg), - GST_OBJECT_CAST (stream->src))) { - gst_message_parse_error (msg, &err, &debug); - - GST_WARNING_OBJECT (GST_ADAPTIVE_DEMUX_STREAM_PAD (stream), - "Source posted error: %d:%d %s (%s)", err->domain, err->code, - err->message, debug); - - if (debug) - new_error = g_strdup_printf ("%s: %s\n", err->message, debug); - if (new_error) { - g_free (err->message); - err->message = new_error; + GST_OBJECT_CAST (cur->src))) { + stream = cur; + break; + } + } + if (stream == NULL) { + for (iter = demux->prepared_streams; iter; iter = g_list_next (iter)) { + GstAdaptiveDemuxStream *cur = iter->data; + if (gst_object_has_as_ancestor (GST_MESSAGE_SRC (msg), + GST_OBJECT_CAST (cur->src))) { + stream = cur; + break; } + } + if (stream == NULL) { + GST_WARNING_OBJECT (demux, + "Failed to locate stream for errored element"); + break; + } + } - gst_message_parse_error_details (msg, &details); - if (details) { - gst_structure_get_uint (details, "http-status-code", - &stream->last_status_code); - } + gst_message_parse_error (msg, &err, &debug); - /* error, but ask to retry */ - gst_adaptive_demux_stream_fragment_download_finish (stream, - GST_FLOW_CUSTOM_ERROR, err); + GST_WARNING_OBJECT (GST_ADAPTIVE_DEMUX_STREAM_PAD (stream), + "Source posted error: %d:%d %s (%s)", err->domain, err->code, + err->message, debug); - g_error_free (err); - g_free (debug); - break; - } + if (debug) + new_error = g_strdup_printf ("%s: %s\n", err->message, debug); + if (new_error) { + g_free (err->message); + err->message = new_error; + } + + gst_message_parse_error_details (msg, &details); + if (details) { + gst_structure_get_uint (details, "http-status-code", + &stream->last_status_code); } + /* error, but ask to retry */ + gst_adaptive_demux_stream_fragment_download_finish (stream, + GST_FLOW_CUSTOM_ERROR, err); + + g_error_free (err); + g_free (debug); + GST_MANIFEST_UNLOCK (demux); gst_message_unref (msg); |