diff options
author | Mathieu Duponchelle <mathieu.duponchelle@opencreed.com> | 2014-03-25 17:11:34 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2014-04-12 14:02:10 +0100 |
commit | bfb4420cfc82c95bc16f168eb19e4d7b0c6981f1 (patch) | |
tree | 99471533a3dd3bd9045d18c03927763fb9a8a665 | |
parent | 569db02126ee1b3c4cf94b61e12bbfd0d8487d7b (diff) |
adder: rework the logic to check if eos has to be sent.
Checking the size available was incorrect, and the infos
for per-pad EOS are available.
Same logic as audiomixer.
fixes: https://bugzilla.gnome.org/show_bug.cgi?id=727025
-rw-r--r-- | gst/adder/gstadder.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index e0e7b7694d..bc619a5f09 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -1143,6 +1143,7 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data) gint64 next_timestamp; gint rate, bps, bpf; gboolean had_mute = FALSE; + gboolean is_eos = TRUE; adder = GST_ADDER (user_data); @@ -1221,9 +1222,6 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data) /* get available bytes for reading, this can be 0 which could mean empty * buffers or EOS, which we will catch when we loop over the pads. */ outsize = gst_collect_pads_available (pads); - /* can only happen when no pads to collect or all EOS */ - if (outsize == 0) - goto eos; GST_LOG_OBJECT (adder, "starting to cycle through channels, %d bytes available (bps = %d, bpf = %d)", @@ -1245,6 +1243,11 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data) /* get a buffer of size bytes, if we get a buffer, it is at least outsize * bytes big. */ inbuf = gst_collect_pads_take_buffer (pads, collect_data, outsize); + + if (!GST_COLLECT_PADS_STATE_IS_SET (collect_data, + GST_COLLECT_PADS_STATE_EOS)) + is_eos = FALSE; + /* NULL means EOS or an empty buffer so we still need to flush in * case of an empty buffer. */ if (inbuf == NULL) { @@ -1438,9 +1441,13 @@ gst_adder_collected (GstCollectPads * pads, gpointer user_data) } GST_OBJECT_UNLOCK (pad); } + if (outbuf) gst_buffer_unmap (outbuf, &outmap); + if (is_eos) + goto eos; + if (outbuf == NULL) { /* no output buffer, reuse one of the GAP buffers then if we have one */ if (gapbuf) { |