hal: fix missing calibration issue for playback on speaker
- ADM calibration is sometimes not sent for playback on speaker
due to use of unsupported sample rate by send calibration routine.
- Fix the issue by updating app_type sample_rate for output
to supported value before sending calibration data.
Change-Id: I3a04b6b7dd26aa53c1726d6a9a8e3cb72f7ba74e
diff --git a/hal/audio_extn/utils.c b/hal/audio_extn/utils.c
index 644300a..001e21a 100644
--- a/hal/audio_extn/utils.c
+++ b/hal/audio_extn/utils.c
@@ -579,14 +579,13 @@
if ((24 == usecase->stream.out->bit_width) &&
(usecase->stream.out->devices & AUDIO_DEVICE_OUT_SPEAKER)) {
- sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
+ out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
} else if ((snd_device != SND_DEVICE_OUT_HEADPHONES_44_1 &&
usecase->stream.out->sample_rate == OUTPUT_SAMPLING_RATE_44100) ||
(usecase->stream.out->sample_rate < OUTPUT_SAMPLING_RATE_44100)) {
- sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
- } else {
- sample_rate = out->app_type_cfg.sample_rate;
+ out->app_type_cfg.sample_rate = DEFAULT_OUTPUT_SAMPLING_RATE;
}
+ sample_rate = out->app_type_cfg.sample_rate;
app_type_cfg[len++] = out->app_type_cfg.app_type;
app_type_cfg[len++] = acdb_dev_id;
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 3fa45fe..0b4b796 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -418,8 +418,8 @@
audio_extn_dolby_ds2_set_endpoint(adev);
audio_extn_sound_trigger_update_stream_status(usecase, ST_EVENT_STREAM_BUSY);
audio_extn_listen_update_stream_status(usecase, LISTEN_EVENT_STREAM_BUSY);
- audio_extn_utils_send_audio_calibration(adev, usecase);
audio_extn_utils_send_app_type_cfg(usecase);
+ audio_extn_utils_send_audio_calibration(adev, usecase);
strlcpy(mixer_path, use_case_table[usecase->id], MIXER_PATH_MAX_LENGTH);
platform_add_backend_name(mixer_path, snd_device, usecase);
ALOGV("%s: apply mixer and update path: %s", __func__, mixer_path);