[pulseaudio-commits] Branch 'next' - 2 commits - src/pulsecore
Tanu Kaskinen
tanuk at kemper.freedesktop.org
Thu Jan 7 06:53:09 PST 2016
src/pulsecore/source-output.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
New commits:
commit fc6f8f68d0d9b81d9c1d36f915bf585eca6562c0
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Thu Jan 7 15:25:41 2016 +0200
source-output: remap volume_factor_source when starting move
This gets rid of an error message from the debug log. If
volume_factor_source would actually be used somewhere, this bug would
have caused more severe problems.
volume_factor_source should have the source's channel map. When moving
the stream, the volume needs to be remapped from the old source's
channel map to the new source's map. However, when the stream is being
moved, there is a period where the old source has already been
forgotten and the new source isn't yet known, so the remapping can't
be done directly between the two channel maps. Instead, the volume is
remapped from the old source's map to the stream's own map when the
move starts, and again remapped from the stream's map to the new
source's map when the move finishes.
The first remapping was missing, causing the second remapping fail and
print an error to the log.
(I checked the sink input code as well. It didn't have this bug.)
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 26a7123..5cf551f 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -1242,6 +1242,9 @@ int pa_source_output_start_move(pa_source_output *o) {
pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL) == 0);
pa_source_update_status(o->source);
+
+ pa_cvolume_remap(&o->volume_factor_source, &o->source->channel_map, &o->channel_map);
+
o->source = NULL;
pa_source_output_unref(o);
commit de36ca6e1e48411f22e203b4409cede524737640
Author: Tanu Kaskinen <tanuk at iki.fi>
Date: Thu Jan 7 15:25:40 2016 +0200
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.
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 9000972..26a7123 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);
More information about the pulseaudio-commits
mailing list