Merge "hal: Use compress audio for incall recording with AMR WB"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 94b8734..0406627 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -394,6 +394,13 @@
enable_snd_device(adev, snd_device, false);
}
}
+
+ list_for_each(node, &adev->usecase_list) {
+ usecase = node_to_item(node, struct audio_usecase, list);
+ if (switch_device[usecase->id]) {
+ enable_snd_device(adev, snd_device, false);
+ }
+ }
/* Make sure new snd device is enabled before re-routing the streams */
audio_route_update_mixer(adev->audio_route);
@@ -999,7 +1006,7 @@
return 0;
if (channels == adev->cur_hdmi_channels) {
- ALOGD("%s: Requested channels are same as current", __func__);
+ ALOGD("%s: Requested channels are same as current channels(%d)", __func__, channels);
return 0;
}
@@ -1098,8 +1105,12 @@
uc_info->out_snd_device = SND_DEVICE_NONE;
/* This must be called before adding this usecase to the list */
- if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)
- check_and_set_hdmi_channels(adev, out->config.channels);
+ if (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL) {
+ if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD)
+ check_and_set_hdmi_channels(adev, out->compr_config.codec->ch_in);
+ else
+ check_and_set_hdmi_channels(adev, out->config.channels);
+ }
list_add_tail(&adev->usecase_list, &uc_info->list);
@@ -1261,8 +1272,8 @@
}
pthread_mutex_lock(&out->lock);
- pthread_mutex_lock(&adev->lock);
if (!out->standby) {
+ pthread_mutex_lock(&adev->lock);
out->standby = true;
if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) {
if (out->pcm) {
@@ -1279,8 +1290,8 @@
}
}
stop_output_stream(out);
+ pthread_mutex_unlock(&adev->lock);
}
- pthread_mutex_unlock(&adev->lock);
pthread_mutex_unlock(&out->lock);
ALOGV("%s: exit", __func__);
return 0;
@@ -1786,12 +1797,12 @@
pthread_mutex_lock(&in->lock);
if (!in->standby) {
+ pthread_mutex_lock(&adev->lock);
in->standby = true;
if (in->pcm) {
pcm_close(in->pcm);
in->pcm = NULL;
}
- pthread_mutex_lock(&adev->lock);
status = stop_input_stream(in);
pthread_mutex_unlock(&adev->lock);
}