hal: Fix incorrect MBDRC volume level for music use case.
-In concurrent use case of music playback and touch tone,
MBDRC volume level appiled for music is not correct because
Music stream was not added to use case list. But volume
level was not cached as calibration for low latency was set
successfully.
-cache MBDRC volume level always and apply it once stream
is started.
Change-Id: Ib6a7e544149ac0ee29360b5f53be039ab08b1a62
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 15ebddf..2272c89 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -454,12 +454,9 @@
pthread_mutex_lock(&adev->lock);
ret_val = platform_send_gain_dep_cal(adev->platform, level);
- // if cal set fails, cache level info
- // if cal set succeds, reset known last cal set
- if (!ret_val)
- last_known_cal_step = level;
- else if (last_known_cal_step != -1)
- last_known_cal_step = -1;
+ // cache level info for any of the use case which
+ // was not started.
+ last_known_cal_step = level;;
pthread_mutex_unlock(&adev->lock);
} else {
@@ -3350,6 +3347,7 @@
if (last_known_cal_step != -1) {
ALOGD("%s: retry previous failed cal level set", __func__);
audio_hw_send_gain_dep_calibration(last_known_cal_step);
+ last_known_cal_step = -1;
}
}