diff options
author | Benjamin Otte <otte@gnome.org> | 2004-11-28 18:26:36 +0000 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2004-11-28 18:26:36 +0000 |
commit | 110fd90222bf24a0aaba357c4456c2366ff02553 (patch) | |
tree | bf2a234b05d57b9c1933f2f702ef54ce181b88d0 | |
parent | 4fdf8d5b16ce629a39d49f3efd1807a80cea3e98 (diff) | |
download | gstreamer-plugins-base-110fd90222bf24a0aaba357c4456c2366ff02553.tar.gz |
gst/audioconvert/gstchannelmix.c: walk the samples backwards if out_channels > in_channels so we don't overwrite data
Original commit message from CVS:
* gst/audioconvert/gstchannelmix.c: (gst_audio_convert_mix):
walk the samples backwards if out_channels > in_channels so we don't
overwrite data
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | gst/audioconvert/gstchannelmix.c | 8 |
2 files changed, 12 insertions, 2 deletions
@@ -1,3 +1,9 @@ +2004-11-28 Benjamin Otte <otte@gnome.org> + + * gst/audioconvert/gstchannelmix.c: (gst_audio_convert_mix): + walk the samples backwards if out_channels > in_channels so we don't + overwrite data + 2004-11-28 Ronald S. Bultje <rbultje@ronald.bitfreak.net> * gst/audioconvert/Makefile.am: diff --git a/gst/audioconvert/gstchannelmix.c b/gst/audioconvert/gstchannelmix.c index 7d51127c1..705cfad58 100644 --- a/gst/audioconvert/gstchannelmix.c +++ b/gst/audioconvert/gstchannelmix.c @@ -524,16 +524,20 @@ gst_audio_convert_passthrough (GstAudioConvert * this) return TRUE; } +/* IMPORTANT: out_data == in_data is possible, make sure to not overwrite data + * you might need later on! */ void gst_audio_convert_mix (GstAudioConvert * this, gint32 * in_data, gint32 * out_data, gint samples) { gint in, out, n; gint64 res; + gboolean backwards = this->srccaps.channels > this->sinkcaps.channels; /* FIXME: use liboil here? */ - for (out = 0; out < this->srccaps.channels; out++) { - for (n = 0; n < samples; n++) { + for (n = (backwards ? samples - 1 : 0); n < samples && n >= 0; + backwards ? n-- : n++) { + for (out = 0; out < this->srccaps.channels; out++) { /* convert */ res = 0; for (in = 0; in < this->sinkcaps.channels; in++) { |