Lines Matching refs:in
898 static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames);
899 static int do_in_standby_l(struct stream_in *in);
902 static void get_capture_reference_delay(struct stream_in *in, in get_capture_reference_delay() argument
917 ref_device = node_to_item(list_tail(&in->pcm_dev_list), in get_capture_reference_delay()
942 static void get_capture_delay(struct stream_in *in, in get_capture_delay() argument
956 pcm_device = node_to_item(list_head(&in->pcm_dev_list), in get_capture_delay()
972 buf_delay = (long)(((int64_t)(in->read_buf_frames) * 1000000000) / in->config.rate + in get_capture_delay()
973 ((int64_t)(in->proc_buf_frames) * 1000000000) / in->requested_rate ); in get_capture_delay()
977 if (in->resampler) { in get_capture_delay()
978 rsmp_delay = in->resampler->delay_ns(in->resampler); in get_capture_delay()
981 kernel_delay = (long)(((int64_t)kernel_frames * 1000000000) / in->config.rate); in get_capture_delay()
992 in->read_buf_frames, in->proc_buf_frames, frames); in get_capture_delay()
995 static int32_t update_echo_reference(struct stream_in *in, size_t frames) in update_echo_reference() argument
997 ALOGVV("%s: enter:), in->config.channels(%d)", __func__,in->config.channels); in update_echo_reference()
1002 pcm_device = node_to_item(list_head(&in->pcm_dev_list), in update_echo_reference()
1007 in->config.channels, frames, in->ref_buf_frames, frames - in->ref_buf_frames); in update_echo_reference()
1008 if (in->ref_buf_frames < frames) { in update_echo_reference()
1009 if (in->ref_buf_size < frames) { in update_echo_reference()
1010 in->ref_buf_size = frames; in update_echo_reference()
1011 … in->ref_buf = (int16_t *)realloc(in->ref_buf, pcm_frames_to_bytes(pcm_device->pcm, frames)); in update_echo_reference()
1012 ALOG_ASSERT((in->ref_buf != NULL), in update_echo_reference()
1015 in->ref_buf, pcm_frames_to_bytes(pcm_device->pcm, frames)); in update_echo_reference()
1017 b.frame_count = frames - in->ref_buf_frames; in update_echo_reference()
1018 b.raw = (void *)(in->ref_buf + in->ref_buf_frames * in->config.channels); in update_echo_reference()
1020 get_capture_delay(in, frames, &b); in update_echo_reference()
1022 if (in->echo_reference->read(in->echo_reference, &b) == 0) in update_echo_reference()
1024 in->ref_buf_frames += b.frame_count; in update_echo_reference()
1027 in->ref_buf_frames, in->ref_buf_size, frames, b.frame_count); in update_echo_reference()
1071 static void push_echo_reference(struct stream_in *in, size_t frames) in push_echo_reference() argument
1077 int32_t delay_us = update_echo_reference(in, frames)/1000; in push_echo_reference()
1082 if (in->ref_buf_frames < frames) in push_echo_reference()
1083 frames = in->ref_buf_frames; in push_echo_reference()
1086 buf.raw = in->ref_buf; in push_echo_reference()
1088 for (i = 0; i < in->num_preprocessors; i++) { in push_echo_reference()
1089 if ((*in->preprocessors[i].effect_itfe)->process_reverse == NULL) in push_echo_reference()
1092 (*in->preprocessors[i].effect_itfe)->process_reverse(in->preprocessors[i].effect_itfe, in push_echo_reference()
1096 set_preprocessor_echo_delay(in->preprocessors[i].effect_itfe, delay_us); in push_echo_reference()
1099 in->ref_buf_frames -= buf.frameCount; in push_echo_reference()
1101 __func__, in->ref_buf_frames, in->config.channels); in push_echo_reference()
1102 if (in->ref_buf_frames) { in push_echo_reference()
1103 memcpy(in->ref_buf, in push_echo_reference()
1104 in->ref_buf + buf.frameCount * in->config.channels, in push_echo_reference()
1105 in->ref_buf_frames * in->config.channels * sizeof(int16_t)); in push_echo_reference()
1166 static int get_hw_echo_reference(struct stream_in *in) in get_hw_echo_reference() argument
1170 struct audio_device *adev = in->dev; in get_hw_echo_reference()
1172 in->hw_echo_reference = false; in get_hw_echo_reference()
1187 if (in->input_flags & AUDIO_INPUT_FLAG_FAST) { in get_hw_echo_reference()
1205 list_add_tail(&in->pcm_dev_list, &ref_device->stream_list_node); in get_hw_echo_reference()
1207 in->hw_echo_reference = true; in get_hw_echo_reference()
1259 static int in_configure_reverse(struct stream_in *in) in in_configure_reverse() argument
1267 ALOGV("%s: enter: in->num_preprocessors(%d)", __func__, in->num_preprocessors); in in_configure_reverse()
1268 if (in->num_preprocessors > 0) { in in_configure_reverse()
1269 config.inputCfg.channels = in->main_channels; in in_configure_reverse()
1270 config.outputCfg.channels = in->main_channels; in in_configure_reverse()
1273 config.inputCfg.samplingRate = in->requested_rate; in in_configure_reverse()
1274 config.outputCfg.samplingRate = in->requested_rate; in in_configure_reverse()
1280 for (i = 0; i < in->num_preprocessors; i++) in in_configure_reverse()
1282 if ((*in->preprocessors[i].effect_itfe)->process_reverse == NULL) in in_configure_reverse()
1284 fct_status = (*(in->preprocessors[i].effect_itfe))->command( in in_configure_reverse()
1285 in->preprocessors[i].effect_itfe, in in_configure_reverse()
1300 static void in_read_audio_effect_channel_configs(struct stream_in *in __unused, in in_read_audio_effect_channel_configs()
1356 static uint32_t in_get_aux_channels(struct stream_in *in) in in_get_aux_channels() argument
1361 if (in->num_preprocessors == 0) in in_get_aux_channels()
1366 if (!(in->devices & (AUDIO_DEVICE_IN_BUILTIN_MIC | AUDIO_DEVICE_IN_BACK_MIC))) in in_get_aux_channels()
1373 if (cur_chcfg->main_channels == in->main_channels) { in in_get_aux_channels()
1378 idx_preproc < (size_t)in->num_preprocessors && match_cnt == idx_preproc; in in_get_aux_channels()
1380 struct effect_info_s *effect_info = &in->preprocessors[idx_preproc]; in in_get_aux_channels()
1393 if (match_cnt == (size_t)in->num_preprocessors) { in in_get_aux_channels()
1470 static int in_reconfigure_channels(struct stream_in *in, in in_reconfigure_channels() argument
1484 for (i = 0; i < in->num_preprocessors; i++) in in_reconfigure_channels()
1486 int cur_status = in_configure_effect_channels(in->preprocessors[i].effect_itfe, in in_reconfigure_channels()
1508 static void in_update_aux_channels(struct stream_in *in, in in_update_aux_channels() argument
1515 aux_channels = in_get_aux_channels(in); in in_update_aux_channels()
1517 channel_config.main_channels = in->main_channels; in in_update_aux_channels()
1519 status = in_reconfigure_channels(in, in in_update_aux_channels()
1522 (aux_channels != in->aux_channels)); in in_update_aux_channels()
1529 in_reconfigure_channels(in, effect, &channel_config, true); in in_update_aux_channels()
1531 …ALOGV("%s: aux_channels=%d, in->aux_channels_changed=%d", __func__, aux_channels, in->aux_channels… in in_update_aux_channels()
1532 if (in->aux_channels != aux_channels) { in in_update_aux_channels()
1533 in->aux_channels_changed = true; in in_update_aux_channels()
1534 in->aux_channels = aux_channels; in in_update_aux_channels()
1535 do_in_standby_l(in); in in_update_aux_channels()
1545 static ssize_t read_and_process_frames(struct stream_in *in, void* buffer, ssize_t frames) in read_and_process_frames() argument
1550 size_t src_channels = in->config.channels; in read_and_process_frames()
1551 size_t dst_channels = audio_channel_count_from_in_mask(in->main_channels); in read_and_process_frames()
1557 bool has_processing = (in->num_preprocessors != 0) ? true : false; in read_and_process_frames()
1566 proc_buf_out = in->proc_buf_out; in read_and_process_frames()
1570 if (list_empty(&in->pcm_dev_list)) { in read_and_process_frames()
1575 pcm_device = node_to_item(list_head(&in->pcm_dev_list), in read_and_process_frames()
1584 if (in->proc_buf_frames < (size_t)frames) { in read_and_process_frames()
1586 if (in->proc_buf_size < (size_t)frames) { in read_and_process_frames()
1588 in->proc_buf_size = (size_t)frames; in read_and_process_frames()
1589 in->proc_buf_in = (int16_t *)realloc(in->proc_buf_in, size_in_bytes); in read_and_process_frames()
1590 ALOG_ASSERT((in->proc_buf_in != NULL), in read_and_process_frames()
1593 in->proc_buf_out = (int16_t *)realloc(in->proc_buf_out, size_in_bytes); in read_and_process_frames()
1594 ALOG_ASSERT((in->proc_buf_out != NULL), in read_and_process_frames()
1596 proc_buf_out = in->proc_buf_out; in read_and_process_frames()
1599 frames_rd = read_frames(in, in read_and_process_frames()
1600 in->proc_buf_in + in read_and_process_frames()
1601 in->proc_buf_frames * in->config.channels, in read_and_process_frames()
1602 frames - in->proc_buf_frames); in read_and_process_frames()
1608 in->proc_buf_frames += frames_rd; in read_and_process_frames()
1611 if (in->echo_reference != NULL) { in read_and_process_frames()
1612 push_echo_reference(in, in->proc_buf_frames); in read_and_process_frames()
1617 in_buf.frameCount = in->proc_buf_frames; in read_and_process_frames()
1618 in_buf.s16 = in->proc_buf_in; in read_and_process_frames()
1620 out_buf.s16 = (int16_t *)proc_buf_out + frames_wr * in->config.channels; in read_and_process_frames()
1627 for (i = 0; i < in->num_preprocessors; i++) { in read_and_process_frames()
1628 (*in->preprocessors[i].effect_itfe)->process(in->preprocessors[i].effect_itfe, in read_and_process_frames()
1636 in->proc_buf_frames -= in_buf.frameCount; in read_and_process_frames()
1638 if (in->proc_buf_frames) { in read_and_process_frames()
1639 memcpy(in->proc_buf_in, in read_and_process_frames()
1640 in->proc_buf_in + in_buf.frameCount * in->config.channels, in read_and_process_frames()
1641 in->proc_buf_frames * in->config.channels * sizeof(int16_t)); in read_and_process_frames()
1666 if (in->proc_buf_size < (size_t)frames) { in read_and_process_frames()
1668 in->proc_buf_size = (size_t)frames; in read_and_process_frames()
1669 in->proc_buf_out = (int16_t *)realloc(in->proc_buf_out, size_in_bytes); in read_and_process_frames()
1670 ALOG_ASSERT((in->proc_buf_out != NULL), in read_and_process_frames()
1672 proc_buf_out = in->proc_buf_out; in read_and_process_frames()
1675 frames_wr = read_frames(in, proc_buf_out, frames); in read_and_process_frames()
1711 struct stream_in *in; in get_next_buffer() local
1717 in = (struct stream_in *)((char *)buffer_provider - in get_next_buffer()
1720 if (list_empty(&in->pcm_dev_list)) { in get_next_buffer()
1723 in->read_status = -ENODEV; in get_next_buffer()
1727 pcm_device = node_to_item(list_head(&in->pcm_dev_list), in get_next_buffer()
1730 if (in->read_buf_frames == 0) { in get_next_buffer()
1731 size_t size_in_bytes = pcm_frames_to_bytes(pcm_device->pcm, in->config.period_size); in get_next_buffer()
1732 if (in->read_buf_size < in->config.period_size) { in get_next_buffer()
1733 in->read_buf_size = in->config.period_size; in get_next_buffer()
1734 in->read_buf = (int16_t *) realloc(in->read_buf, size_in_bytes); in get_next_buffer()
1735 ALOG_ASSERT((in->read_buf != NULL), in get_next_buffer()
1739 in->read_status = pcm_read(pcm_device->pcm, (void*)in->read_buf, size_in_bytes); in get_next_buffer()
1741 if (in->read_status != 0) { in get_next_buffer()
1742 ALOGE("get_next_buffer() pcm_read error %d", in->read_status); in get_next_buffer()
1745 return in->read_status; in get_next_buffer()
1747 in->read_buf_frames = in->config.period_size; in get_next_buffer()
1751 if (in->hw_echo_reference) { in get_next_buffer()
1760 ref_device = node_to_item(list_tail(&in->pcm_dev_list), in get_next_buffer()
1762 list_for_each(node, &in->pcm_dev_list) { in get_next_buffer()
1772 if (in->hw_ref_buf_size < size_hw_ref_frames) { in get_next_buffer()
1773 in->hw_ref_buf_size = size_hw_ref_frames; in get_next_buffer()
1774 in->hw_ref_buf = (int16_t *) realloc(in->hw_ref_buf, size_hw_ref_bytes); in get_next_buffer()
1775 ALOG_ASSERT((in->hw_ref_buf != NULL), in get_next_buffer()
1778 in->hw_ref_buf, size_hw_ref_bytes); in get_next_buffer()
1781 read_status = pcm_read(ref_device->pcm, (void*)in->hw_ref_buf, size_hw_ref_bytes); in get_next_buffer()
1788 get_capture_reference_delay(in, size_hw_ref_frames, &b); in get_next_buffer()
1789 b.raw = (void *)in->hw_ref_buf; in get_next_buffer()
1793 in->echo_reference->write(in->echo_reference, &b); in get_next_buffer()
1801 buffer->frame_count = (buffer->frame_count > in->read_buf_frames) ? in get_next_buffer()
1802 in->read_buf_frames : buffer->frame_count; in get_next_buffer()
1803 buffer->i16 = in->read_buf + (in->config.period_size - in->read_buf_frames) * in get_next_buffer()
1804 in->config.channels; in get_next_buffer()
1805 return in->read_status; in get_next_buffer()
1811 struct stream_in *in; in release_buffer() local
1816 in = (struct stream_in *)((char *)buffer_provider - in release_buffer()
1819 in->read_buf_frames -= buffer->frame_count; in release_buffer()
1824 static ssize_t read_frames(struct stream_in *in, void *buffer, ssize_t frames) in read_frames() argument
1830 if (list_empty(&in->pcm_dev_list)) { in read_frames()
1835 pcm_device = node_to_item(list_head(&in->pcm_dev_list), in read_frames()
1841 __func__,frames_rd,frames_wr,in->config.channels); in read_frames()
1842 if (in->resampler != NULL) { in read_frames()
1843 in->resampler->resample_from_provider(in->resampler, in read_frames()
1852 get_next_buffer(&in->buf_provider, &buf); in read_frames()
1860 release_buffer(&in->buf_provider, &buf); in read_frames()
1864 if (in->read_status != 0) in read_frames()
1865 return in->read_status; in read_frames()
1872 static int in_release_pcm_devices(struct stream_in *in) in in_release_pcm_devices() argument
1878 list_for_each_safe(node, next, &in->pcm_dev_list) { in in_release_pcm_devices()
1887 static int stop_input_stream(struct stream_in *in) in stop_input_stream() argument
1890 struct audio_device *adev = in->dev; in stop_input_stream()
1894 in->usecase, use_case_table[in->usecase]); in stop_input_stream()
1895 uc_info = get_usecase_from_id(adev, in->usecase); in stop_input_stream()
1898 __func__, in->usecase); in stop_input_stream()
1908 if (list_empty(&in->pcm_dev_list)) { in stop_input_stream()
1913 in_release_pcm_devices(in); in stop_input_stream()
1914 list_init(&in->pcm_dev_list); in stop_input_stream()
1917 if (in->hw_echo_reference) in stop_input_stream()
1919 in->hw_echo_reference = false; in stop_input_stream()
1927 int start_input_stream(struct stream_in *in) in start_input_stream() argument
1933 struct audio_device *adev = in->dev; in start_input_stream()
1937 ALOGV("%s: enter: usecase(%d)", __func__, in->usecase); in start_input_stream()
1938 adev->active_input = in; in start_input_stream()
1939 pcm_profile = get_pcm_device(in->usecase == USECASE_AUDIO_CAPTURE_HOTWORD in start_input_stream()
1940 ? PCM_HOTWORD_STREAMING : PCM_CAPTURE, in->devices); in start_input_stream()
1943 __func__, in->usecase); in start_input_stream()
1948 if (in->input_flags & AUDIO_INPUT_FLAG_FAST) { in start_input_stream()
1955 uc_info->id = in->usecase; in start_input_stream()
1957 uc_info->stream = (struct audio_stream *)in; in start_input_stream()
1958 uc_info->devices = in->devices; in start_input_stream()
1964 list_init(&in->pcm_dev_list); in start_input_stream()
1965 list_add_tail(&in->pcm_dev_list, &pcm_device->stream_list_node); in start_input_stream()
1974 select_devices(adev, in->usecase); in start_input_stream()
1980 if (in->config.rate != pcm_profile->config.rate) { in start_input_stream()
1983 in->config = pcm_profile->config; in start_input_stream()
1986 if (in->aux_channels_changed) { in start_input_stream()
1987 … in->config.channels = audio_channel_count_from_in_mask(in->main_channels | in->aux_channels); in start_input_stream()
1992 if (in->requested_rate != in->config.rate) { in start_input_stream()
1997 if (in->resampler) { in start_input_stream()
1998 release_resampler(in->resampler); in start_input_stream()
1999 in->resampler = NULL; in start_input_stream()
2001 in->buf_provider.get_next_buffer = get_next_buffer; in start_input_stream()
2002 in->buf_provider.release_buffer = release_buffer; in start_input_stream()
2003 ret = create_resampler(in->config.rate, in start_input_stream()
2004 in->requested_rate, in start_input_stream()
2005 in->config.channels, in start_input_stream()
2007 &in->buf_provider, in start_input_stream()
2008 &in->resampler); in start_input_stream()
2012 if (in->enable_aec && in->echo_reference == NULL) { in start_input_stream()
2013 in->echo_reference = get_echo_reference(adev, in start_input_stream()
2015 audio_channel_count_from_in_mask(in->main_channels), in start_input_stream()
2016 in->requested_rate in start_input_stream()
2021 if (in->enable_aec) { in start_input_stream()
2022 ret = get_hw_echo_reference(in); in start_input_stream()
2027 in->hw_ref_buf_size = 0; in start_input_stream()
2071 in->proc_buf_frames = 0; in start_input_stream()
2072 in->proc_buf_size = 0; in start_input_stream()
2073 in->read_buf_size = 0; in start_input_stream()
2074 in->read_buf_frames = 0; in start_input_stream()
2077 if (in->resampler) { in start_input_stream()
2078 in->resampler->reset(in->resampler); in start_input_stream()
2085 if (in->resampler) { in start_input_stream()
2086 release_resampler(in->resampler); in start_input_stream()
2087 in->resampler = NULL; in start_input_stream()
2089 stop_input_stream(in); in start_input_stream()
2723 struct stream_in *in = NULL; /* if non-NULL, then force input to standby */ in out_set_parameters() local
2743 in = adev->active_input; in out_set_parameters()
2787 if (in) { in out_set_parameters()
2789 pthread_mutex_lock(&in->lock); in out_set_parameters()
2791 LOG_ALWAYS_FATAL_IF(in != adev->active_input); in out_set_parameters()
2792 do_in_standby_l(in); in out_set_parameters()
2794 pthread_mutex_unlock(&in->lock); in out_set_parameters()
2933 struct stream_in *in = NULL; in out_write() local
2965 in = adev->active_input; in out_write()
2971 if (!in) { in out_write()
3006 if (in) { in out_write()
3164 if (in) { in out_write()
3166 pthread_mutex_lock(&in->lock); in out_write()
3168 LOG_ALWAYS_FATAL_IF(in != adev->active_input); in out_write()
3169 do_in_standby_l(in); in out_write()
3171 pthread_mutex_unlock(&in->lock); in out_write()
3362 struct stream_in *in = (struct stream_in *)stream; in in_get_sample_rate() local
3364 return in->requested_rate; in in_get_sample_rate()
3376 struct stream_in *in = (struct stream_in *)stream; in in_get_channels() local
3378 return in->main_channels; in in_get_channels()
3397 struct stream_in *in = (struct stream_in *)stream; in in_get_buffer_size() local
3399 return get_input_buffer_size(in->requested_rate, in in_get_buffer_size()
3401 audio_channel_count_from_in_mask(in->main_channels), in in_get_buffer_size()
3402 in->devices); in in_get_buffer_size()
3405 static int in_close_pcm_devices(struct stream_in *in) in in_close_pcm_devices() argument
3409 struct audio_device *adev = in->dev; in in_close_pcm_devices()
3411 list_for_each(node, &in->pcm_dev_list) { in in_close_pcm_devices()
3427 static int do_in_standby_l(struct stream_in *in) in do_in_standby_l() argument
3432 struct audio_device *adev = in->dev; in do_in_standby_l()
3434 if (!in->standby) { in do_in_standby_l()
3436 in_close_pcm_devices(in); in do_in_standby_l()
3439 if (in->echo_reference != NULL) { in do_in_standby_l()
3441 in->echo_reference->read(in->echo_reference, NULL); in do_in_standby_l()
3442 put_echo_reference(adev, in->echo_reference); in do_in_standby_l()
3443 in->echo_reference = NULL; in do_in_standby_l()
3446 if (in->hw_echo_reference) in do_in_standby_l()
3448 if (in->hw_ref_buf) { in do_in_standby_l()
3449 free(in->hw_ref_buf); in do_in_standby_l()
3450 in->hw_ref_buf = NULL; in do_in_standby_l()
3456 status = stop_input_stream(in); in do_in_standby_l()
3458 if (in->read_buf) { in do_in_standby_l()
3459 free(in->read_buf); in do_in_standby_l()
3460 in->read_buf = NULL; in do_in_standby_l()
3463 in->standby = 1; in do_in_standby_l()
3469 static int in_standby_l(struct stream_in *in) in in_standby_l() argument
3471 struct audio_device *adev = in->dev; in in_standby_l()
3473 pthread_mutex_lock(&in->lock); in in_standby_l()
3474 if (!in->standby) { in in_standby_l()
3476 status = do_in_standby_l(in); in in_standby_l()
3479 pthread_mutex_unlock(&in->lock); in in_standby_l()
3485 struct stream_in *in = (struct stream_in *)stream; in in_standby() local
3486 struct audio_device *adev = in->dev; in in_standby()
3490 status = in_standby_l(in); in in_standby()
3506 struct stream_in *in = (struct stream_in *)stream; in in_set_parameters() local
3507 struct audio_device *adev = in->dev; in in_set_parameters()
3524 pthread_mutex_lock(&in->lock); in in_set_parameters()
3529 if (((int)in->source != val) && (val != 0)) { in in_set_parameters()
3530 in->source = val; in in_set_parameters()
3537 if (((int)in->devices != val) && (val != 0)) { in in_set_parameters()
3538 in->devices = val; in in_set_parameters()
3540 if (!in->standby) { in in_set_parameters()
3541 uc_info = get_usecase_from_id(adev, in->usecase); in in_set_parameters()
3544 __func__, in->usecase); in in_set_parameters()
3546 if (list_empty(&in->pcm_dev_list)) in in_set_parameters()
3549 pcm_device = node_to_item(list_head(&in->pcm_dev_list), in in_set_parameters()
3557 ret = do_in_standby_l(in); in in_set_parameters()
3559 ret = select_devices(adev, in->usecase); in in_set_parameters()
3564 pthread_mutex_unlock(&in->lock); in in_set_parameters()
3588 static ssize_t read_bytes_from_dsp(struct stream_in *in, void* buffer, in read_bytes_from_dsp() argument
3592 struct audio_device *adev = in->dev; in read_bytes_from_dsp()
3594 pcm_device = node_to_item(list_head(&in->pcm_dev_list), in read_bytes_from_dsp()
3606 struct stream_in *in = (struct stream_in *)stream; in in_read() local
3607 struct audio_device *adev = in->dev; in in_read()
3615 pthread_mutex_lock(&in->lock); in in_read()
3616 if (in->standby) { in in_read()
3617 pthread_mutex_unlock(&in->lock); in in_read()
3619 pthread_mutex_lock(&in->lock); in in_read()
3620 if (!in->standby) { in in_read()
3625 ret = start_input_stream(in); in in_read()
3631 in->standby = 0; in in_read()
3635 if (!list_empty(&in->pcm_dev_list)) { in in_read()
3636 if (in->usecase == USECASE_AUDIO_CAPTURE_HOTWORD) { in in_read()
3637 bytes = read_bytes_from_dsp(in, buffer, bytes); in in_read()
3647 frames = read_and_process_frames(in, buffer, frames_rq); in in_read()
3661 pthread_mutex_unlock(&in->lock); in in_read()
3664 in_standby(&in->stream.common); in in_read()
3667 in->requested_rate); in in_read()
3683 struct stream_in *in = (struct stream_in *)stream; in add_remove_audio_effect() local
3684 struct audio_device *adev = in->dev; in add_remove_audio_effect()
3697 pthread_mutex_lock(&in->lock); in add_remove_audio_effect()
3698 pthread_mutex_lock(&in->dev->lock); in add_remove_audio_effect()
3700 if ((in->source == AUDIO_SOURCE_VOICE_COMMUNICATION) && in add_remove_audio_effect()
3701 in->enable_aec != enable && in add_remove_audio_effect()
3703 in->enable_aec = enable; in add_remove_audio_effect()
3704 if (!in->standby) in add_remove_audio_effect()
3705 select_devices(in->dev, in->usecase); in add_remove_audio_effect()
3708 if ( (in->num_preprocessors > MAX_PREPROCESSORS) && (enable == true) ) { in add_remove_audio_effect()
3713 in->preprocessors[in->num_preprocessors].effect_itfe = effect; in add_remove_audio_effect()
3715 in_read_audio_effect_channel_configs(in, &in->preprocessors[in->num_preprocessors]); in add_remove_audio_effect()
3716 in->num_preprocessors ++; in add_remove_audio_effect()
3718 in_update_aux_channels(in, effect);//wesley crash in add_remove_audio_effect()
3719 in->aux_channels_changed = true; in add_remove_audio_effect()
3722 if (in->num_preprocessors <= 0) { in add_remove_audio_effect()
3727 for (i=0; i < in->num_preprocessors; i++) { in add_remove_audio_effect()
3729 in->preprocessors[i - 1].effect_itfe = in->preprocessors[i].effect_itfe; in add_remove_audio_effect()
3730 in->preprocessors[i - 1].channel_configs = in->preprocessors[i].channel_configs; in add_remove_audio_effect()
3731 in->preprocessors[i - 1].num_channel_configs = in add_remove_audio_effect()
3732 in->preprocessors[i].num_channel_configs; in add_remove_audio_effect()
3736 if ( in->preprocessors[i].effect_itfe == effect ) { in add_remove_audio_effect()
3738 free(in->preprocessors[i].channel_configs); in add_remove_audio_effect()
3744 in->num_preprocessors--; in add_remove_audio_effect()
3746 in->preprocessors[in->num_preprocessors].num_channel_configs = 0; in add_remove_audio_effect()
3747 in->preprocessors[in->num_preprocessors].effect_itfe = NULL; in add_remove_audio_effect()
3748 in->preprocessors[in->num_preprocessors].channel_configs = NULL; in add_remove_audio_effect()
3749 in->aux_channels_changed = false; in add_remove_audio_effect()
3750 … ALOGV("%s: enable(%d), in->aux_channels_changed(%d)", __func__, enable, in->aux_channels_changed); in add_remove_audio_effect()
3752 ALOGI("%s: num_preprocessors = %d", __func__, in->num_preprocessors); in add_remove_audio_effect()
3755 in->enable_aec = enable; in add_remove_audio_effect()
3757 if (!in->standby) { in add_remove_audio_effect()
3758 select_devices(in->dev, in->usecase); in add_remove_audio_effect()
3759 do_in_standby_l(in); in add_remove_audio_effect()
3761 if (in->enable_aec == true) { in add_remove_audio_effect()
3762 in_configure_reverse(in); in add_remove_audio_effect()
3768 pthread_mutex_unlock(&in->dev->lock); in add_remove_audio_effect()
3769 pthread_mutex_unlock(&in->lock); in add_remove_audio_effect()
4191 struct stream_in *in; in adev_open_input_stream() local
4209 in = (struct stream_in *)calloc(1, sizeof(struct stream_in)); in adev_open_input_stream()
4211 in->stream.common.get_sample_rate = in_get_sample_rate; in adev_open_input_stream()
4212 in->stream.common.set_sample_rate = in_set_sample_rate; in adev_open_input_stream()
4213 in->stream.common.get_buffer_size = in_get_buffer_size; in adev_open_input_stream()
4214 in->stream.common.get_channels = in_get_channels; in adev_open_input_stream()
4215 in->stream.common.get_format = in_get_format; in adev_open_input_stream()
4216 in->stream.common.set_format = in_set_format; in adev_open_input_stream()
4217 in->stream.common.standby = in_standby; in adev_open_input_stream()
4218 in->stream.common.dump = in_dump; in adev_open_input_stream()
4219 in->stream.common.set_parameters = in_set_parameters; in adev_open_input_stream()
4220 in->stream.common.get_parameters = in_get_parameters; in adev_open_input_stream()
4221 in->stream.common.add_audio_effect = in_add_audio_effect; in adev_open_input_stream()
4222 in->stream.common.remove_audio_effect = in_remove_audio_effect; in adev_open_input_stream()
4223 in->stream.set_gain = in_set_gain; in adev_open_input_stream()
4224 in->stream.read = in_read; in adev_open_input_stream()
4225 in->stream.get_input_frames_lost = in_get_input_frames_lost; in adev_open_input_stream()
4227 in->devices = devices; in adev_open_input_stream()
4228 in->source = source; in adev_open_input_stream()
4229 in->dev = adev; in adev_open_input_stream()
4230 in->standby = 1; in adev_open_input_stream()
4231 in->main_channels = config->channel_mask; in adev_open_input_stream()
4232 in->requested_rate = config->sample_rate; in adev_open_input_stream()
4235 in->input_flags = flags; in adev_open_input_stream()
4238 in->config = pcm_profile->config; in adev_open_input_stream()
4242 in->usecase = USECASE_AUDIO_CAPTURE_HOTWORD; in adev_open_input_stream()
4244 in->usecase = USECASE_AUDIO_CAPTURE; in adev_open_input_stream()
4247 *stream_in = &in->stream; in adev_open_input_stream()
4256 struct stream_in *in = (struct stream_in*)stream; in adev_close_input_stream() local
4265 for (i=0; i<in->num_preprocessors; i++) { in adev_close_input_stream()
4266 free(in->preprocessors[i].channel_configs); in adev_close_input_stream()
4269 if (in->read_buf) { in adev_close_input_stream()
4270 free(in->read_buf); in adev_close_input_stream()
4271 in->read_buf = NULL; in adev_close_input_stream()
4274 if (in->proc_buf_in) { in adev_close_input_stream()
4275 free(in->proc_buf_in); in adev_close_input_stream()
4276 in->proc_buf_in = NULL; in adev_close_input_stream()
4279 if (in->proc_buf_out) { in adev_close_input_stream()
4280 free(in->proc_buf_out); in adev_close_input_stream()
4281 in->proc_buf_out = NULL; in adev_close_input_stream()
4284 if (in->ref_buf) { in adev_close_input_stream()
4285 free(in->ref_buf); in adev_close_input_stream()
4286 in->ref_buf = NULL; in adev_close_input_stream()
4289 if (in->resampler) { in adev_close_input_stream()
4290 release_resampler(in->resampler); in adev_close_input_stream()
4291 in->resampler = NULL; in adev_close_input_stream()
4295 in_standby_l(in); in adev_close_input_stream()