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
This commit is contained in:
Jan Schmidt 2017-02-09 00:54:07 +11:00
parent 4a0bb14d9c
commit 69d2f80954

View file

@ -827,7 +827,7 @@ gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg)
switch (GST_MESSAGE_TYPE (msg)) { switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_ERROR:{ case GST_MESSAGE_ERROR:{
GList *iter; GList *iter;
GstAdaptiveDemuxStream *stream; GstAdaptiveDemuxStream *stream = NULL;
GError *err = NULL; GError *err = NULL;
gchar *debug = NULL; gchar *debug = NULL;
gchar *new_error = NULL; gchar *new_error = NULL;
@ -836,9 +836,29 @@ gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg)
GST_MANIFEST_LOCK (demux); GST_MANIFEST_LOCK (demux);
for (iter = demux->streams; iter; iter = g_list_next (iter)) { 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), if (gst_object_has_as_ancestor (GST_MESSAGE_SRC (msg),
GST_OBJECT_CAST (stream->src))) { 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 (msg, &err, &debug); gst_message_parse_error (msg, &err, &debug);
GST_WARNING_OBJECT (GST_ADAPTIVE_DEMUX_STREAM_PAD (stream), GST_WARNING_OBJECT (GST_ADAPTIVE_DEMUX_STREAM_PAD (stream),
@ -864,9 +884,6 @@ gst_adaptive_demux_handle_message (GstBin * bin, GstMessage * msg)
g_error_free (err); g_error_free (err);
g_free (debug); g_free (debug);
break;
}
}
GST_MANIFEST_UNLOCK (demux); GST_MANIFEST_UNLOCK (demux);