multiqueue: Post errors ourselves if they are received after EOS

After EOS there will be no further buffer which could propagate the
error upstream, so nothing is going to post an error message and
the pipeline just idles around.
This commit is contained in:
Sebastian Dröge 2014-08-13 12:10:39 +03:00
parent d3e411bda4
commit afcc93254b

View file

@ -1465,7 +1465,19 @@ out_flushing:
wake_up_next_non_linked (mq); wake_up_next_non_linked (mq);
sq->last_query = FALSE; sq->last_query = FALSE;
g_cond_signal (&sq->query_handled); g_cond_signal (&sq->query_handled);
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
/* Post an error message if we got EOS while downstream
* has returned an error flow return. After EOS there
* will be no further buffer which could propagate the
* error upstream */
if (sq->is_eos) {
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
GST_ELEMENT_ERROR (mq, STREAM, FAILED,
("Internal data stream error."),
("streaming stopped, reason %s", gst_flow_get_name (sq->srcresult)));
} else {
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
}
/* upstream needs to see fatal result ASAP to shut things down, /* upstream needs to see fatal result ASAP to shut things down,
* but might be stuck in one of our other full queues; * but might be stuck in one of our other full queues;
@ -1665,12 +1677,26 @@ gst_multi_queue_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
goto flushing; goto flushing;
/* mark EOS when we received one, we must do that after putting the /* mark EOS when we received one, we must do that after putting the
* buffer in the queue because EOS marks the buffer as filled. No need to take * buffer in the queue because EOS marks the buffer as filled. */
* a lock, the _check_full happens from this thread only, right before pushing
* into dataqueue. */
switch (type) { switch (type) {
case GST_EVENT_EOS: case GST_EVENT_EOS:
GST_MULTI_QUEUE_MUTEX_LOCK (mq);
sq->is_eos = TRUE; sq->is_eos = TRUE;
/* Post an error message if we got EOS while downstream
* has returned an error flow return. After EOS there
* will be no further buffer which could propagate the
* error upstream */
if (sq->srcresult < GST_FLOW_EOS) {
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
GST_ELEMENT_ERROR (mq, STREAM, FAILED,
("Internal data stream error."),
("streaming stopped, reason %s",
gst_flow_get_name (sq->srcresult)));
} else {
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
}
/* EOS affects the buffering state */ /* EOS affects the buffering state */
update_buffering (mq, sq); update_buffering (mq, sq);
single_queue_overrun_cb (sq->queue, sq); single_queue_overrun_cb (sq->queue, sq);