From: Fahad Arslan <Fahad_Arslan@xxxxxxxxxx> Signed-off-by: Fahad Arslan <Fahad_Arslan at mentor.com> --- src/pulsecore/resampler.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pulsecore/resampler.c b/src/pulsecore/resampler.c index f0c663f..34bdfc3 100644 --- a/src/pulsecore/resampler.c +++ b/src/pulsecore/resampler.c @@ -1435,7 +1435,7 @@ static int libsamplerate_init(pa_resampler *r) { static unsigned speex_resample_float(pa_resampler *r, const pa_memchunk *input, unsigned in_n_frames, pa_memchunk *output, unsigned *out_n_frames) { float *in, *out; - uint32_t inf = in_n_frames, outf = *out_n_frames; + uint32_t inf = in_n_frames, outf = *out_n_frames, i; SpeexResamplerState *state; pa_assert(r); @@ -1448,6 +1448,11 @@ static unsigned speex_resample_float(pa_resampler *r, const pa_memchunk *input, in = pa_memblock_acquire_chunk(input); out = pa_memblock_acquire_chunk(output); + /* Speex float API scale range is +/-32768 instead of +/-1. + So rescale input before passing it to Speex. */ + for (i = 0; i < inf; i++) + in[i] = 32768.*in[i]; + pa_assert_se(speex_resampler_process_interleaved_float(state, in, &inf, out, &outf) == 0); pa_memblock_release(input->memblock); -- 1.7.9.5