bluez5: boost A2DP duplex microphone volume by 20 dB

There doesn't seem to be a way to control the A2DP duplex microphone
HW volume gain, and devices sometimes have very low mic volumes.

Work around this by boosting the software volume scale by +20 dB.  If it
causes clipping, the user can just reduce the volume to bring SW gain
below 1.0.
This commit is contained in:
Pauli Virtanen 2021-08-21 18:37:44 +03:00 committed by Wim Taymans
parent e08cdf27d5
commit ab5fcf4a66
3 changed files with 102 additions and 14 deletions

View file

@ -409,6 +409,21 @@ static int duplex_enum_config(const struct a2dp_codec *codec,
return *param == NULL ? -EIO : 1;
}
static int duplex_validate_config(const struct a2dp_codec *codec, uint32_t flags,
const void *caps, size_t caps_size,
struct spa_audio_info *info)
{
spa_zero(*info);
info->media_type = SPA_MEDIA_TYPE_audio;
info->media_subtype = SPA_MEDIA_SUBTYPE_raw;
info->info.raw.format = SPA_AUDIO_FORMAT_S16_LE;
info->info.raw.channels = 2;
info->info.raw.position[0] = SPA_AUDIO_CHANNEL_FL;
info->info.raw.position[1] = SPA_AUDIO_CHANNEL_FR;
info->info.raw.rate = 16000;
return 0;
}
static int duplex_reduce_bitpool(void *data)
{
return -ENOTSUP;
@ -567,6 +582,7 @@ static const struct a2dp_codec duplex_codec = {
.fill_caps = codec_fill_caps,
.select_config = codec_select_config,
.enum_config = duplex_enum_config,
.validate_config = duplex_validate_config,
.init = duplex_init,
.deinit = duplex_deinit,
.get_block_size = duplex_get_block_size,