audiomixer: Only ignore pads with no buffers on timeout

When the timeout is reached, only ignore pads with no buffers, iterate
over the other pads until all buffers have been read. This is important
in the cases where the input buffers are smaller than the output buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=745768
This commit is contained in:
Olivier Crête 2015-03-06 20:22:13 -05:00
parent 3f59bc95b8
commit 3b2bc85ec6

View file

@ -1436,8 +1436,20 @@ gst_audiomixer_aggregate (GstAggregator * agg, gboolean timeout)
is_eos = FALSE;
inbuf = gst_aggregator_pad_get_buffer (aggpad);
if (!inbuf)
if (!inbuf) {
if (timeout) {
if (pad->output_offset < next_offset) {
gint64 diff = next_offset - pad->output_offset;
GST_LOG_OBJECT (pad, "Timeout, missing %" G_GINT64_FORMAT " frames (%"
GST_TIME_FORMAT ")", diff,
GST_TIME_ARGS (gst_util_uint64_scale (diff, GST_SECOND, rate)));
}
} else if (!gst_aggregator_pad_is_eos (aggpad)) {
is_done = FALSE;
}
continue;
}
g_assert (!pad->buffer || pad->buffer == inbuf);
@ -1497,14 +1509,14 @@ gst_audiomixer_aggregate (GstAggregator * agg, gboolean timeout)
gst_buffer_unmap (outbuf, &outmap);
if (dropped && !timeout) {
if (dropped) {
/* We dropped a buffer, retry */
GST_INFO_OBJECT (audiomixer,
"A pad dropped a buffer, wait for the next one");
return GST_FLOW_OK;
}
if (!is_done && !is_eos && !timeout) {
if (!is_done && !is_eos) {
/* Get more buffers */
GST_INFO_OBJECT (audiomixer,
"We're not done yet for the current offset, waiting for more data");