hal: update input source type during open input stream
Currently input stream source type is updated in in_set_parameters().
Some of the effects like AEC are applied based on input source type.
If effects API is called before in_set_parameters() then that effect
does not apply. Fix this issue by updating the source type in
adev_open_input_stream() instead of in_set_parameters().
Change-Id: Iff0670264e156840c40f1f15cfc93fd5b2506e0d
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 33e48c9..5679770 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3364,7 +3364,7 @@
struct audio_stream_in **stream_in,
audio_input_flags_t flags __unused,
const char *address __unused,
- audio_source_t source __unused)
+ audio_source_t source)
{
struct audio_device *adev = (struct audio_device *)dev;
struct stream_in *in;
@@ -3384,8 +3384,8 @@
}
ALOGD("%s: enter: sample_rate(%d) channel_mask(%#x) devices(%#x)\
- stream_handle(%p) io_handle(%d)",__func__, config->sample_rate, config->channel_mask,
- devices, &in->stream, handle);
+ stream_handle(%p) io_handle(%d) source(%d)",__func__, config->sample_rate, config->channel_mask,
+ devices, &in->stream, handle, source);
pthread_mutex_init(&in->lock, (const pthread_mutexattr_t *) NULL);
@@ -3406,7 +3406,7 @@
in->stream.get_input_frames_lost = in_get_input_frames_lost;
in->device = devices;
- in->source = AUDIO_SOURCE_DEFAULT;
+ in->source = source;
in->dev = adev;
in->standby = 1;
in->channel_mask = config->channel_mask;
@@ -3472,6 +3472,13 @@
channel_count,
is_low_latency);
in->config.period_size = buffer_size / frame_size;
+ if ((in->source == AUDIO_SOURCE_VOICE_COMMUNICATION) &&
+ (in->dev->mode == AUDIO_MODE_IN_COMMUNICATION) &&
+ (voice_extn_compress_voip_is_format_supported(in->format)) &&
+ (in->config.rate == 8000 || in->config.rate == 16000) &&
+ (audio_channel_count_from_in_mask(in->channel_mask) == 1)) {
+ voice_extn_compress_voip_open_input_stream(in);
+ }
}
/* This stream could be for sound trigger lab,