source/sink: Fix wrong calculation of thread_info.current_hw_volume
authorGeorg Chini <georg@chini.tk>
Sat, 29 Apr 2017 08:07:01 +0000 (10:07 +0200)
committerGeorg Chini <georg@chini.tk>
Sat, 29 Apr 2017 08:07:01 +0000 (10:07 +0200)
commitd985276c8b4c005171ea10d412e854bb956a092b
tree736e104360539f190ea26ad28631357780e75c31
parent2417305ae755cbb3a92ca43a058f550809069cd9
source/sink: Fix wrong calculation of thread_info.current_hw_volume

In pa_{source,sink}_new() and pa_{source,sink}_put() the current hardware
volume was miscalculated:

hw volume (dB) = real volume (dB) + soft volume (dB)
was used instead of
hw volume (dB) = real volume (dB) - soft volume (dB)

This lead to a crash in pa_alsa_path_set_volume() if high volumes were
set and the port was changed.

This patch fixes the calculation. Thanks to Tanu for pointing out
the correct solution.

link: https://bugs.freedesktop.org/show_bug.cgi?id=65520
src/pulsecore/sink.c
src/pulsecore/source.c