multiqueue: Fix not-linked pad handling at EOS

Ensure that not-linked pads will drain out at EOS by
correctly detecting the EOS condition based on the EOS
pad flag (which indicates we actually pushed an EOS),
and make sure that not-linked pads are woken when doing
EOS processing on linked pads.

https://bugzilla.gnome.org/show_bug.cgi?id=763770
This commit is contained in:
Jan Schmidt 2016-03-18 03:08:39 +11:00
parent 20859af3f2
commit c9b6848885

View file

@ -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;