hal: Fix VoIP output or input use audio path when compress VOIP call is active
When voice call happen during compress VOIP call, VoIP input would
choose audio record when insert headset. First when voice call is
started, the call mode change to IN_CALL. Second compress VOIP input
stream would be closed, and then re-open when headset insert. Due to
call mode is IN_CALL, the input stream only can use audio-record
usecase even if compress VOIP still is active.
This change is to make sure VOIP input and output use VOIP path
when compress VOIP call is active.
CRs-Fixed: 1087113
Change-Id: If0c8151197b3617b112383d97dea5a290525bb0b
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 62bb88d..e1292c1 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3870,7 +3870,7 @@
out->config.rate = config->sample_rate;
out->config.channels = audio_channel_count_from_out_mask(out->channel_mask);
out->config.period_size = HDMI_MULTI_PERIOD_BYTES / (out->config.channels * 2);
- } else if ((out->dev->mode == AUDIO_MODE_IN_COMMUNICATION) &&
+ } else if ((out->dev->mode == AUDIO_MODE_IN_COMMUNICATION || voice_extn_compress_voip_is_active(out->dev)) &&
(out->flags == (AUDIO_OUTPUT_FLAG_DIRECT | AUDIO_OUTPUT_FLAG_VOIP_RX)) &&
(voice_extn_compress_voip_is_config_supported(config))) {
ret = voice_extn_compress_voip_open_output_stream(out);
@@ -4810,7 +4810,7 @@
}
if ((in->source == AUDIO_SOURCE_VOICE_COMMUNICATION) &&
- (in->dev->mode == AUDIO_MODE_IN_COMMUNICATION) &&
+ (in->dev->mode == AUDIO_MODE_IN_COMMUNICATION || voice_extn_compress_voip_is_active(in->dev)) &&
(voice_extn_compress_voip_is_format_supported(in->format)) &&
(in->config.rate == 8000 || in->config.rate == 16000 ||
in->config.rate == 32000 || in->config.rate == 48000) &&