From 24ba7af5fa7fd4fec0b6a8b96e7fe05614b32f6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 7 Nov 2013 14:12:00 +0100 Subject: [PATCH] audiomixer: Fix EOS handling if we have some pending data --- gst/audiomixer/gstaudiomixer.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gst/audiomixer/gstaudiomixer.c b/gst/audiomixer/gstaudiomixer.c index 09da1675c5..28f8e513d0 100644 --- a/gst/audiomixer/gstaudiomixer.c +++ b/gst/audiomixer/gstaudiomixer.c @@ -1614,7 +1614,6 @@ gst_audiomixer_collected (GstCollectPads * pads, gpointer user_data) gboolean dropped = FALSE; gboolean is_eos = TRUE; gboolean is_done = TRUE; - gboolean handled_buffer = FALSE; audiomixer = GST_AUDIO_MIXER (user_data); @@ -1788,7 +1787,6 @@ gst_audiomixer_collected (GstCollectPads * pads, gpointer user_data) } else { is_done = FALSE; } - handled_buffer = TRUE; } } @@ -1810,14 +1808,10 @@ gst_audiomixer_collected (GstCollectPads * pads, gpointer user_data) if (is_eos) { gint64 max_offset = 0; + gboolean empty_buffer = TRUE; GST_DEBUG_OBJECT (audiomixer, "We're EOS"); - /* This means EOS or no pads at all */ - if (!handled_buffer) { - gst_buffer_replace (&audiomixer->current_buffer, NULL); - goto eos; - } for (collected = pads->data; collected; collected = collected->next) { GstCollectData *collect_data; @@ -1827,6 +1821,14 @@ gst_audiomixer_collected (GstCollectPads * pads, gpointer user_data) adata = (GstAudioMixerCollect *) collect_data; max_offset = MAX (max_offset, adata->output_offset); + if (adata->output_offset > audiomixer->offset) + empty_buffer = FALSE; + } + + /* This means EOS or no pads at all */ + if (empty_buffer) { + gst_buffer_replace (&audiomixer->current_buffer, NULL); + goto eos; } if (max_offset <= next_offset) {