audioconvert: never do mixing for 1->1 channel conversions
authorTim-Philipp Müller <tim@centricular.com>
Tue, 18 Feb 2014 10:42:04 +0000 (10:42 +0000)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 18 Feb 2014 10:48:07 +0000 (10:48 +0000)
MONO and NONE position are the same, for example, but in
general there isn't much to do here for such a conversion.

Fixes problem in audioconvert, which would end up using
a mixmatrix when converting between different mono format
because it thinks MONO positioning is different from
unpositioned channels, which is not the case in this
special case. The mixmatrix would end up being 0.0 so
audioconvert would convert to silence samples.

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

gst/audioconvert/gstchannelmix.c

index 06db4ea..f5f5e0d 100644 (file)
@@ -654,6 +654,10 @@ gst_channel_mix_passthrough (AudioConvertCtx * this)
   if (this->in.channels != this->out.channels)
     return FALSE;
 
+  /* passthrough for 1->1 channels (MONO and NONE position are the same here) */
+  if (this->in.channels == 1 && this->out.channels == 1)
+    return TRUE;
+
   /* passthrough if both channel masks are the same */
   in_mask = out_mask = 0;
   for (i = 0; i < this->in.channels; i++) {