audio-converter: In passthrough, also don't copy if in and out block are the same
authorSebastian Dröge <sebastian@centricular.com>
Wed, 30 Nov 2016 08:43:50 +0000 (10:43 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 30 Nov 2016 08:43:50 +0000 (10:43 +0200)
In and out array are usually different, they are stack allocated arrays.
However the blocks inside them still can be the same.

https://bugzilla.gnome.org/show_bug.cgi?id=775369

gst-libs/gst/audio/audio-converter.c

index 2d6ad72..e4394c2 100644 (file)
@@ -851,8 +851,14 @@ converter_passthrough (GstAudioConverter * convert,
 
     bytes = samples * (convert->in.bpf / convert->in.channels);
 
-    for (i = 0; i < chain->blocks; i++)
+    for (i = 0; i < chain->blocks; i++) {
+      if (out[i] == in[i]) {
+        g_assert (convert->in_place);
+        continue;
+      }
+
       memcpy (out[i], in[i], bytes);
+    }
   } else {
     for (i = 0; i < chain->blocks; i++)
       gst_audio_format_fill_silence (convert->in.finfo, out[i], samples);