OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 for (auto& gain_controller : gain_controllers_) { | 117 for (auto& gain_controller : gain_controllers_) { |
118 WebRtcAgc_AddFarend(gain_controller->state(), packed_render_audio.data(), | 118 WebRtcAgc_AddFarend(gain_controller->state(), packed_render_audio.data(), |
119 packed_render_audio.size()); | 119 packed_render_audio.size()); |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 void GainControlImpl::PackRenderAudioBuffer( | 123 void GainControlImpl::PackRenderAudioBuffer( |
124 AudioBuffer* audio, | 124 AudioBuffer* audio, |
125 std::vector<int16_t>* packed_buffer) { | 125 std::vector<int16_t>* packed_buffer) { |
126 RTC_DCHECK_GE(160u, audio->num_frames_per_band()); | 126 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
127 | 127 |
128 packed_buffer->clear(); | 128 packed_buffer->clear(); |
129 packed_buffer->insert( | 129 packed_buffer->insert( |
130 packed_buffer->end(), audio->mixed_low_pass_data(), | 130 packed_buffer->end(), audio->mixed_low_pass_data(), |
131 (audio->mixed_low_pass_data() + audio->num_frames_per_band())); | 131 (audio->mixed_low_pass_data() + audio->num_frames_per_band())); |
132 } | 132 } |
133 | 133 |
134 int GainControlImpl::AnalyzeCaptureAudio(AudioBuffer* audio) { | 134 int GainControlImpl::AnalyzeCaptureAudio(AudioBuffer* audio) { |
135 rtc::CritScope cs(crit_capture_); | 135 rtc::CritScope cs(crit_capture_); |
136 | 136 |
137 if (!enabled_) { | 137 if (!enabled_) { |
138 return AudioProcessing::kNoError; | 138 return AudioProcessing::kNoError; |
139 } | 139 } |
140 | 140 |
141 RTC_DCHECK(num_proc_channels_); | 141 RTC_DCHECK(num_proc_channels_); |
142 RTC_DCHECK_GE(160u, audio->num_frames_per_band()); | 142 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
143 RTC_DCHECK_EQ(audio->num_channels(), *num_proc_channels_); | 143 RTC_DCHECK_EQ(audio->num_channels(), *num_proc_channels_); |
144 RTC_DCHECK_LE(*num_proc_channels_, gain_controllers_.size()); | 144 RTC_DCHECK_LE(*num_proc_channels_, gain_controllers_.size()); |
145 | 145 |
146 if (mode_ == kAdaptiveAnalog) { | 146 if (mode_ == kAdaptiveAnalog) { |
147 int capture_channel = 0; | 147 int capture_channel = 0; |
148 for (auto& gain_controller : gain_controllers_) { | 148 for (auto& gain_controller : gain_controllers_) { |
149 gain_controller->set_capture_level(analog_capture_level_); | 149 gain_controller->set_capture_level(analog_capture_level_); |
150 int err = WebRtcAgc_AddMic( | 150 int err = WebRtcAgc_AddMic( |
151 gain_controller->state(), audio->split_bands(capture_channel), | 151 gain_controller->state(), audio->split_bands(capture_channel), |
152 audio->num_bands(), audio->num_frames_per_band()); | 152 audio->num_bands(), audio->num_frames_per_band()); |
(...skipping 30 matching lines...) Expand all Loading... |
183 | 183 |
184 if (!enabled_) { | 184 if (!enabled_) { |
185 return AudioProcessing::kNoError; | 185 return AudioProcessing::kNoError; |
186 } | 186 } |
187 | 187 |
188 if (mode_ == kAdaptiveAnalog && !was_analog_level_set_) { | 188 if (mode_ == kAdaptiveAnalog && !was_analog_level_set_) { |
189 return AudioProcessing::kStreamParameterNotSetError; | 189 return AudioProcessing::kStreamParameterNotSetError; |
190 } | 190 } |
191 | 191 |
192 RTC_DCHECK(num_proc_channels_); | 192 RTC_DCHECK(num_proc_channels_); |
193 RTC_DCHECK_GE(160u, audio->num_frames_per_band()); | 193 RTC_DCHECK_GE(160, audio->num_frames_per_band()); |
194 RTC_DCHECK_EQ(audio->num_channels(), *num_proc_channels_); | 194 RTC_DCHECK_EQ(audio->num_channels(), *num_proc_channels_); |
195 | 195 |
196 stream_is_saturated_ = false; | 196 stream_is_saturated_ = false; |
197 int capture_channel = 0; | 197 int capture_channel = 0; |
198 for (auto& gain_controller : gain_controllers_) { | 198 for (auto& gain_controller : gain_controllers_) { |
199 int32_t capture_level_out = 0; | 199 int32_t capture_level_out = 0; |
200 uint8_t saturation_warning = 0; | 200 uint8_t saturation_warning = 0; |
201 | 201 |
202 // The call to stream_has_echo() is ok from a deadlock perspective | 202 // The call to stream_has_echo() is ok from a deadlock perspective |
203 // as the capture lock is allready held. | 203 // as the capture lock is allready held. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 for (auto& gain_controller : gain_controllers_) { | 430 for (auto& gain_controller : gain_controllers_) { |
431 const int handle_error = | 431 const int handle_error = |
432 WebRtcAgc_set_config(gain_controller->state(), config); | 432 WebRtcAgc_set_config(gain_controller->state(), config); |
433 if (handle_error != AudioProcessing::kNoError) { | 433 if (handle_error != AudioProcessing::kNoError) { |
434 error = handle_error; | 434 error = handle_error; |
435 } | 435 } |
436 } | 436 } |
437 return error; | 437 return error; |
438 } | 438 } |
439 } // namespace webrtc | 439 } // namespace webrtc |
OLD | NEW |