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 3623f168e9
commit 530001661d

View file

@ -1884,12 +1884,13 @@ next:
GST_MULTI_QUEUE_MUTEX_UNLOCK (mq);
gst_multi_queue_post_buffering (mq);
GST_LOG_OBJECT (mq, "sq:%d AFTER PUSHING sq->srcresult: %s", sq->id,
gst_flow_get_name (sq->srcresult));
GST_LOG_OBJECT (mq, "sq:%d AFTER PUSHING sq->srcresult: %s (is_eos:%d)",
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 */
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, sq->groupid);
compute_high_id (mq);
wake_up_next_non_linked (mq);
@ -2468,7 +2469,7 @@ compute_high_id (GstMultiQueue * mq)
if (sq->nextid < lowest)
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
* this single queue's last outputted id, store the queue's one,
* unless the singlequeue output is at EOS */
@ -2528,7 +2529,7 @@ compute_high_time (GstMultiQueue * mq, guint groupid)
if (sq->groupid == groupid && (group_low == GST_CLOCK_STIME_NONE
|| sq->next_time < group_low))
group_low = 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
* is lower than this single queue's last outputted time, store
* the queue's one, unless the singlequeue output is at EOS. */