Home | History | Annotate | Download | only in hal

Lines Matching defs:in

5  * you may not use this file except in compliance with the License.
10 * Unless required by applicable law or agreed to in writing, software
714 /* Delay in Us */
917 static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames);
918 static int do_in_standby_l(struct stream_in *in);
921 static void get_capture_reference_delay(struct stream_in *in,
927 /* read frames available in
936 ref_device = node_to_item(list_tail(&in->pcm_dev_list),
961 static void get_capture_delay(struct stream_in *in,
966 /* read frames available in kernel driver buffer */
975 pcm_device = node_to_item(list_head(&in->pcm_dev_list),
986 /* read frames available in audio HAL input buffer
988 * in current buffer */
989 /* frames in in->read_buf are at driver sampling rate while frames in in->proc_buf are
991 buf_delay = (long)(((int64_t)(in->read_buf_frames) * 1000000000) / in->config.rate +
992 ((int64_t)(in->proc_buf_frames) * 1000000000) / in->requested_rate );
996 if (in->resampler) {
997 rsmp_delay = in->resampler->delay_ns(in->resampler);
1000 kernel_delay = (long)(((int64_t)kernel_frames * 1000000000) / in->config.rate);
1008 "in->read_buf_frames:[%zd], in->proc_buf_frames:[%zd], frames:[%zd]",
1011 in->read_buf_frames, in->proc_buf_frames, frames);
1014 static int32_t update_echo_reference(struct stream_in *in, size_t frames)
1016 ALOGVV("%s: enter:), in->config.channels(%d)", __func__,in->config.channels);
1021 pcm_device = node_to_item(list_head(&in->pcm_dev_list),
1024 ALOGVV("update_echo_reference, in->config.channels(%d), frames = [%zd], in->ref_buf_frames = [%zd], "
1026 in->config.channels, frames, in->ref_buf_frames, frames - in->ref_buf_frames);
1027 if (in->ref_buf_frames < frames) {
1028 if (in->ref_buf_size < frames) {
1029 in->ref_buf_size = frames;
1030 in->ref_buf = (int16_t *)realloc(in->ref_buf, pcm_frames_to_bytes(pcm_device->pcm, frames));
1031 ALOG_ASSERT((in->ref_buf != NULL),
1034 in->ref_buf, pcm_frames_to_bytes(pcm_device->pcm, frames));
1036 b.frame_count = frames - in->ref_buf_frames;
1037 b.raw = (void *)(in->ref_buf + in->ref_buf_frames * in->config.channels);
1039 get_capture_delay(in, frames, &b);
1041 if (in->echo_reference->read(in->echo_reference, &b) == 0)
1043 in->ref_buf_frames += b.frame_count;
1044 ALOGVV("update_echo_reference(): in->ref_buf_frames:[%zd], "
1045 "in->ref_buf_size:[%zd], frames:[%zd], b.frame_count:[%zd]",
1046 in->ref_buf_frames, in->ref_buf_size, frames, b.frame_count);
1090 static void push_echo_reference(struct stream_in *in, size_t frames)
1094 * in->ref_buf_frames is updated with frames available in in->ref_buf */
1096 int32_t delay_us = update_echo_reference(in, frames)/1000;
1101 if (in->ref_buf_frames < frames)
1102 frames = in->ref_buf_frames;
1105 buf.raw = in->ref_buf;
1107 for (i = 0; i < in->num_preprocessors; i++) {
1108 if ((*in->preprocessors[i].effect_itfe)->process_reverse == NULL)
1111 (*in->preprocessors[i].effect_itfe)->process_reverse(in->preprocessors[i].effect_itfe,
1115 set_preprocessor_echo_delay(in->preprocessors[i].effect_itfe, delay_us);
1118 in->ref_buf_frames -= buf.frameCount;
1119 ALOGVV("%s: in->ref_buf_frames(%zd), in->config.channels(%d) ",
1120 __func__, in->ref_buf_frames, in->config.channels);
1121 if (in->ref_buf_frames) {
1122 memcpy(in->ref_buf,
1123 in->ref_buf + buf.frameCount * in->config.channels,
1124 in->ref_buf_frames * in->config.channels * sizeof(int16_t));
1142 // if the primary output is in standby or did not pick the echo reference yet
1144 // otherwise, out_write() or out_standby() will detect the change in echo reference
1185 static int get_hw_echo_reference(struct stream_in *in)
1189 struct audio_device *adev = in->dev;
1191 in->hw_echo_reference = false;
1219 list_add_tail(&in->pcm_dev_list, &ref_device->stream_list_node);
1221 in->hw_echo_reference = true;
1273 static int in_configure_reverse(struct stream_in *in)
1281 ALOGV("%s: enter: in->num_preprocessors(%d)", __func__, in->num_preprocessors);
1282 if (in->num_preprocessors > 0) {
1283 config.inputCfg.channels = in->main_channels;
1284 config.outputCfg.channels = in->main_channels;
1287 config.inputCfg.samplingRate = in->requested_rate;
1288 config.outputCfg.samplingRate = in->requested_rate;
1294 for (i = 0; i < in->num_preprocessors; i++)
1296 if ((*in->preprocessors[i].effect_itfe)->process_reverse == NULL)
1298 fct_status = (*(in->preprocessors[i].effect_itfe))->command(
1299 in->preprocessors[i].effect_itfe,
1314 static void in_read_audio_effect_channel_configs(struct stream_in *in __unused,
1317 /* size and format of the cmd are defined in hardware/audio_effect.h */
1370 static uint32_t in_get_aux_channels(struct stream_in *in)
1375 if (in->num_preprocessors == 0)
1380 if (!(in->devices & (AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_BACK_MIC)))
1387 if (cur_chcfg->main_channels == in->main_channels) {
1392 idx_preproc < (size_t)in->num_preprocessors && match_cnt == idx_preproc;
1394 struct effect_info_s *effect_info = &in->preprocessors[idx_preproc];
1407 if (match_cnt == (size_t)in->num_preprocessors) {
1484 static int in_reconfigure_channels(struct stream_in *in,
1498 for (i = 0; i < in->num_preprocessors; i++)
1500 int cur_status = in_configure_effect_channels(in->preprocessors[i].effect_itfe,
1522 static void in_update_aux_channels(struct stream_in *in,
1529 aux_channels = in_get_aux_channels(in);
1531 channel_config.main_channels = in->main_channels;
1533 status = in_reconfigure_channels(in,
1536 (aux_channels != in->aux_channels));
1543 in_reconfigure_channels(in, effect, &channel_config, true);
1545 ALOGV("%s: aux_channels=%d, in->aux_channels_changed=%d", __func__, aux_channels, in->aux_channels_changed);
1546 if (in->aux_channels != aux_channels) {
1547 in->aux_channels_changed = true;
1548 in->aux_channels = aux_channels;
1549 do_in_standby_l(in);
1559 static ssize_t read_and_process_frames(struct stream_in *in, void* buffer, ssize_t frames)
1564 size_t src_channels = in->config.channels;
1565 size_t dst_channels = audio_channel_count_from_in_mask(in->main_channels);
1571 bool has_processing = (in->num_preprocessors != 0) ? true : false;
1577 * In case of additional channels, we cannot work inplace
1580 proc_buf_out = in->proc_buf_out;
1584 if (list_empty(&in->pcm_dev_list)) {
1589 pcm_device = node_to_item(list_head(&in->pcm_dev_list),
1594 /* since all the processing below is done in frames and using the config.channels
1595 * as the number of channels, no changes is required in case aux_channels are present */
1598 if (in->proc_buf_frames < (size_t)frames) {
1600 if (in->proc_buf_size < (size_t)frames) {
1602 in->proc_buf_size = (size_t)frames;
1603 in->proc_buf_in = (int16_t *)realloc(in->proc_buf_in, size_in_bytes);
1604 ALOG_ASSERT((in->proc_buf_in != NULL),
1607 in->proc_buf_out = (int16_t *)realloc(in->proc_buf_out, size_in_bytes);
1608 ALOG_ASSERT((in->proc_buf_out != NULL),
1610 proc_buf_out = in->proc_buf_out;
1613 frames_rd = read_frames(in,
1614 in->proc_buf_in +
1615 in->proc_buf_frames * in->config.channels,
1616 frames - in->proc_buf_frames);
1622 in->proc_buf_frames += frames_rd;
1625 if (in->echo_reference != NULL) {
1626 push_echo_reference(in, in->proc_buf_frames);
1631 in_buf.frameCount = in->proc_buf_frames;
1632 in_buf.s16 = in->proc_buf_in;
1634 out_buf.s16 = (int16_t *)proc_buf_out + frames_wr * in->config.channels;
1641 for (i = 0; i < in->num_preprocessors; i++) {
1642 (*in->preprocessors[i].effect_itfe)->process(in->preprocessors[i].effect_itfe,
1647 /* process() has updated the number of frames consumed and produced in
1649 * move remaining frames to the beginning of in->proc_buf_in */
1650 in->proc_buf_frames -= in_buf.frameCount;
1652 if (in->proc_buf_frames) {
1653 memcpy(in->proc_buf_in,
1654 in->proc_buf_in + in_buf.frameCount * in->config.channels,
1655 in->proc_buf_frames * in->config.channels * sizeof(int16_t));
1667 /* The effect does not comply to the API. In theory, we should never end up here! */
1680 if (in->proc_buf_size < (size_t)frames) {
1682 in->proc_buf_size = (size_t)frames;
1683 in->proc_buf_out = (int16_t *)realloc(in->proc_buf_out, size_in_bytes);
1684 ALOG_ASSERT((in->proc_buf_out != NULL),
1686 proc_buf_out = in->proc_buf_out;
1689 frames_wr = read_frames(in, proc_buf_out, frames);
1725 struct stream_in *in;
1731 in = (struct stream_in *)((char *)buffer_provider -
1734 if (list_empty(&in->pcm_dev_list)) {
1737 in->read_status = -ENODEV;
1741 pcm_device = node_to_item(list_head(&in->pcm_dev_list),
1744 if (in->read_buf_frames == 0) {
1745 size_t size_in_bytes = pcm_frames_to_bytes(pcm_device->pcm, in->config.period_size);
1746 if (in->read_buf_size < in->config.period_size) {
1747 in->read_buf_size = in->config.period_size;
1748 in->read_buf = (int16_t *) realloc(in->read_buf, size_in_bytes);
1749 ALOG_ASSERT((in->read_buf != NULL),
1753 in->read_status = pcm_read(pcm_device->pcm, (void*)in->read_buf, size_in_bytes);
1755 if (in->read_status != 0) {
1756 ALOGE("get_next_buffer() pcm_read error %d", in->read_status);
1759 return in->read_status;
1761 in->read_buf_frames = in->config.period_size;
1765 if (in->hw_echo_reference) {
1774 ref_device = node_to_item(list_tail(&in->pcm_dev_list),
1776 list_for_each(node, &in->pcm_dev_list) {
1786 if (in->hw_ref_buf_size < size_hw_ref_frames) {
1787 in->hw_ref_buf_size = size_hw_ref_frames;
1788 in->hw_ref_buf = (int16_t *) realloc(in->hw_ref_buf, size_hw_ref_bytes);
1789 ALOG_ASSERT((in->hw_ref_buf != NULL),
1792 in->hw_ref_buf, size_hw_ref_bytes);
1795 read_status = pcm_read(ref_device->pcm, (void*)in->hw_ref_buf, size_hw_ref_bytes);
1802 get_capture_reference_delay(in, size_hw_ref_frames, &b);
1803 b.raw = (void *)in->hw_ref_buf;
1807 in->echo_reference->write(in->echo_reference, &b);
1815 buffer->frame_count = (buffer->frame_count > in->read_buf_frames) ?
1816 in->read_buf_frames : buffer->frame_count;
1817 buffer->i16 = in->read_buf + (in->config.period_size - in->read_buf_frames) *
1818 in->config.channels;
1819 return in->read_status;
1825 struct stream_in *in;
1830 in = (struct stream_in *)((char *)buffer_provider -
1833 in->read_buf_frames -= buffer->frame_count;
1838 static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames)
1844 if (list_empty(&in->pcm_dev_list)) {
1849 pcm_device = node_to_item(list_head(&in->pcm_dev_list),
1854 ALOGVV("%s: frames_rd: %zd, frames_wr: %zd, in->config.channels: %d",
1855 __func__,frames_rd,frames_wr,in->config.channels);
1856 if (in->resampler != NULL) {
1857 in->resampler->resample_from_provider(in->resampler,
1866 get_next_buffer(&in->buf_provider, &buf);
1874 release_buffer(&in->buf_provider, &buf);
1876 /* in->read_status is updated by getNextBuffer() also called by
1877 * in->resampler->resample_from_provider() */
1878 if (in->read_status != 0)
1879 return in->read_status;
1886 static int in_release_pcm_devices(struct stream_in *in)
1892 list_for_each_safe(node, next, &in->pcm_dev_list) {
1901 static int stop_input_stream(struct stream_in *in)
1904 struct audio_device *adev = in->dev;
1908 in->usecase, use_case_table[in->usecase]);
1909 uc_info = get_usecase_from_id(adev, in->usecase);
1911 ALOGE("%s: Could not find the usecase (%d) in the list",
1912 __func__, in->usecase);
1922 if (list_empty(&in->pcm_dev_list)) {
1927 in_release_pcm_devices(in);
1928 list_init(&in->pcm_dev_list);
1931 if (in->hw_echo_reference)
1933 in->hw_echo_reference = false;
1941 static int start_input_stream(struct stream_in *in)
1947 struct audio_device *adev = in->dev;
1951 ALOGV("%s: enter: usecase(%d)", __func__, in->usecase);
1952 adev->active_input = in;
1953 pcm_profile = get_pcm_device(in->usecase_type, in->devices);
1956 __func__, in->usecase);
1962 uc_info->id = in->usecase;
1964 uc_info->stream = (struct audio_stream *)in;
1965 uc_info->devices = in->devices;
1971 list_init(&in->pcm_dev_list);
1972 list_add_tail(&in->pcm_dev_list, &pcm_device->stream_list_node);
1981 select_devices(adev, in->usecase);
1987 if (in->config.rate != pcm_profile->config.rate) {
1990 in->config = pcm_profile->config;
1993 if (in->aux_channels_changed) {
1994 in->config.channels = audio_channel_count_from_in_mask(in->main_channels | in->aux_channels);
1999 if (in->requested_rate != in->config.rate) {
2004 if (in->resampler) {
2005 release_resampler(in->resampler);
2006 in->resampler = NULL;
2008 in->buf_provider.get_next_buffer = get_next_buffer;
2009 in->buf_provider.release_buffer = release_buffer;
2010 ret = create_resampler(in->config.rate,
2011 in->requested_rate,
2012 in->config.channels,
2014 &in->buf_provider,
2015 &in->resampler);
2019 if (in->enable_aec && in->echo_reference == NULL) {
2020 in->echo_reference = get_echo_reference(adev,
2022 audio_channel_count_from_in_mask(in->main_channels),
2023 in->requested_rate
2028 if (in->enable_aec) {
2029 ret = get_hw_echo_reference(in);
2034 in->hw_ref_buf_size = 0;
2041 * As such a change in aux_channels will not have an effect.
2076 /* force read and proc buffer reallocation in case of frame size or
2078 in->proc_buf_frames = 0;
2079 in->proc_buf_size = 0;
2080 in->read_buf_size = 0;
2081 in->read_buf_frames = 0;
2084 if (in->resampler) {
2085 in->resampler->reset(in->resampler);
2092 if (in->resampler) {
2093 release_resampler(in->resampler);
2094 in->resampler = NULL;
2096 stop_input_stream(in);
2104 void lock_input_stream(struct stream_in *in)
2106 pthread_mutex_lock(&in->pre_lock);
2107 pthread_mutex_lock(&in->lock);
2108 pthread_mutex_unlock(&in->pre_lock);
2378 ALOGE("%s: Could not find the usecase (%d) in the list",
2489 ALOGE("%s: Could not find the usecase (%d) in the list",
2745 struct stream_in *in = NULL; /* if non-NULL, then force input to standby */
2762 * - because a change in output device may change mic settings */
2765 in = adev->active_input;
2775 ALOGE("%s: Could not find the usecase (%d) in the list",
2793 ALOGE("%s: Could not find the usecase (%d) in the list",
2822 if (in) {
2824 lock_input_stream(in);
2826 LOG_ALWAYS_FATAL_IF(in != adev->active_input);
2827 do_in_standby_l(in);
2829 pthread_mutex_unlock(&in->lock);
2994 struct stream_in *in = NULL;
3034 /* A change in output device may change the microphone selection */
3038 in = adev->active_input;
3044 if (!in) {
3045 /* Leave mutex locked iff in != NULL */
3079 if (in) {
3080 /* This mutex was left locked iff in != NULL */
3237 if (in) {
3239 lock_input_stream(in);
3241 LOG_ALWAYS_FATAL_IF(in != adev->active_input);
3242 do_in_standby_l(in);
3244 pthread_mutex_unlock(&in->lock);
3245 /* This mutex was left locked iff in != NULL */
3329 /* It would be unusual for this value to be negative, but check just in case ... */
3418 ALOGE("out_flush() called in wrong state %d", out->offload_state);
3435 struct stream_in *in = (struct stream_in *)stream;
3437 return in->requested_rate;
3449 struct stream_in *in = (struct stream_in *)stream;
3451 return in->main_channels;
3470 struct stream_in *in = (struct stream_in *)stream;
3472 return get_input_buffer_size(in->requested_rate,
3474 audio_channel_count_from_in_mask(in->main_channels),
3475 in->usecase_type,
3476 in->devices);
3479 static int in_close_pcm_devices(struct stream_in *in)
3483 struct audio_device *adev = in->dev;
3485 list_for_each(node, &in->pcm_dev_list) {
3501 static int do_in_standby_l(struct stream_in *in)
3506 struct audio_device *adev = in->dev;
3508 if (!in->standby) {
3510 in_close_pcm_devices(in);
3513 if (in->echo_reference != NULL) {
3515 in->echo_reference->read(in->echo_reference, NULL);
3516 put_echo_reference(adev, in->echo_reference);
3517 in->echo_reference = NULL;
3520 if (in->hw_echo_reference)
3522 if (in->hw_ref_buf) {
3523 free(in->hw_ref_buf);
3524 in->hw_ref_buf = NULL;
3530 status = stop_input_stream(in);
3532 if (in->read_buf) {
3533 free(in->read_buf);
3534 in->read_buf = NULL;
3537 in->standby = 1;
3543 static int in_standby_l(struct stream_in *in)
3545 struct audio_device *adev = in->dev;
3547 lock_input_stream(in);
3548 if (!in->standby) {
3550 status = do_in_standby_l(in);
3553 pthread_mutex_unlock(&in->lock);
3559 struct stream_in *in = (struct stream_in *)stream;
3560 struct audio_device *adev = in->dev;
3564 status = in_standby_l(in);
3580 struct stream_in *in = (struct stream_in *)stream;
3581 struct audio_device *adev = in->dev;
3598 lock_input_stream(in);
3603 if (((int)in->source != val) && (val != 0)) {
3604 in->source = val;
3611 if (((int)in->devices != val) && (val != 0)) {
3612 in->devices = val;
3613 /* If recording is in progress, change the tx device to new device */
3614 if (!in->standby) {
3615 uc_info = get_usecase_from_id(adev, in->usecase);
3617 ALOGE("%s: Could not find the usecase (%d) in the list",
3618 __func__, in->usecase);
3620 if (list_empty(&in->pcm_dev_list))
3623 pcm_device = node_to_item(list_head(&in->pcm_dev_list),
3631 ret = do_in_standby_l(in);
3633 ret = select_devices(adev, in->usecase);
3638 pthread_mutex_unlock(&in->lock);
3666 static ssize_t read_bytes_from_dsp(struct stream_in *in, void* buffer,
3670 struct audio_device *adev = in->dev;
3672 pcm_device = node_to_item(list_head(&in->pcm_dev_list),
3684 struct stream_in *in = (struct stream_in *)stream;
3685 struct audio_device *adev = in->dev;
3695 lock_input_stream(in);
3697 if (in->usecase == USECASE_AUDIO_CAPTURE && !in->is_fastcapture_affinity_set) {
3703 in->is_fastcapture_affinity_set = true;
3706 if (in->standby) {
3707 pthread_mutex_unlock(&in->lock);
3709 lock_input_stream(in);
3710 if (!in->standby) {
3715 ret = start_input_stream(in);
3721 in->standby = 0;
3725 if (!list_empty(&in->pcm_dev_list)) {
3726 if (in->usecase == USECASE_AUDIO_CAPTURE_HOTWORD) {
3727 bytes = read_bytes_from_dsp(in, buffer, bytes);
3737 frames = read_and_process_frames(in, buffer, frames_rq);
3751 pthread_mutex_unlock(&in->lock);
3754 in_standby(&in->stream.common);
3757 in->requested_rate);
3773 struct stream_in *in = (struct stream_in *)stream;
3774 struct audio_device *adev = in->dev;
3787 lock_input_stream(in);
3788 pthread_mutex_lock(&in->dev->lock);
3790 if ((in->source == AUDIO_SOURCE_VOICE_COMMUNICATION) &&
3791 in->enable_aec != enable &&
3793 in->enable_aec = enable;
3794 if (!in->standby)
3795 select_devices(in->dev, in->usecase);
3798 if ( (in->num_preprocessors > MAX_PREPROCESSORS) && (enable == true) ) {
3803 in->preprocessors[in->num_preprocessors].effect_itfe = effect;
3804 /* add the supported channel of the effect in the channel_configs */
3805 in_read_audio_effect_channel_configs(in, &in->preprocessors[in->num_preprocessors]);
3806 in->num_preprocessors ++;
3808 in_update_aux_channels(in, effect);//wesley crash
3809 in->aux_channels_changed = true;
3812 if (in->num_preprocessors <= 0) {
3817 for (i=0; i < in->num_preprocessors; i++) {
3819 in->preprocessors[i - 1].effect_itfe = in->preprocessors[i].effect_itfe;
3820 in->preprocessors[i - 1].channel_configs = in->preprocessors[i].channel_configs;
3821 in->preprocessors[i - 1].num_channel_configs =
3822 in->preprocessors[i].num_channel_configs;
3826 if ( in->preprocessors[i].effect_itfe == effect ) {
3828 free(in->preprocessors[i].channel_configs);
3834 in->num_preprocessors--;
3836 in->preprocessors[in->num_preprocessors].num_channel_configs = 0;
3837 in->preprocessors[in->num_preprocessors].effect_itfe = NULL;
3838 in->preprocessors[in->num_preprocessors].channel_configs = NULL;
3839 in->aux_channels_changed = false;
3840 ALOGV("%s: enable(%d), in->aux_channels_changed(%d)", __func__, enable, in->aux_channels_changed);
3842 ALOGI("%s: num_preprocessors = %d", __func__, in->num_preprocessors);
3845 in->enable_aec = enable;
3847 if (!in->standby) {
3848 select_devices(in->dev, in->usecase);
3849 do_in_standby_l(in);
3851 if (in->enable_aec == true) {
3852 in_configure_reverse(in);
3858 pthread_mutex_unlock(&in->dev->lock);
3859 pthread_mutex_unlock(&in->lock);
4121 /* FIXME: note that the code below assumes that the speakers are in the correct placement
4269 /* NOTE: we default to built in mic which may cause a mismatch between what we
4289 struct stream_in *in;
4314 in = (struct stream_in *)calloc(1, sizeof(struct stream_in));
4316 in->stream.common.get_sample_rate = in_get_sample_rate;
4317 in->stream.common.set_sample_rate = in_set_sample_rate;
4318 in->stream.common.get_buffer_size = in_get_buffer_size;
4319 in->stream.common.get_channels = in_get_channels;
4320 in->stream.common.get_format = in_get_format;
4321 in->stream.common.set_format = in_set_format;
4322 in->stream.common.standby = in_standby;
4323 in->stream.common.dump = in_dump;
4324 in->stream.common.set_parameters = in_set_parameters;
4325 in->stream.common.get_parameters = in_get_parameters;
4326 in->stream.common.add_audio_effect = in_add_audio_effect;
4327 in->stream.common.remove_audio_effect = in_remove_audio_effect;
4328 in->stream.set_gain = in_set_gain;
4329 in->stream.read = in_read;
4330 in->stream.get_input_frames_lost = in_get_input_frames_lost;
4332 in->devices = devices;
4333 in->source = source;
4334 in->dev = adev;
4335 in->standby = 1;
4336 in->main_channels = config->channel_mask;
4337 in->requested_rate = config->sample_rate;
4340 in->input_flags = flags;
4343 in->config = pcm_profile->config;
4347 in->usecase = USECASE_AUDIO_CAPTURE_HOTWORD;
4349 in->usecase = USECASE_AUDIO_CAPTURE;
4351 in->usecase_type = usecase_type;
4353 pthread_mutex_init(&in->lock, (const pthread_mutexattr_t *) NULL);
4354 pthread_mutex_init(&in->pre_lock, (const pthread_mutexattr_t *) NULL);
4356 in->is_fastcapture_affinity_set = false;
4358 *stream_in = &in->stream;
4367 struct stream_in *in = (struct stream_in*)stream;
4376 for (i=0; i<in->num_preprocessors; i++) {
4377 free(in->preprocessors[i].channel_configs);
4380 if (in->read_buf) {
4381 free(in->read_buf);
4382 in->read_buf = NULL;
4385 if (in->proc_buf_in) {
4386 free(in->proc_buf_in);
4387 in->proc_buf_in = NULL;
4390 if (in->proc_buf_out) {
4391 free(in->proc_buf_out);
4392 in->proc_buf_out = NULL;
4395 if (in->ref_buf) {
4396 free(in->ref_buf);
4397 in->ref_buf = NULL;
4400 if (in->resampler) {
4401 release_resampler(in->resampler);
4402 in->resampler = NULL;
4406 in_standby_l(in);
4559 adev->dummybuf_thread_timeout = 6000; /* in 18 sec */
4728 ALOGE("%s: Error grabbing functions in %s", __func__, SOUND_TRIGGER_HAL_LIBRARY_PATH);