audioaggregator: pass blocksize to mix_buffer()
authorStefan Sauer <ensonic@users.sf.net>
Thu, 5 Oct 2017 06:11:29 +0000 (08:11 +0200)
committerStefan Sauer <ensonic@users.sf.net>
Thu, 5 Oct 2017 06:57:09 +0000 (08:57 +0200)
No need to recalc the value twice per run. Establishes that it is the same
value.

gst-libs/gst/audio/gstaudioaggregator.c

index 202474b..c7f7583 100644 (file)
@@ -973,19 +973,15 @@ done:
 
 static gboolean
 gst_audio_aggregator_mix_buffer (GstAudioAggregator * aagg,
-    GstAudioAggregatorPad * pad, GstBuffer * inbuf, GstBuffer * outbuf)
+    GstAudioAggregatorPad * pad, GstBuffer * inbuf, GstBuffer * outbuf,
+    guint blocksize)
 {
   guint overlap;
   guint out_start;
   gboolean filled;
-  guint blocksize;
   guint in_offset;
   gboolean pad_changed = FALSE;
 
-  blocksize = gst_util_uint64_scale (aagg->priv->output_buffer_duration,
-      GST_AUDIO_INFO_RATE (&aagg->info), GST_SECOND);
-  blocksize = MAX (1, blocksize);
-
   /* Overlap => mix */
   if (aagg->priv->offset < pad->priv->output_offset)
     out_start = pad->priv->output_offset - aagg->priv->offset;
@@ -1295,7 +1291,7 @@ gst_audio_aggregator_aggregate (GstAggregator * agg, gboolean timeout)
 
       GST_LOG_OBJECT (aggpad, "Mixing buffer for current offset");
       drop_buf = !gst_audio_aggregator_mix_buffer (aagg, pad, pad->priv->buffer,
-          outbuf);
+          outbuf, blocksize);
       if (pad->priv->output_offset >= next_offset) {
         GST_LOG_OBJECT (pad,
             "Pad is at or after current offset: %" G_GUINT64_FORMAT " >= %"