Merge "post_proc: disable Bassboost and Virtualizer for USB_ACCESSORY"
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index eaf53d8..530f08f 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -1072,6 +1072,8 @@
int start_output_stream(struct stream_out *out)
{
int ret = 0;
+ int sink_channels = 0;
+ char prop_value[PROPERTY_VALUE_MAX] = {0};
struct audio_usecase *uc_info;
struct audio_device *adev = out->dev;
@@ -1095,10 +1097,17 @@
/* This must be called before adding this usecase to the list */
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);
+ property_get("audio.use.hdmi.sink.cap", prop_value, NULL);
+ if (!strncmp("true", prop_value, 4)) {
+ sink_channels = platform_edid_get_max_channels(out->dev->platform);
+ ALOGD("%s: set HDMI channel count[%d] based on sink capability", __func__, sink_channels);
+ check_and_set_hdmi_channels(adev, sink_channels);
+ } else {
+ 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);
@@ -1953,7 +1962,7 @@
* Instead of writing zeroes here, we could trust the hardware
* to always provide zeroes when muted.
*/
- if (ret == 0 && voice_get_mic_mute(adev) && !voice_is_in_call(adev))
+ if (ret == 0 && voice_get_mic_mute(adev) && !voice_is_in_call_rec_stream(in))
memset(buffer, 0, bytes);
exit:
diff --git a/hal/voice.c b/hal/voice.c
index 9bde570..7cb448e 100644
--- a/hal/voice.c
+++ b/hal/voice.c
@@ -189,6 +189,19 @@
return in_call;
}
+bool voice_is_in_call_rec_stream(struct stream_in *in)
+{
+ bool in_call_rec = false;
+ int ret = 0;
+
+ ret = voice_extn_is_in_call_rec_stream(in, &in_call_rec);
+ if (ret == -ENOSYS) {
+ in_call_rec = false;
+ }
+
+ return in_call_rec;
+}
+
uint32_t voice_get_active_session_id(struct audio_device *adev)
{
int ret = 0;
diff --git a/hal/voice.h b/hal/voice.h
index d160569..0098f94 100644
--- a/hal/voice.h
+++ b/hal/voice.h
@@ -77,6 +77,7 @@
struct str_parms *reply);
void voice_init(struct audio_device *adev);
bool voice_is_in_call(struct audio_device *adev);
+bool voice_is_in_call_rec_stream(struct stream_in *in);
int voice_set_mic_mute(struct audio_device *dev, bool state);
bool voice_get_mic_mute(struct audio_device *dev);
int voice_set_volume(struct audio_device *adev, float volume);
diff --git a/hal/voice_extn/voice_extn.c b/hal/voice_extn/voice_extn.c
index f6083f3..58a1f8b 100644
--- a/hal/voice_extn/voice_extn.c
+++ b/hal/voice_extn/voice_extn.c
@@ -356,6 +356,19 @@
return 0;
}
+int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec)
+{
+ *in_call_rec = false;
+
+ if(in->source == AUDIO_SOURCE_VOICE_DOWNLINK ||
+ in->source == AUDIO_SOURCE_VOICE_UPLINK ||
+ in->source == AUDIO_SOURCE_VOICE_CALL) {
+ *in_call_rec = true;
+ }
+
+ return 0;
+}
+
void voice_extn_init(struct audio_device *adev)
{
adev->voice.session[VOICE_SESS_IDX].vsid = VOICE_VSID;
diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h
index f7d20e4..4a9c610 100644
--- a/hal/voice_extn/voice_extn.h
+++ b/hal/voice_extn/voice_extn.h
@@ -33,6 +33,7 @@
struct str_parms *query,
struct str_parms *reply);
int voice_extn_is_in_call(struct audio_device *adev, bool *in_call);
+int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec);
int voice_extn_get_active_session_id(struct audio_device *adev,
uint32_t *session_id);
void voice_extn_in_get_parameters(struct stream_in *in,
@@ -80,6 +81,11 @@
return -ENOSYS;
}
+static int voice_extn_is_in_call_rec_stream(struct stream_in *in, bool *in_call_rec)
+{
+ return -ENOSYS;
+}
+
static int voice_extn_get_active_session_id(struct audio_device *adev,
uint32_t *session_id)
{