alsa_sound: Add support for multichannel hdmi
- Multichannel audio support for HDMI for AAC
format with 5.1 channels max.
Bug: 7156174
Change-Id: I42e92fa2b14d35a5882cc6d84c6651a6a4d5092a
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/alsa_sound/AudioStreamOutALSA.cpp b/alsa_sound/AudioStreamOutALSA.cpp
index 49c0581..64492ba 100644
--- a/alsa_sound/AudioStreamOutALSA.cpp
+++ b/alsa_sound/AudioStreamOutALSA.cpp
@@ -125,22 +125,35 @@
(strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
mParent->mLock.lock();
+ ALOGD("mHandle->useCase: %s", mHandle->useCase);
snd_use_case_get(mHandle->ucMgr, "_verb", (const char **)&use_case);
if ((use_case == NULL) || (!strcmp(use_case, SND_USE_CASE_VERB_INACTIVE))) {
- if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)){
- strlcpy(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL,sizeof(mHandle->useCase));
- } else if (mHandle->isDeepbufferOutput){
- strlcpy(mHandle->useCase, SND_USE_CASE_VERB_HIFI, sizeof(mHandle->useCase));
- } else {
- strlcpy(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOWLATENCY_MUSIC, sizeof(mHandle->useCase));
+ if(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP)){
+ strlcpy(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL,
+ sizeof(SND_USE_CASE_VERB_IP_VOICECALL));
+ } else if(!strcmp(mHandle->useCase,SND_USE_CASE_MOD_PLAY_MUSIC2)) {
+ strlcpy(mHandle->useCase, SND_USE_CASE_VERB_HIFI2,
+ sizeof(SND_USE_CASE_MOD_PLAY_MUSIC2));
+ } else if (!strcmp(mHandle->useCase,SND_USE_CASE_MOD_PLAY_MUSIC)){
+ strlcpy(mHandle->useCase, SND_USE_CASE_VERB_HIFI,
+ sizeof(SND_USE_CASE_MOD_PLAY_MUSIC));
+ } else if(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_LOWLATENCY_MUSIC)) {
+ strlcpy(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOWLATENCY_MUSIC,
+ sizeof(SND_USE_CASE_MOD_PLAY_LOWLATENCY_MUSIC));
}
} else {
- if(!strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP)) {
- strlcpy(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP,sizeof(mHandle->useCase));
- } else if (mHandle->isDeepbufferOutput){
- strlcpy(mHandle->useCase, SND_USE_CASE_MOD_PLAY_MUSIC, sizeof(mHandle->useCase));
- } else {
- strlcpy(mHandle->useCase, SND_USE_CASE_MOD_PLAY_LOWLATENCY_MUSIC, sizeof(mHandle->useCase));
+ if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)){
+ strlcpy(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP,
+ sizeof(SND_USE_CASE_MOD_PLAY_VOIP));
+ } else if(!strcmp(mHandle->useCase,SND_USE_CASE_VERB_HIFI2)) {
+ strlcpy(mHandle->useCase, SND_USE_CASE_MOD_PLAY_MUSIC2,
+ sizeof(SND_USE_CASE_MOD_PLAY_MUSIC2));
+ } else if (!strcmp(mHandle->useCase,SND_USE_CASE_VERB_HIFI)){
+ strlcpy(mHandle->useCase, SND_USE_CASE_MOD_PLAY_MUSIC,
+ sizeof(SND_USE_CASE_MOD_PLAY_MUSIC));
+ } else if(!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOWLATENCY_MUSIC)) {
+ strlcpy(mHandle->useCase, SND_USE_CASE_MOD_PLAY_LOWLATENCY_MUSIC,
+ sizeof(SND_USE_CASE_MOD_PLAY_LOWLATENCY_MUSIC));
}
}
free(use_case);
@@ -170,6 +183,7 @@
mHandle->module->route(mHandle, mDevices , mParent->mode());
}
if (!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI) ||
+ !strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI2) ||
!strcmp(mHandle->useCase, SND_USE_CASE_VERB_HIFI_LOWLATENCY_MUSIC) ||
!strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) {
snd_use_case_set(mHandle->ucMgr, "_verb", mHandle->useCase);