diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 73828f97ed..fa508834f0 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -1629,8 +1629,9 @@ next: goto out_flushing; } - /* Recompute the high time */ + /* Recompute the high time and ID */ compute_high_time (mq); + compute_high_id (mq); GST_DEBUG_OBJECT (mq, "queue %d woken from sleeping for not-linked " "wakeup with newid %u, highid %u, next_time %" GST_STIME_FORMAT @@ -1742,6 +1743,18 @@ 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)); + + /* 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)) { + compute_high_time (mq); + compute_high_id (mq); + wake_up_next_non_linked (mq); + } + GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); + if (dropping) goto next; @@ -1749,17 +1762,6 @@ next: && result != GST_FLOW_EOS) goto out_flushing; - GST_LOG_OBJECT (mq, "sq:%d AFTER PUSHING sq->srcresult: %s", sq->id, - gst_flow_get_name (sq->srcresult)); - - GST_MULTI_QUEUE_MUTEX_LOCK (mq); - if (mq->numwaiting > 0 && sq->srcresult == GST_FLOW_EOS) { - compute_high_time (mq); - compute_high_id (mq); - wake_up_next_non_linked (mq); - } - GST_MULTI_QUEUE_MUTEX_UNLOCK (mq); - return; out_flushing: @@ -1767,11 +1769,7 @@ out_flushing: if (object) gst_mini_object_unref (object); - /* Need to make sure wake up any sleeping pads when we exit */ GST_MULTI_QUEUE_MUTEX_LOCK (mq); - compute_high_time (mq); - compute_high_id (mq); - wake_up_next_non_linked (mq); sq->last_query = FALSE; g_cond_signal (&sq->query_handled); @@ -2327,10 +2325,10 @@ compute_high_id (GstMultiQueue * mq) if (sq->nextid < lowest) lowest = sq->nextid; - } else if (sq->srcresult != GST_FLOW_EOS) { + } else if (!GST_PAD_IS_EOS (sq->srcpad)) { /* 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 is at EOS (srcresult = EOS) */ + * unless the singlequeue output is at EOS */ if ((highid == G_MAXUINT32) || (sq->oldid > highid)) highid = sq->oldid; } @@ -2377,11 +2375,10 @@ compute_high_time (GstMultiQueue * mq) if (lowest == GST_CLOCK_STIME_NONE || sq->next_time < lowest) lowest = sq->next_time; - } else if (sq->srcresult != GST_FLOW_EOS) { + } else if (!GST_PAD_IS_EOS (sq->srcpad)) { /* 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 is at EOS (srcresult - * = EOS) */ + * the queue's one, unless the singlequeue output is at EOS. */ if (highest == GST_CLOCK_STIME_NONE || (sq->last_time != GST_CLOCK_STIME_NONE && sq->last_time > highest)) highest = sq->last_time;