bluetooth: Only use hardware volume callbacks for peer attenuation (hsp/hfp)

Merged Marijn Suijten requested to merge MarijnS95/pulseaudio:hsp-hfp-volume into master

Excerpt from !239 (merged), idea described in !239 (comment 824073).

When PulseAudio is a HSP/HFP headset, it has to notify the peer about volume changes. This MR changes the code so that the notifications don't also enable the "hw volume" flag, which is incorrect/confusing when it's PulseAudio that does the attenuation in software.

Setting these callbacks adds the HW_{VOLUME,MUTE}_CTRL flag even when PulseAudio is solely responsible for performing attenuation whilst only keeping the peer posted on changes. For this case the hardware callback is not registered at all but changes are simply read from MESSAGE_SET_SHARED_VOLUME. Only when the peer performs attenuation (the peer is in HeadSet/HandsFree role) are the callbacks used, without touching PA software volume at all.

Note that I cannot get microphone commands (+VGM) to work on WH-1000XM3 headphones nor QCY-CS2 in-ears. Received microphone audio does not change in volume. Is PA correct that, when PA is the AG and the peer (headphones) the HS/HF, attenuation for both input and output happen on the peer?
With A2DP Abolute Volume - while that is not bidirectional so likely different rules - the "receiving" device performs attenuation.

@igor.v.kovalenko any ideas?

Perhaps this MR is the right place to introduce/land software volume compensation for the extremely coarse 16 steps of volume, akin to !239 (2c675ddf)?

Edited by Marijn Suijten

Merge request reports