mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-16 08:56:45 -05:00
bluez5: enable A2DP duplex volume boost only if codec asks for it
Make A2DP volume boost conditional on a flag the codec sets. Bump codec API version.
This commit is contained in:
parent
92b2b44954
commit
d29aafd857
4 changed files with 19 additions and 3 deletions
|
|
@ -710,6 +710,11 @@ static const struct a2dp_codec aptx_ll_msbc = {
|
||||||
.increase_bitpool = msbc_increase_bitpool,
|
.increase_bitpool = msbc_increase_bitpool,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct spa_dict_item duplex_info_items[] = {
|
||||||
|
{ "duplex.boost", "true" },
|
||||||
|
};
|
||||||
|
static const struct spa_dict duplex_info = SPA_DICT_INIT_ARRAY(duplex_info_items);
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aptx_ll_duplex_0 = {
|
const struct a2dp_codec a2dp_codec_aptx_ll_duplex_0 = {
|
||||||
APTX_LL_COMMON_DEFS,
|
APTX_LL_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_APTX_LL_DUPLEX,
|
||||||
|
|
@ -718,6 +723,7 @@ const struct a2dp_codec a2dp_codec_aptx_ll_duplex_0 = {
|
||||||
.name = "aptx_ll_duplex",
|
.name = "aptx_ll_duplex",
|
||||||
.endpoint_name = "aptx_ll_duplex_0",
|
.endpoint_name = "aptx_ll_duplex_0",
|
||||||
.duplex_codec = &aptx_ll_msbc,
|
.duplex_codec = &aptx_ll_msbc,
|
||||||
|
.info = &duplex_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_aptx_ll_duplex_1 = {
|
const struct a2dp_codec a2dp_codec_aptx_ll_duplex_1 = {
|
||||||
|
|
@ -728,6 +734,7 @@ const struct a2dp_codec a2dp_codec_aptx_ll_duplex_1 = {
|
||||||
.name = "aptx_ll_duplex",
|
.name = "aptx_ll_duplex",
|
||||||
.endpoint_name = "aptx_ll_duplex_1",
|
.endpoint_name = "aptx_ll_duplex_1",
|
||||||
.duplex_codec = &aptx_ll_msbc,
|
.duplex_codec = &aptx_ll_msbc,
|
||||||
|
.info = &duplex_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
A2DP_CODEC_EXPORT_DEF(
|
||||||
|
|
|
||||||
|
|
@ -614,17 +614,23 @@ static const struct a2dp_codec duplex_codec = {
|
||||||
.reduce_bitpool = codec_reduce_bitpool, \
|
.reduce_bitpool = codec_reduce_bitpool, \
|
||||||
.increase_bitpool = codec_increase_bitpool
|
.increase_bitpool = codec_increase_bitpool
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_faststream = {
|
static const struct a2dp_codec a2dp_codec_faststream = {
|
||||||
FASTSTREAM_COMMON_DEFS,
|
FASTSTREAM_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM,
|
||||||
.name = "faststream",
|
.name = "faststream",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static const struct spa_dict_item duplex_info_items[] = {
|
||||||
|
{ "duplex.boost", "true" },
|
||||||
|
};
|
||||||
|
static const struct spa_dict duplex_info = SPA_DICT_INIT_ARRAY(duplex_info_items);
|
||||||
|
|
||||||
const struct a2dp_codec a2dp_codec_faststream_duplex = {
|
const struct a2dp_codec a2dp_codec_faststream_duplex = {
|
||||||
FASTSTREAM_COMMON_DEFS,
|
FASTSTREAM_COMMON_DEFS,
|
||||||
.id = SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM_DUPLEX,
|
.id = SPA_BLUETOOTH_AUDIO_CODEC_FASTSTREAM_DUPLEX,
|
||||||
.name = "faststream_duplex",
|
.name = "faststream_duplex",
|
||||||
.duplex_codec = &duplex_codec,
|
.duplex_codec = &duplex_codec,
|
||||||
|
.info = &duplex_info,
|
||||||
};
|
};
|
||||||
|
|
||||||
A2DP_CODEC_EXPORT_DEF(
|
A2DP_CODEC_EXPORT_DEF(
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
|
|
||||||
#define SPA_TYPE_INTERFACE_Bluez5CodecA2DP SPA_TYPE_INFO_INTERFACE_BASE "Bluez5:Codec:A2DP:Private"
|
#define SPA_TYPE_INTERFACE_Bluez5CodecA2DP SPA_TYPE_INFO_INTERFACE_BASE "Bluez5:Codec:A2DP:Private"
|
||||||
|
|
||||||
#define SPA_VERSION_BLUEZ5_CODEC_A2DP 3
|
#define SPA_VERSION_BLUEZ5_CODEC_A2DP 4
|
||||||
|
|
||||||
struct spa_bluez5_codec_a2dp {
|
struct spa_bluez5_codec_a2dp {
|
||||||
struct spa_interface iface;
|
struct spa_interface iface;
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,8 @@ static void emit_info(struct impl *this, bool full);
|
||||||
|
|
||||||
static float get_soft_volume_boost(struct node *node)
|
static float get_soft_volume_boost(struct node *node)
|
||||||
{
|
{
|
||||||
|
const struct a2dp_codec *codec = node->transport ? node->transport->a2dp_codec : NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For A2DP duplex, the duplex microphone channel sometimes does not appear
|
* For A2DP duplex, the duplex microphone channel sometimes does not appear
|
||||||
* to have hardware gain, and input volume is very low.
|
* to have hardware gain, and input volume is very low.
|
||||||
|
|
@ -310,7 +312,8 @@ static float get_soft_volume_boost(struct node *node)
|
||||||
* If this causes clipping, the user can just reduce the mic volume to
|
* If this causes clipping, the user can just reduce the mic volume to
|
||||||
* bring SW gain below 1.
|
* bring SW gain below 1.
|
||||||
*/
|
*/
|
||||||
if (node->a2dp_duplex && node->transport &&
|
if (node->a2dp_duplex && node->transport && codec && codec->info &&
|
||||||
|
spa_atob(spa_dict_lookup(codec->info, "duplex.boost")) &&
|
||||||
node->id == DEVICE_ID_SOURCE &&
|
node->id == DEVICE_ID_SOURCE &&
|
||||||
!node->transport->volumes[SPA_BT_VOLUME_ID_RX].active)
|
!node->transport->volumes[SPA_BT_VOLUME_ID_RX].active)
|
||||||
return 10.0f; /* 20 dB boost */
|
return 10.0f; /* 20 dB boost */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue