[pulseaudio-discuss] pactl percentage bug fix

Patrick May dusthillresident at gmail.com
Fri Jun 3 17:19:20 UTC 2022


Here is the problem:

https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/blob/master/src/utils/pactl.c

In src/utils/pactl.c:

Between line 2530 and line 2535, in function parse_volume:

These two 'if' statements will BOTH execute if the input string contains 
both a '.' and ends with a '%'.

This results in vol_flags having VOL_PERCENT and VOL_LINEAR or'd in and 
set, which is equivalent in effect to '*vol_flags |= VOL_DECIBEL'
(because VOL_PERCENT is 1 and VOL_LINEAR is 2, and VOL_DECIBEL is 3. 
Refer to line 76)
So from then on the function is erroneously acting as if the input 
string was a decibel value, instead of a percentage.

Suggested fix:
Change line 2532 from this
     if (pa_endswith(vs, "%")) {
To this:
     else if (pa_endswith(vs, "%")) {

I apologise for my rudeness earlier but this was not the first time 
pulseaudio bugs have BLASTED EXTREMELY LOUD NOISE AT 100% THROUGH MY 
HEADPHONES and I was very upset.

I don't have a git account or any of the stuff necessary to actually 
submit a patch so I would appreciate if someone or pulseaudio dev would 
take note of this and make the necessary change


More information about the pulseaudio-discuss mailing list