]> code.delx.au - pulseaudio/commitdiff
resampler: Fix peaks resampler's channel handling
authorTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Wed, 10 Jul 2013 18:48:40 +0000 (21:48 +0300)
committerTanu Kaskinen <tanu.kaskinen@linux.intel.com>
Mon, 29 Jul 2013 07:49:19 +0000 (10:49 +0300)
In the resampling phase the input and output data have the same number
of channels (o_ss.channels).

src/pulsecore/resampler.c

index cdfaf8fa8dcd120ba08076004055bb9f97bc9b9c..341d85b67a7e3bbb0d46e671f459076b8b680fb9 100644 (file)
@@ -1526,7 +1526,7 @@ static void peaks_resample(pa_resampler *r, const pa_memchunk *input, unsigned i
                 o_index++, r->peaks.o_counter++;
             }
         } else if (r->work_format == PA_SAMPLE_S16NE) {
-            int16_t *s = (int16_t*) src + r->i_ss.channels * i;
+            int16_t *s = (int16_t*) src + r->o_ss.channels * i;
             int16_t *d = (int16_t*) dst + r->o_ss.channels * o_index;
 
             for (; i < i_end && i < in_n_frames; i++)
@@ -1545,7 +1545,7 @@ static void peaks_resample(pa_resampler *r, const pa_memchunk *input, unsigned i
                 o_index++, r->peaks.o_counter++;
             }
         } else {
-            float *s = (float*) src + r->i_ss.channels * i;
+            float *s = (float*) src + r->o_ss.channels * i;
             float *d = (float*) dst + r->o_ss.channels * o_index;
 
             for (; i < i_end && i < in_n_frames; i++)