diff options
author | Igor V. Kovalenko <igor.v.kovalenko@gmail.com> | 2021-09-06 01:34:21 +0300 |
---|---|---|
committer | Igor V. Kovalenko <igor.v.kovalenko@gmail.com> | 2022-10-17 09:07:09 +0300 |
commit | 0498e7a3d05c8ccd4f0389778e04f964f8a0b2f8 (patch) | |
tree | c5f1f1d1a6d739143bd1f0e0b9ee9297a077873b | |
parent | 48f40352a684d34cf0f95ec75431d309aeadc27c (diff) | |
download | pulseaudio-0498e7a3d05c8ccd4f0389778e04f964f8a0b2f8.tar.gz |
bluetooth: Do not use hardware volume control for A2DP backchannel
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/628>
-rw-r--r-- | src/modules/bluetooth/module-bluez5-device.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/modules/bluetooth/module-bluez5-device.c b/src/modules/bluetooth/module-bluez5-device.c index 9c40a60ff..bac8ca4b2 100644 --- a/src/modules/bluetooth/module-bluez5-device.c +++ b/src/modules/bluetooth/module-bluez5-device.c @@ -964,6 +964,12 @@ static void source_setup_volume_callback(pa_source *s) { if (pa_bluetooth_profile_is_a2dp(u->profile) && !u->transport->device->avrcp_absolute_volume) return; + /* Do not use hardware volume controls for backchannel of A2DP sink */ + if (u->profile == PA_BLUETOOTH_PROFILE_A2DP_SINK) { + pa_assert_fp(u->transport->bt_codec && u->transport->bt_codec->support_backchannel); + return; + } + /* Remote volume control has to be supported for the callback to make sense, * otherwise this source should continue performing attenuation in software * without HW_VOLUME_CTL. @@ -1032,6 +1038,12 @@ static int add_source(struct userdata *u) { if (!u->transport_acquired) switch (u->profile) { + case PA_BLUETOOTH_PROFILE_A2DP_SINK: + if (u->bt_codec && u->bt_codec->support_backchannel) + data.suspend_cause = PA_SUSPEND_USER; + else + pa_assert_not_reached(); + break; case PA_BLUETOOTH_PROFILE_A2DP_SOURCE: case PA_BLUETOOTH_PROFILE_HFP_AG: case PA_BLUETOOTH_PROFILE_HSP_AG: @@ -1046,7 +1058,6 @@ static int add_source(struct userdata *u) { else pa_assert_not_reached(); break; - case PA_BLUETOOTH_PROFILE_A2DP_SINK: case PA_BLUETOOTH_PROFILE_OFF: pa_assert_not_reached(); break; @@ -1201,6 +1212,12 @@ static void sink_setup_volume_callback(pa_sink *s) { if (pa_bluetooth_profile_is_a2dp(u->profile) && !u->transport->device->avrcp_absolute_volume) return; + /* Do not use hardware volume controls for backchannel of A2DP source */ + if (u->profile == PA_BLUETOOTH_PROFILE_A2DP_SOURCE) { + pa_assert_fp(u->transport->bt_codec && u->transport->bt_codec->support_backchannel); + return; + } + /* Remote volume control has to be supported for the callback to make sense, * otherwise this sink should continue performing attenuation in software * without HW_VOLUME_CTL. |