Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58f15fd8 authored by chenxin20's avatar chenxin20
Browse files

audio: ble: volume computation improvement on BLE for notifications



BLE should behave the same as A2DP in this scenario.
When playing STRATEGY_SONIFICATION* streams, or system sounds or
  enforced sounds on A2DP/BLE during media playback, ensure the
  difference between the media volume and the notification
  is no more than 12dB.

Change-Id: Ib125e0266203212ced3aef0f8c4669e61dc4c6d7
Signed-off-by: default avatarchenxin20 <chenxin20@xiaomi.com>
parent 48adf671
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -7862,9 +7862,10 @@ float AudioPolicyManager::computeVolume(IVolumeCurves &curves,
            }
            if (Volume::getDeviceForVolume(deviceTypes) != AUDIO_DEVICE_OUT_SPEAKER
                    &&  !Intersection(deviceTypes, {AUDIO_DEVICE_OUT_BLUETOOTH_A2DP,
                        AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES}).empty()) {
                // on A2DP, also ensure notification volume is not too low compared to media when
                // intended to be played
                        AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES,
                        AUDIO_DEVICE_OUT_BLE_HEADSET}).empty()) {
                // on A2DP/BLE, also ensure notification volume is not too low compared to media
                // when intended to be played.
                if ((volumeDb > -96.0f) &&
                        (musicVolDb - SONIFICATION_A2DP_MAX_MEDIA_DIFF_DB > volumeDb)) {
                    ALOGV("%s increasing volume for volume source=%d device=%s from %f to %f",