multiqueue: Fix behaviour with not-linked and eos pads

This is an update on c9b6848885
multiqueue: Fix not-linked pad handling at EOS

While that commit did fix the behaviour if upstream sent a GST_EVENT_EOS,
it would break the same issue when *downstream* returns GST_FLOW_EOS
(which can happen for example when downstream decoders receive data
from after the segment stop).

GST_PAD_IS_EOS() is only TRUE when a GST_EVENT_EOS has flown through it
and not when a GST_EVENT_EOS has gone through it.

In order to handle both cases, also take into account the last flow
return.

https://bugzilla.gnome.org/show_bug.cgi?id=763770
This commit is contained in:
Edward Hervey 2016-07-01 09:44:12 +02:00 committed by Edward Hervey
parent 046551105b
commit 17ab616653

View file

@ -1766,12 +1766,13 @@ next:
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
gst_multi_queue_post_buffering (mq); gst_multi_queue_post_buffering (mq);
GST_LOG_OBJECT (mq, "sq:%d AFTER PUSHING sq->srcresult: %s", sq->id, GST_LOG_OBJECT (mq, "sq:%d AFTER PUSHING sq->srcresult: %s (is_eos:%d)",
gst_flow_get_name (sq->srcresult)); sq->id, gst_flow_get_name (sq->srcresult), GST_PAD_IS_EOS (sq->srcpad));
/* Need to make sure wake up any sleeping pads when we exit */ /* Need to make sure wake up any sleeping pads when we exit */
GST_MULTI_QUEUE_MUTEX_LOCK (mq); GST_MULTI_QUEUE_MUTEX_LOCK (mq);
if (mq->numwaiting > 0 && GST_PAD_IS_EOS (sq->srcpad)) { if (mq->numwaiting > 0 && (GST_PAD_IS_EOS (sq->srcpad)
|| sq->srcresult == GST_FLOW_EOS)) {
compute_high_time (mq); compute_high_time (mq);
compute_high_id (mq); compute_high_id (mq);
wake_up_next_non_linked (mq); wake_up_next_non_linked (mq);
@ -2348,7 +2349,7 @@ compute_high_id (GstMultiQueue * mq)
if (sq->nextid < lowest) if (sq->nextid < lowest)
lowest = sq->nextid; lowest = sq->nextid;
} else if (!GST_PAD_IS_EOS (sq->srcpad)) { } else if (!GST_PAD_IS_EOS (sq->srcpad) && sq->srcresult != GST_FLOW_EOS) {
/* If we don't have a global highid, or the global highid is lower than /* If we don't have a global highid, or the global highid is lower than
* this single queue's last outputted id, store the queue's one, * this single queue's last outputted id, store the queue's one,
* unless the singlequeue output is at EOS */ * unless the singlequeue output is at EOS */
@ -2398,7 +2399,7 @@ compute_high_time (GstMultiQueue * mq)
if (lowest == GST_CLOCK_STIME_NONE || sq->next_time < lowest) if (lowest == GST_CLOCK_STIME_NONE || sq->next_time < lowest)
lowest = sq->next_time; lowest = sq->next_time;
} else if (!GST_PAD_IS_EOS (sq->srcpad)) { } else if (!GST_PAD_IS_EOS (sq->srcpad) && sq->srcresult != GST_FLOW_EOS) {
/* If we don't have a global high time, or the global high time /* If we don't have a global high time, or the global high time
* is lower than this single queue's last outputted time, store * is lower than this single queue's last outputted time, store
* the queue's one, unless the singlequeue output is at EOS. */ * the queue's one, unless the singlequeue output is at EOS. */