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
This commit is contained in:
parent
16b2dd39c4
commit
5c39821723
|
@ -3364,7 +3364,7 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
|
|||
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 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
|
|||
}
|
||||
|
||||
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 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
|
|||
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 @@ static int adev_open_input_stream(struct audio_hw_device *dev,
|
|||
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,
|
||||
|
|
|
@ -697,6 +697,10 @@ int voice_extn_compress_voip_open_input_stream(struct stream_in *in)
|
|||
voip_data.sample_rate = in->config.rate;
|
||||
}
|
||||
|
||||
ret = voip_set_mode(in->dev, in->format);
|
||||
if (ret < 0)
|
||||
goto done;
|
||||
|
||||
in->usecase = USECASE_COMPRESS_VOIP_CALL;
|
||||
if (in->config.rate == 16000)
|
||||
in->config = pcm_config_voip_wb;
|
||||
|
@ -704,7 +708,6 @@ int voice_extn_compress_voip_open_input_stream(struct stream_in *in)
|
|||
in->config = pcm_config_voip_nb;
|
||||
|
||||
voip_data.in_stream_count++;
|
||||
ret = voip_set_mode(in->dev, in->format);
|
||||
|
||||
done:
|
||||
ALOGV("%s: exit, ret=%d", __func__, ret);
|
||||
|
|
Loading…
Reference in New Issue