From 530001661ddba6a0b1a7a07c9805688d83a05622 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Fri, 1 Jul 2016 09:44:12 +0200 Subject: [PATCH] multiqueue: Fix behaviour with not-linked and eos pads This is an update on c9b6848885f4675d447e823c8fb117e247658252 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 --- plugins/elements/gstmultiqueue.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 246ffbebef..1742131d9b 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -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. */