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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 64 } |
65 | 65 |
66 VoEAudioProcessingImpl::~VoEAudioProcessingImpl() { | 66 VoEAudioProcessingImpl::~VoEAudioProcessingImpl() { |
67 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), | 67 WEBRTC_TRACE(kTraceMemory, kTraceVoice, VoEId(_shared->instance_id(), -1), |
68 "VoEAudioProcessingImpl::~VoEAudioProcessingImpl() - dtor"); | 68 "VoEAudioProcessingImpl::~VoEAudioProcessingImpl() - dtor"); |
69 } | 69 } |
70 | 70 |
71 int VoEAudioProcessingImpl::SetNsStatus(bool enable, NsModes mode) { | 71 int VoEAudioProcessingImpl::SetNsStatus(bool enable, NsModes mode) { |
72 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 72 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
73 "SetNsStatus(enable=%d, mode=%d)", enable, mode); | 73 "SetNsStatus(enable=%d, mode=%d)", enable, mode); |
74 #ifdef WEBRTC_VOICE_ENGINE_NR | |
75 if (!_shared->statistics().Initialized()) { | 74 if (!_shared->statistics().Initialized()) { |
76 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 75 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
77 return -1; | 76 return -1; |
78 } | 77 } |
79 | 78 |
80 NoiseSuppression::Level nsLevel = kDefaultNsMode; | 79 NoiseSuppression::Level nsLevel = kDefaultNsMode; |
81 switch (mode) { | 80 switch (mode) { |
82 case kNsDefault: | 81 case kNsDefault: |
83 nsLevel = kDefaultNsMode; | 82 nsLevel = kDefaultNsMode; |
84 break; | 83 break; |
(...skipping 23 matching lines...) Expand all Loading... |
108 "SetNsStatus() failed to set Ns mode"); | 107 "SetNsStatus() failed to set Ns mode"); |
109 return -1; | 108 return -1; |
110 } | 109 } |
111 if (_shared->audio_processing()->noise_suppression()->Enable(enable) != 0) { | 110 if (_shared->audio_processing()->noise_suppression()->Enable(enable) != 0) { |
112 _shared->SetLastError(VE_APM_ERROR, kTraceError, | 111 _shared->SetLastError(VE_APM_ERROR, kTraceError, |
113 "SetNsStatus() failed to set Ns state"); | 112 "SetNsStatus() failed to set Ns state"); |
114 return -1; | 113 return -1; |
115 } | 114 } |
116 | 115 |
117 return 0; | 116 return 0; |
118 #else | |
119 #error "This is deprecated" | |
120 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
121 "SetNsStatus() Ns is not supported"); | |
122 return -1; | |
123 #endif | |
124 } | 117 } |
125 | 118 |
126 int VoEAudioProcessingImpl::GetNsStatus(bool& enabled, NsModes& mode) { | 119 int VoEAudioProcessingImpl::GetNsStatus(bool& enabled, NsModes& mode) { |
127 #ifdef WEBRTC_VOICE_ENGINE_NR | |
128 if (!_shared->statistics().Initialized()) { | 120 if (!_shared->statistics().Initialized()) { |
129 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 121 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
130 return -1; | 122 return -1; |
131 } | 123 } |
132 | 124 |
133 enabled = _shared->audio_processing()->noise_suppression()->is_enabled(); | 125 enabled = _shared->audio_processing()->noise_suppression()->is_enabled(); |
134 NoiseSuppression::Level nsLevel = | 126 NoiseSuppression::Level nsLevel = |
135 _shared->audio_processing()->noise_suppression()->level(); | 127 _shared->audio_processing()->noise_suppression()->level(); |
136 | 128 |
137 switch (nsLevel) { | 129 switch (nsLevel) { |
138 case NoiseSuppression::kLow: | 130 case NoiseSuppression::kLow: |
139 mode = kNsLowSuppression; | 131 mode = kNsLowSuppression; |
140 break; | 132 break; |
141 case NoiseSuppression::kModerate: | 133 case NoiseSuppression::kModerate: |
142 mode = kNsModerateSuppression; | 134 mode = kNsModerateSuppression; |
143 break; | 135 break; |
144 case NoiseSuppression::kHigh: | 136 case NoiseSuppression::kHigh: |
145 mode = kNsHighSuppression; | 137 mode = kNsHighSuppression; |
146 break; | 138 break; |
147 case NoiseSuppression::kVeryHigh: | 139 case NoiseSuppression::kVeryHigh: |
148 mode = kNsVeryHighSuppression; | 140 mode = kNsVeryHighSuppression; |
149 break; | 141 break; |
150 } | 142 } |
151 return 0; | 143 return 0; |
152 #else | |
153 #error "This is deprecated" | |
154 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
155 "GetNsStatus() Ns is not supported"); | |
156 return -1; | |
157 #endif | |
158 } | 144 } |
159 | 145 |
160 int VoEAudioProcessingImpl::SetAgcStatus(bool enable, AgcModes mode) { | 146 int VoEAudioProcessingImpl::SetAgcStatus(bool enable, AgcModes mode) { |
161 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 147 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
162 "SetAgcStatus(enable=%d, mode=%d)", enable, mode); | 148 "SetAgcStatus(enable=%d, mode=%d)", enable, mode); |
163 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
164 if (!_shared->statistics().Initialized()) { | 149 if (!_shared->statistics().Initialized()) { |
165 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 150 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
166 return -1; | 151 return -1; |
167 } | 152 } |
168 | 153 |
169 #if defined(WEBRTC_IOS) || defined(ATA) || defined(WEBRTC_ANDROID) | 154 #if defined(WEBRTC_IOS) || defined(ATA) || defined(WEBRTC_ANDROID) |
170 if (mode == kAgcAdaptiveAnalog) { | 155 if (mode == kAgcAdaptiveAnalog) { |
171 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, | 156 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, |
172 "SetAgcStatus() invalid Agc mode for mobile device"); | 157 "SetAgcStatus() invalid Agc mode for mobile device"); |
173 return -1; | 158 return -1; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // Note that we also enable the ADM Agc when Adaptive Digital mode is | 194 // Note that we also enable the ADM Agc when Adaptive Digital mode is |
210 // used since we want to be able to provide the APM with updated mic | 195 // used since we want to be able to provide the APM with updated mic |
211 // levels when the user modifies the mic level manually. | 196 // levels when the user modifies the mic level manually. |
212 if (_shared->audio_device()->SetAGC(enable) != 0) { | 197 if (_shared->audio_device()->SetAGC(enable) != 0) { |
213 _shared->SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR, kTraceWarning, | 198 _shared->SetLastError(VE_AUDIO_DEVICE_MODULE_ERROR, kTraceWarning, |
214 "SetAgcStatus() failed to set Agc mode"); | 199 "SetAgcStatus() failed to set Agc mode"); |
215 } | 200 } |
216 } | 201 } |
217 | 202 |
218 return 0; | 203 return 0; |
219 #else | |
220 #error "This is deprecated" | |
221 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
222 "SetAgcStatus() Agc is not supported"); | |
223 return -1; | |
224 #endif | |
225 } | 204 } |
226 | 205 |
227 int VoEAudioProcessingImpl::GetAgcStatus(bool& enabled, AgcModes& mode) { | 206 int VoEAudioProcessingImpl::GetAgcStatus(bool& enabled, AgcModes& mode) { |
228 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
229 if (!_shared->statistics().Initialized()) { | 207 if (!_shared->statistics().Initialized()) { |
230 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 208 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
231 return -1; | 209 return -1; |
232 } | 210 } |
233 | 211 |
234 enabled = _shared->audio_processing()->gain_control()->is_enabled(); | 212 enabled = _shared->audio_processing()->gain_control()->is_enabled(); |
235 GainControl::Mode agcMode = | 213 GainControl::Mode agcMode = |
236 _shared->audio_processing()->gain_control()->mode(); | 214 _shared->audio_processing()->gain_control()->mode(); |
237 | 215 |
238 switch (agcMode) { | 216 switch (agcMode) { |
239 case GainControl::kFixedDigital: | 217 case GainControl::kFixedDigital: |
240 mode = kAgcFixedDigital; | 218 mode = kAgcFixedDigital; |
241 break; | 219 break; |
242 case GainControl::kAdaptiveAnalog: | 220 case GainControl::kAdaptiveAnalog: |
243 mode = kAgcAdaptiveAnalog; | 221 mode = kAgcAdaptiveAnalog; |
244 break; | 222 break; |
245 case GainControl::kAdaptiveDigital: | 223 case GainControl::kAdaptiveDigital: |
246 mode = kAgcAdaptiveDigital; | 224 mode = kAgcAdaptiveDigital; |
247 break; | 225 break; |
248 } | 226 } |
249 | 227 |
250 return 0; | 228 return 0; |
251 #else | |
252 #error "This is deprecated" | |
253 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
254 "GetAgcStatus() Agc is not supported"); | |
255 return -1; | |
256 #endif | |
257 } | 229 } |
258 | 230 |
259 int VoEAudioProcessingImpl::SetAgcConfig(AgcConfig config) { | 231 int VoEAudioProcessingImpl::SetAgcConfig(AgcConfig config) { |
260 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 232 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
261 "SetAgcConfig()"); | 233 "SetAgcConfig()"); |
262 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
263 if (!_shared->statistics().Initialized()) { | 234 if (!_shared->statistics().Initialized()) { |
264 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 235 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
265 return -1; | 236 return -1; |
266 } | 237 } |
267 | 238 |
268 if (_shared->audio_processing()->gain_control()->set_target_level_dbfs( | 239 if (_shared->audio_processing()->gain_control()->set_target_level_dbfs( |
269 config.targetLeveldBOv) != 0) { | 240 config.targetLeveldBOv) != 0) { |
270 _shared->SetLastError(VE_APM_ERROR, kTraceError, | 241 _shared->SetLastError(VE_APM_ERROR, kTraceError, |
271 "SetAgcConfig() failed to set target peak |level|" | 242 "SetAgcConfig() failed to set target peak |level|" |
272 " (or envelope) of the Agc"); | 243 " (or envelope) of the Agc"); |
273 return -1; | 244 return -1; |
274 } | 245 } |
275 if (_shared->audio_processing()->gain_control()->set_compression_gain_db( | 246 if (_shared->audio_processing()->gain_control()->set_compression_gain_db( |
276 config.digitalCompressionGaindB) != 0) { | 247 config.digitalCompressionGaindB) != 0) { |
277 _shared->SetLastError(VE_APM_ERROR, kTraceError, | 248 _shared->SetLastError(VE_APM_ERROR, kTraceError, |
278 "SetAgcConfig() failed to set the range in |gain| " | 249 "SetAgcConfig() failed to set the range in |gain| " |
279 "the digital compression stage may apply"); | 250 "the digital compression stage may apply"); |
280 return -1; | 251 return -1; |
281 } | 252 } |
282 if (_shared->audio_processing()->gain_control()->enable_limiter( | 253 if (_shared->audio_processing()->gain_control()->enable_limiter( |
283 config.limiterEnable) != 0) { | 254 config.limiterEnable) != 0) { |
284 _shared->SetLastError( | 255 _shared->SetLastError( |
285 VE_APM_ERROR, kTraceError, | 256 VE_APM_ERROR, kTraceError, |
286 "SetAgcConfig() failed to set hard limiter to the signal"); | 257 "SetAgcConfig() failed to set hard limiter to the signal"); |
287 return -1; | 258 return -1; |
288 } | 259 } |
289 | 260 |
290 return 0; | 261 return 0; |
291 #else | |
292 #error "This is deprecated" | |
293 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
294 "SetAgcConfig() EC is not supported"); | |
295 return -1; | |
296 #endif | |
297 } | 262 } |
298 | 263 |
299 int VoEAudioProcessingImpl::GetAgcConfig(AgcConfig& config) { | 264 int VoEAudioProcessingImpl::GetAgcConfig(AgcConfig& config) { |
300 #ifdef WEBRTC_VOICE_ENGINE_AGC | |
301 if (!_shared->statistics().Initialized()) { | 265 if (!_shared->statistics().Initialized()) { |
302 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 266 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
303 return -1; | 267 return -1; |
304 } | 268 } |
305 | 269 |
306 config.targetLeveldBOv = | 270 config.targetLeveldBOv = |
307 _shared->audio_processing()->gain_control()->target_level_dbfs(); | 271 _shared->audio_processing()->gain_control()->target_level_dbfs(); |
308 config.digitalCompressionGaindB = | 272 config.digitalCompressionGaindB = |
309 _shared->audio_processing()->gain_control()->compression_gain_db(); | 273 _shared->audio_processing()->gain_control()->compression_gain_db(); |
310 config.limiterEnable = | 274 config.limiterEnable = |
311 _shared->audio_processing()->gain_control()->is_limiter_enabled(); | 275 _shared->audio_processing()->gain_control()->is_limiter_enabled(); |
312 | 276 |
313 return 0; | 277 return 0; |
314 #else | |
315 #error "This is deprecated" | |
316 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
317 "GetAgcConfig() EC is not supported"); | |
318 return -1; | |
319 #endif | |
320 } | 278 } |
321 | 279 |
322 bool VoEAudioProcessing::DriftCompensationSupported() { | 280 bool VoEAudioProcessing::DriftCompensationSupported() { |
323 #if defined(WEBRTC_DRIFT_COMPENSATION_SUPPORTED) | 281 #if defined(WEBRTC_DRIFT_COMPENSATION_SUPPORTED) |
324 return true; | 282 return true; |
325 #else | 283 #else |
326 return false; | 284 return false; |
327 #endif | 285 #endif |
328 } | 286 } |
329 | 287 |
(...skipping 19 matching lines...) Expand all Loading... |
349 bool VoEAudioProcessingImpl::DriftCompensationEnabled() { | 307 bool VoEAudioProcessingImpl::DriftCompensationEnabled() { |
350 WEBRTC_VOICE_INIT_CHECK_BOOL(); | 308 WEBRTC_VOICE_INIT_CHECK_BOOL(); |
351 | 309 |
352 EchoCancellation* aec = _shared->audio_processing()->echo_cancellation(); | 310 EchoCancellation* aec = _shared->audio_processing()->echo_cancellation(); |
353 return aec->is_drift_compensation_enabled(); | 311 return aec->is_drift_compensation_enabled(); |
354 } | 312 } |
355 | 313 |
356 int VoEAudioProcessingImpl::SetEcStatus(bool enable, EcModes mode) { | 314 int VoEAudioProcessingImpl::SetEcStatus(bool enable, EcModes mode) { |
357 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 315 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
358 "SetEcStatus(enable=%d, mode=%d)", enable, mode); | 316 "SetEcStatus(enable=%d, mode=%d)", enable, mode); |
359 #ifdef WEBRTC_VOICE_ENGINE_ECHO | |
360 if (!_shared->statistics().Initialized()) { | 317 if (!_shared->statistics().Initialized()) { |
361 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 318 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
362 return -1; | 319 return -1; |
363 } | 320 } |
364 | 321 |
365 // AEC mode | 322 // AEC mode |
366 if ((mode == kEcDefault) || (mode == kEcConference) || (mode == kEcAec) || | 323 if ((mode == kEcDefault) || (mode == kEcConference) || (mode == kEcAec) || |
367 ((mode == kEcUnchanged) && (_isAecMode == true))) { | 324 ((mode == kEcUnchanged) && (_isAecMode == true))) { |
368 if (enable) { | 325 if (enable) { |
369 // Disable the AECM before enable the AEC | 326 // Disable the AECM before enable the AEC |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 return -1; | 385 return -1; |
429 } | 386 } |
430 _isAecMode = false; | 387 _isAecMode = false; |
431 } else { | 388 } else { |
432 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, | 389 _shared->SetLastError(VE_INVALID_ARGUMENT, kTraceError, |
433 "SetEcStatus() invalid EC mode"); | 390 "SetEcStatus() invalid EC mode"); |
434 return -1; | 391 return -1; |
435 } | 392 } |
436 | 393 |
437 return 0; | 394 return 0; |
438 #else | |
439 #error "This is deprecated" | |
440 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
441 "SetEcStatus() EC is not supported"); | |
442 return -1; | |
443 #endif | |
444 } | 395 } |
445 | 396 |
446 int VoEAudioProcessingImpl::GetEcStatus(bool& enabled, EcModes& mode) { | 397 int VoEAudioProcessingImpl::GetEcStatus(bool& enabled, EcModes& mode) { |
447 #ifdef WEBRTC_VOICE_ENGINE_ECHO | |
448 if (!_shared->statistics().Initialized()) { | 398 if (!_shared->statistics().Initialized()) { |
449 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 399 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
450 return -1; | 400 return -1; |
451 } | 401 } |
452 | 402 |
453 if (_isAecMode == true) { | 403 if (_isAecMode == true) { |
454 mode = kEcAec; | 404 mode = kEcAec; |
455 enabled = _shared->audio_processing()->echo_cancellation()->is_enabled(); | 405 enabled = _shared->audio_processing()->echo_cancellation()->is_enabled(); |
456 } else { | 406 } else { |
457 mode = kEcAecm; | 407 mode = kEcAecm; |
458 enabled = _shared->audio_processing()->echo_control_mobile()->is_enabled(); | 408 enabled = _shared->audio_processing()->echo_control_mobile()->is_enabled(); |
459 } | 409 } |
460 | 410 |
461 return 0; | 411 return 0; |
462 #else | |
463 #error "This is deprecated" | |
464 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
465 "GetEcStatus() EC is not supported"); | |
466 return -1; | |
467 #endif | |
468 } | 412 } |
469 | 413 |
470 void VoEAudioProcessingImpl::SetDelayOffsetMs(int offset) { | 414 void VoEAudioProcessingImpl::SetDelayOffsetMs(int offset) { |
471 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 415 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
472 "SetDelayOffsetMs(offset = %d)", offset); | 416 "SetDelayOffsetMs(offset = %d)", offset); |
473 _shared->audio_processing()->set_delay_offset_ms(offset); | 417 _shared->audio_processing()->set_delay_offset_ms(offset); |
474 } | 418 } |
475 | 419 |
476 int VoEAudioProcessingImpl::DelayOffsetMs() { | 420 int VoEAudioProcessingImpl::DelayOffsetMs() { |
477 return _shared->audio_processing()->delay_offset_ms(); | 421 return _shared->audio_processing()->delay_offset_ms(); |
478 } | 422 } |
479 | 423 |
480 int VoEAudioProcessingImpl::SetAecmMode(AecmModes mode, bool enableCNG) { | 424 int VoEAudioProcessingImpl::SetAecmMode(AecmModes mode, bool enableCNG) { |
481 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 425 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
482 "SetAECMMode(mode = %d)", mode); | 426 "SetAECMMode(mode = %d)", mode); |
483 #ifdef WEBRTC_VOICE_ENGINE_ECHO | |
484 if (!_shared->statistics().Initialized()) { | 427 if (!_shared->statistics().Initialized()) { |
485 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 428 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
486 return -1; | 429 return -1; |
487 } | 430 } |
488 | 431 |
489 EchoControlMobile::RoutingMode aecmMode( | 432 EchoControlMobile::RoutingMode aecmMode( |
490 EchoControlMobile::kQuietEarpieceOrHeadset); | 433 EchoControlMobile::kQuietEarpieceOrHeadset); |
491 | 434 |
492 switch (mode) { | 435 switch (mode) { |
493 case kAecmQuietEarpieceOrHeadset: | 436 case kAecmQuietEarpieceOrHeadset: |
(...skipping 21 matching lines...) Expand all Loading... |
515 } | 458 } |
516 if (_shared->audio_processing()->echo_control_mobile()->enable_comfort_noise( | 459 if (_shared->audio_processing()->echo_control_mobile()->enable_comfort_noise( |
517 enableCNG) != 0) { | 460 enableCNG) != 0) { |
518 _shared->SetLastError( | 461 _shared->SetLastError( |
519 VE_APM_ERROR, kTraceError, | 462 VE_APM_ERROR, kTraceError, |
520 "SetAECMMode() failed to set comfort noise state for AECM"); | 463 "SetAECMMode() failed to set comfort noise state for AECM"); |
521 return -1; | 464 return -1; |
522 } | 465 } |
523 | 466 |
524 return 0; | 467 return 0; |
525 #else | |
526 #error "This is deprecated" | |
527 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
528 "SetAECMMode() EC is not supported"); | |
529 return -1; | |
530 #endif | |
531 } | 468 } |
532 | 469 |
533 int VoEAudioProcessingImpl::GetAecmMode(AecmModes& mode, bool& enabledCNG) { | 470 int VoEAudioProcessingImpl::GetAecmMode(AecmModes& mode, bool& enabledCNG) { |
534 #ifdef WEBRTC_VOICE_ENGINE_ECHO | |
535 if (!_shared->statistics().Initialized()) { | 471 if (!_shared->statistics().Initialized()) { |
536 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 472 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
537 return -1; | 473 return -1; |
538 } | 474 } |
539 | 475 |
540 enabledCNG = false; | 476 enabledCNG = false; |
541 | 477 |
542 EchoControlMobile::RoutingMode aecmMode = | 478 EchoControlMobile::RoutingMode aecmMode = |
543 _shared->audio_processing()->echo_control_mobile()->routing_mode(); | 479 _shared->audio_processing()->echo_control_mobile()->routing_mode(); |
544 enabledCNG = _shared->audio_processing() | 480 enabledCNG = _shared->audio_processing() |
(...skipping 12 matching lines...) Expand all Loading... |
557 break; | 493 break; |
558 case EchoControlMobile::kSpeakerphone: | 494 case EchoControlMobile::kSpeakerphone: |
559 mode = kAecmSpeakerphone; | 495 mode = kAecmSpeakerphone; |
560 break; | 496 break; |
561 case EchoControlMobile::kLoudSpeakerphone: | 497 case EchoControlMobile::kLoudSpeakerphone: |
562 mode = kAecmLoudSpeakerphone; | 498 mode = kAecmLoudSpeakerphone; |
563 break; | 499 break; |
564 } | 500 } |
565 | 501 |
566 return 0; | 502 return 0; |
567 #else | |
568 #error "This is deprecated" | |
569 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
570 "GetAECMMode() EC is not supported"); | |
571 return -1; | |
572 #endif | |
573 } | 503 } |
574 | 504 |
575 int VoEAudioProcessingImpl::EnableHighPassFilter(bool enable) { | 505 int VoEAudioProcessingImpl::EnableHighPassFilter(bool enable) { |
576 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 506 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
577 "EnableHighPassFilter(%d)", enable); | 507 "EnableHighPassFilter(%d)", enable); |
578 if (_shared->audio_processing()->high_pass_filter()->Enable(enable) != | 508 if (_shared->audio_processing()->high_pass_filter()->Enable(enable) != |
579 AudioProcessing::kNoError) { | 509 AudioProcessing::kNoError) { |
580 _shared->SetLastError(VE_APM_ERROR, kTraceError, | 510 _shared->SetLastError(VE_APM_ERROR, kTraceError, |
581 "HighPassFilter::Enable() failed."); | 511 "HighPassFilter::Enable() failed."); |
582 return -1; | 512 return -1; |
(...skipping 23 matching lines...) Expand all Loading... |
606 } | 536 } |
607 int activity(-1); | 537 int activity(-1); |
608 channelPtr->VoiceActivityIndicator(activity); | 538 channelPtr->VoiceActivityIndicator(activity); |
609 | 539 |
610 return activity; | 540 return activity; |
611 } | 541 } |
612 | 542 |
613 int VoEAudioProcessingImpl::SetEcMetricsStatus(bool enable) { | 543 int VoEAudioProcessingImpl::SetEcMetricsStatus(bool enable) { |
614 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 544 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
615 "SetEcMetricsStatus(enable=%d)", enable); | 545 "SetEcMetricsStatus(enable=%d)", enable); |
616 #ifdef WEBRTC_VOICE_ENGINE_ECHO | |
617 if (!_shared->statistics().Initialized()) { | 546 if (!_shared->statistics().Initialized()) { |
618 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 547 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
619 return -1; | 548 return -1; |
620 } | 549 } |
621 | 550 |
622 if ((_shared->audio_processing()->echo_cancellation()->enable_metrics( | 551 if ((_shared->audio_processing()->echo_cancellation()->enable_metrics( |
623 enable) != 0) || | 552 enable) != 0) || |
624 (_shared->audio_processing()->echo_cancellation()->enable_delay_logging( | 553 (_shared->audio_processing()->echo_cancellation()->enable_delay_logging( |
625 enable) != 0)) { | 554 enable) != 0)) { |
626 _shared->SetLastError(VE_APM_ERROR, kTraceError, | 555 _shared->SetLastError(VE_APM_ERROR, kTraceError, |
627 "SetEcMetricsStatus() unable to set EC metrics mode"); | 556 "SetEcMetricsStatus() unable to set EC metrics mode"); |
628 return -1; | 557 return -1; |
629 } | 558 } |
630 return 0; | 559 return 0; |
631 #else | |
632 #error "This is deprecated" | |
633 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
634 "SetEcStatus() EC is not supported"); | |
635 return -1; | |
636 #endif | |
637 } | 560 } |
638 | 561 |
639 int VoEAudioProcessingImpl::GetEcMetricsStatus(bool& enabled) { | 562 int VoEAudioProcessingImpl::GetEcMetricsStatus(bool& enabled) { |
640 #ifdef WEBRTC_VOICE_ENGINE_ECHO | |
641 if (!_shared->statistics().Initialized()) { | 563 if (!_shared->statistics().Initialized()) { |
642 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 564 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
643 return -1; | 565 return -1; |
644 } | 566 } |
645 | 567 |
646 bool echo_mode = | 568 bool echo_mode = |
647 _shared->audio_processing()->echo_cancellation()->are_metrics_enabled(); | 569 _shared->audio_processing()->echo_cancellation()->are_metrics_enabled(); |
648 bool delay_mode = _shared->audio_processing() | 570 bool delay_mode = _shared->audio_processing() |
649 ->echo_cancellation() | 571 ->echo_cancellation() |
650 ->is_delay_logging_enabled(); | 572 ->is_delay_logging_enabled(); |
651 | 573 |
652 if (echo_mode != delay_mode) { | 574 if (echo_mode != delay_mode) { |
653 _shared->SetLastError( | 575 _shared->SetLastError( |
654 VE_APM_ERROR, kTraceError, | 576 VE_APM_ERROR, kTraceError, |
655 "GetEcMetricsStatus() delay logging and echo mode are not the same"); | 577 "GetEcMetricsStatus() delay logging and echo mode are not the same"); |
656 return -1; | 578 return -1; |
657 } | 579 } |
658 | 580 |
659 enabled = echo_mode; | 581 enabled = echo_mode; |
660 | 582 |
661 return 0; | 583 return 0; |
662 #else | |
663 #error "This is deprecated" | |
664 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
665 "SetEcStatus() EC is not supported"); | |
666 return -1; | |
667 #endif | |
668 } | 584 } |
669 | 585 |
670 int VoEAudioProcessingImpl::GetEchoMetrics(int& ERL, | 586 int VoEAudioProcessingImpl::GetEchoMetrics(int& ERL, |
671 int& ERLE, | 587 int& ERLE, |
672 int& RERL, | 588 int& RERL, |
673 int& A_NLP) { | 589 int& A_NLP) { |
674 #ifdef WEBRTC_VOICE_ENGINE_ECHO | |
675 if (!_shared->statistics().Initialized()) { | 590 if (!_shared->statistics().Initialized()) { |
676 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 591 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
677 return -1; | 592 return -1; |
678 } | 593 } |
679 if (!_shared->audio_processing()->echo_cancellation()->is_enabled()) { | 594 if (!_shared->audio_processing()->echo_cancellation()->is_enabled()) { |
680 _shared->SetLastError( | 595 _shared->SetLastError( |
681 VE_APM_ERROR, kTraceWarning, | 596 VE_APM_ERROR, kTraceWarning, |
682 "GetEchoMetrics() AudioProcessingModule AEC is not enabled"); | 597 "GetEchoMetrics() AudioProcessingModule AEC is not enabled"); |
683 return -1; | 598 return -1; |
684 } | 599 } |
685 | 600 |
686 // Get Echo Metrics from Audio Processing Module. | 601 // Get Echo Metrics from Audio Processing Module. |
687 EchoCancellation::Metrics echoMetrics; | 602 EchoCancellation::Metrics echoMetrics; |
688 if (_shared->audio_processing()->echo_cancellation()->GetMetrics( | 603 if (_shared->audio_processing()->echo_cancellation()->GetMetrics( |
689 &echoMetrics)) { | 604 &echoMetrics)) { |
690 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), | 605 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), |
691 "GetEchoMetrics(), AudioProcessingModule metrics error"); | 606 "GetEchoMetrics(), AudioProcessingModule metrics error"); |
692 return -1; | 607 return -1; |
693 } | 608 } |
694 | 609 |
695 // Echo quality metrics. | 610 // Echo quality metrics. |
696 ERL = echoMetrics.echo_return_loss.instant; | 611 ERL = echoMetrics.echo_return_loss.instant; |
697 ERLE = echoMetrics.echo_return_loss_enhancement.instant; | 612 ERLE = echoMetrics.echo_return_loss_enhancement.instant; |
698 RERL = echoMetrics.residual_echo_return_loss.instant; | 613 RERL = echoMetrics.residual_echo_return_loss.instant; |
699 A_NLP = echoMetrics.a_nlp.instant; | 614 A_NLP = echoMetrics.a_nlp.instant; |
700 | 615 |
701 return 0; | 616 return 0; |
702 #else | |
703 #error "This is deprecated" | |
704 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
705 "SetEcStatus() EC is not supported"); | |
706 return -1; | |
707 #endif | |
708 } | 617 } |
709 | 618 |
710 int VoEAudioProcessingImpl::GetEcDelayMetrics(int& delay_median, | 619 int VoEAudioProcessingImpl::GetEcDelayMetrics(int& delay_median, |
711 int& delay_std, | 620 int& delay_std, |
712 float& fraction_poor_delays) { | 621 float& fraction_poor_delays) { |
713 #ifdef WEBRTC_VOICE_ENGINE_ECHO | |
714 if (!_shared->statistics().Initialized()) { | 622 if (!_shared->statistics().Initialized()) { |
715 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 623 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
716 return -1; | 624 return -1; |
717 } | 625 } |
718 if (!_shared->audio_processing()->echo_cancellation()->is_enabled()) { | 626 if (!_shared->audio_processing()->echo_cancellation()->is_enabled()) { |
719 _shared->SetLastError( | 627 _shared->SetLastError( |
720 VE_APM_ERROR, kTraceWarning, | 628 VE_APM_ERROR, kTraceWarning, |
721 "GetEcDelayMetrics() AudioProcessingModule AEC is not enabled"); | 629 "GetEcDelayMetrics() AudioProcessingModule AEC is not enabled"); |
722 return -1; | 630 return -1; |
723 } | 631 } |
724 | 632 |
725 int median = 0; | 633 int median = 0; |
726 int std = 0; | 634 int std = 0; |
727 float poor_fraction = 0; | 635 float poor_fraction = 0; |
728 // Get delay-logging values from Audio Processing Module. | 636 // Get delay-logging values from Audio Processing Module. |
729 if (_shared->audio_processing()->echo_cancellation()->GetDelayMetrics( | 637 if (_shared->audio_processing()->echo_cancellation()->GetDelayMetrics( |
730 &median, &std, &poor_fraction)) { | 638 &median, &std, &poor_fraction)) { |
731 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), | 639 WEBRTC_TRACE(kTraceError, kTraceVoice, VoEId(_shared->instance_id(), -1), |
732 "GetEcDelayMetrics(), AudioProcessingModule delay-logging " | 640 "GetEcDelayMetrics(), AudioProcessingModule delay-logging " |
733 "error"); | 641 "error"); |
734 return -1; | 642 return -1; |
735 } | 643 } |
736 | 644 |
737 // EC delay-logging metrics | 645 // EC delay-logging metrics |
738 delay_median = median; | 646 delay_median = median; |
739 delay_std = std; | 647 delay_std = std; |
740 fraction_poor_delays = poor_fraction; | 648 fraction_poor_delays = poor_fraction; |
741 | 649 |
742 return 0; | 650 return 0; |
743 #else | |
744 #error "This is deprecated" | |
745 _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceError, | |
746 "SetEcStatus() EC is not supported"); | |
747 return -1; | |
748 #endif | |
749 } | 651 } |
750 | 652 |
751 int VoEAudioProcessingImpl::StartDebugRecording(const char* fileNameUTF8) { | 653 int VoEAudioProcessingImpl::StartDebugRecording(const char* fileNameUTF8) { |
752 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), | 654 WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), |
753 "StartDebugRecording()"); | 655 "StartDebugRecording()"); |
754 if (!_shared->statistics().Initialized()) { | 656 if (!_shared->statistics().Initialized()) { |
755 _shared->SetLastError(VE_NOT_INITED, kTraceError); | 657 _shared->SetLastError(VE_NOT_INITED, kTraceError); |
756 return -1; | 658 return -1; |
757 } | 659 } |
758 | 660 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 _shared->transmit_mixer()->EnableStereoChannelSwapping(enable); | 772 _shared->transmit_mixer()->EnableStereoChannelSwapping(enable); |
871 } | 773 } |
872 | 774 |
873 bool VoEAudioProcessingImpl::IsStereoChannelSwappingEnabled() { | 775 bool VoEAudioProcessingImpl::IsStereoChannelSwappingEnabled() { |
874 return _shared->transmit_mixer()->IsStereoChannelSwappingEnabled(); | 776 return _shared->transmit_mixer()->IsStereoChannelSwappingEnabled(); |
875 } | 777 } |
876 | 778 |
877 #endif // #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API | 779 #endif // #ifdef WEBRTC_VOICE_ENGINE_AUDIO_PROCESSING_API |
878 | 780 |
879 } // namespace webrtc | 781 } // namespace webrtc |
OLD | NEW |