diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2019-06-09 23:14:12 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2019-06-09 23:14:12 +0000 |
commit | ed7dddb8233df8421c2a47c11ffa8b66b8d60173 (patch) | |
tree | 25ea1dcd7af56e8927861ba43c41fce789242cc1 | |
parent | b2edff83e1ec9da1cd9cf4306f519fa89dd5b5fc (diff) | |
parent | 49210f533bc2b76d07290fba07b05f20058d379d (diff) | |
download | android_hardware_qcom_audio-ed7dddb8233df8421c2a47c11ffa8b66b8d60173.tar.gz android_hardware_qcom_audio-ed7dddb8233df8421c2a47c11ffa8b66b8d60173.tar.bz2 android_hardware_qcom_audio-ed7dddb8233df8421c2a47c11ffa8b66b8d60173.zip |
Snap for 5645956 from 49210f533bc2b76d07290fba07b05f20058d379d to qt-qpr1-release
Change-Id: I7151f0dc7445e268c66465e9fb28b17a345acbde
-rw-r--r-- | hal/audio_hw.c | 26 | ||||
-rw-r--r-- | hal/audio_hw.h | 1 | ||||
-rw-r--r-- | hal/msm8974/platform.c | 3 | ||||
-rw-r--r-- | hal/msm8974/platform.h | 1 | ||||
-rw-r--r-- | hal/voice_extn/voice_extn.c | 11 |
5 files changed, 37 insertions, 5 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 2113c7db..5d611c6b 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -315,6 +315,7 @@ const char * const use_case_table[AUDIO_USECASE_MAX] = { [USECASE_AUDIO_RECORD_VOIP] = "audio-record-voip", [USECASE_INCALL_MUSIC_UPLINK] = "incall-music-uplink", + [USECASE_INCALL_MUSIC_UPLINK2] = "incall-music-uplink2", [USECASE_AUDIO_A2DP_ABR_FEEDBACK] = "a2dp-abr-feedback", }; @@ -1725,7 +1726,8 @@ int select_devices_with_force_switch(struct audio_device *adev, out_snd_device = SND_DEVICE_OUT_SPEAKER; } - if (usecase->id == USECASE_INCALL_MUSIC_UPLINK) { + if (usecase->id == USECASE_INCALL_MUSIC_UPLINK || + usecase->id == USECASE_INCALL_MUSIC_UPLINK2) { out_snd_device = SND_DEVICE_OUT_VOICE_MUSIC_TX; } @@ -2338,8 +2340,10 @@ static int stop_output_stream(struct stream_out *out) audio_low_latency_hint_end(); } - if (out->usecase == USECASE_INCALL_MUSIC_UPLINK) + if (out->usecase == USECASE_INCALL_MUSIC_UPLINK || + out->usecase == USECASE_INCALL_MUSIC_UPLINK2) { voice_set_device_mute_flag(adev, false); + } /* 1. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info); @@ -2444,6 +2448,16 @@ int start_output_stream(struct stream_out *out) goto error_config; } + //Update incall music usecase to reflect correct voice session + if (out->flags & AUDIO_OUTPUT_FLAG_INCALL_MUSIC) { + ret = voice_extn_check_and_set_incall_music_usecase(adev, out); + if (ret != 0) { + ALOGE("%s: Incall music delivery usecase cannot be set error:%d", + __func__, ret); + goto error_config; + } + } + if (out->devices & AUDIO_DEVICE_OUT_ALL_A2DP) { if (!audio_extn_a2dp_is_ready()) { if (out->devices & (AUDIO_DEVICE_OUT_SPEAKER | AUDIO_DEVICE_OUT_SPEAKER_SAFE)) { @@ -2506,8 +2520,10 @@ int start_output_stream(struct stream_out *out) audio_extn_extspk_update(adev->extspk); - if (out->usecase == USECASE_INCALL_MUSIC_UPLINK) + if (out->usecase == USECASE_INCALL_MUSIC_UPLINK || + out->usecase == USECASE_INCALL_MUSIC_UPLINK2) { voice_set_device_mute_flag(adev, true); + } ALOGV("%s: Opening PCM device card_id(%d) device_id(%d) format(%#x)", __func__, adev->snd_card, out->pcm_device_id, out->config.format); @@ -3502,7 +3518,9 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, if (out->muted) memset((void *)buffer, 0, bytes); // FIXME: this can be removed once audio flinger mixer supports mono output - if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP || out->usecase == USECASE_INCALL_MUSIC_UPLINK) { + if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP || + out->usecase == USECASE_INCALL_MUSIC_UPLINK || + out->usecase == USECASE_INCALL_MUSIC_UPLINK2) { size_t channel_count = audio_channel_count_from_out_mask(out->channel_mask); int16_t *src = (int16_t *)buffer; int16_t *dst = (int16_t *)buffer; diff --git a/hal/audio_hw.h b/hal/audio_hw.h index 764093ff..54ee72c5 100644 --- a/hal/audio_hw.h +++ b/hal/audio_hw.h @@ -134,6 +134,7 @@ enum { USECASE_AUDIO_RECORD_VOIP, USECASE_INCALL_MUSIC_UPLINK, + USECASE_INCALL_MUSIC_UPLINK2, USECASE_AUDIO_A2DP_ABR_FEEDBACK, diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index 4ae5d1c3..41d8bd28 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -251,6 +251,8 @@ static int pcm_device_table[AUDIO_USECASE_MAX][2] = { [USECASE_INCALL_MUSIC_UPLINK] = {INCALL_MUSIC_UPLINK_PCM_DEVICE, INCALL_MUSIC_UPLINK_PCM_DEVICE}, + [USECASE_INCALL_MUSIC_UPLINK2] = {INCALL_MUSIC_UPLINK2_PCM_DEVICE, + INCALL_MUSIC_UPLINK2_PCM_DEVICE}, }; /* Array to store sound devices */ @@ -712,6 +714,7 @@ static const struct name_to_index usecase_name_index[AUDIO_USECASE_MAX] = { {TO_NAME_INDEX(USECASE_AUDIO_PLAYBACK_VOIP)}, {TO_NAME_INDEX(USECASE_AUDIO_RECORD_VOIP)}, {TO_NAME_INDEX(USECASE_INCALL_MUSIC_UPLINK)}, + {TO_NAME_INDEX(USECASE_INCALL_MUSIC_UPLINK2)}, {TO_NAME_INDEX(USECASE_AUDIO_A2DP_ABR_FEEDBACK)}, }; diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h index c2beec99..3ab31787 100644 --- a/hal/msm8974/platform.h +++ b/hal/msm8974/platform.h @@ -336,6 +336,7 @@ enum { #define AFE_PROXY_RECORD_PCM_DEVICE 8 #define INCALL_MUSIC_UPLINK_PCM_DEVICE 27 +#define INCALL_MUSIC_UPLINK2_PCM_DEVICE 27 #define HFP_PCM_RX 5 #ifdef PLATFORM_MSM8x26 diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c index c4b8cff0..5d0596a4 100644 --- a/hal/voice_extn/voice_extn.c +++ b/hal/voice_extn/voice_extn.c @@ -576,7 +576,16 @@ void voice_extn_get_parameters(const struct audio_device *adev, int voice_extn_check_and_set_incall_music_usecase(struct audio_device *adev, struct stream_out *out) { - out->usecase = USECASE_INCALL_MUSIC_UPLINK; + uint32_t session_id = get_session_id_with_state(adev, CALL_ACTIVE); + if (session_id == VOICEMMODE1_VSID) + out->usecase = USECASE_INCALL_MUSIC_UPLINK; + else if (session_id == VOICEMMODE2_VSID) + out->usecase = USECASE_INCALL_MUSIC_UPLINK2; + else { + ALOGE("%s: Invalid session id %x", __func__, session_id); + out->usecase = USECASE_INCALL_MUSIC_UPLINK; + } + out->config = pcm_config_incall_music; //FIXME: add support for MONO stream configuration when audioflinger mixer supports it out->supported_channel_masks[0] = AUDIO_CHANNEL_OUT_STEREO; |