diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2016-01-07 15:25:40 +0200 |
---|---|---|
committer | Arun Raghavan <git@arunraghavan.net> | 2016-01-22 13:25:29 +0530 |
commit | b2e7cf65212a1abfbff282965e582f8fc56a964a (patch) | |
tree | 92cc0529252e5c4eb0f8db0d1c696e5dc0e29281 | |
parent | a958297fc878bee63a32ddc1b8af2b7c9f73a49e (diff) |
source-output: do volume_factor_source application before resampling
Applying the volume after resampling means mismatch between the volume
channel map and the data channel map.
volume_factor_source is not currently used anywhere, so this bug
hasn't been causing any problems. I noticed it while reading the code.
-rw-r--r-- | src/pulsecore/source-output.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index c73c5486..66a0341d 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -792,14 +792,14 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { pa_volume_memchunk(&qchunk, &o->source->sample_spec, &o->thread_info.soft_volume); } - if (!o->thread_info.resampler) { - if (nvfs) { - pa_memchunk_make_writable(&qchunk, 0); - pa_volume_memchunk(&qchunk, &o->thread_info.sample_spec, &o->volume_factor_source); - } + if (nvfs) { + pa_memchunk_make_writable(&qchunk, 0); + pa_volume_memchunk(&qchunk, &o->source->sample_spec, &o->volume_factor_source); + } + if (!o->thread_info.resampler) o->push(o, &qchunk); - } else { + else { pa_memchunk rchunk; if (mbs == 0) @@ -810,14 +810,8 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { pa_resampler_run(o->thread_info.resampler, &qchunk, &rchunk); - if (rchunk.length > 0) { - if (nvfs) { - pa_memchunk_make_writable(&rchunk, 0); - pa_volume_memchunk(&rchunk, &o->thread_info.sample_spec, &o->volume_factor_source); - } - + if (rchunk.length > 0) o->push(o, &rchunk); - } if (rchunk.memblock) pa_memblock_unref(rchunk.memblock); |