OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2004 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2004 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 const AudioOptions& options) { | 329 const AudioOptions& options) { |
330 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 330 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
331 return new WebRtcVoiceMediaChannel(this, config, options, call); | 331 return new WebRtcVoiceMediaChannel(this, config, options, call); |
332 } | 332 } |
333 | 333 |
334 bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { | 334 bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { |
335 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 335 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
336 LOG(LS_INFO) << "WebRtcVoiceEngine::ApplyOptions: " << options_in.ToString(); | 336 LOG(LS_INFO) << "WebRtcVoiceEngine::ApplyOptions: " << options_in.ToString(); |
337 AudioOptions options = options_in; // The options are modified below. | 337 AudioOptions options = options_in; // The options are modified below. |
338 | 338 |
339 // Set and adjust echo canceller options. | |
339 // kEcConference is AEC with high suppression. | 340 // kEcConference is AEC with high suppression. |
340 webrtc::EcModes ec_mode = webrtc::kEcConference; | 341 webrtc::EcModes ec_mode = webrtc::kEcConference; |
341 if (options.aecm_generate_comfort_noise) { | 342 if (options.aecm_generate_comfort_noise) { |
342 LOG(LS_VERBOSE) << "Comfort noise explicitly set to " | 343 LOG(LS_VERBOSE) << "Comfort noise explicitly set to " |
343 << *options.aecm_generate_comfort_noise | 344 << *options.aecm_generate_comfort_noise |
344 << " (default is false)."; | 345 << " (default is false)."; |
345 } | 346 } |
346 | 347 |
347 #if defined(WEBRTC_IOS) | 348 #if defined(WEBRTC_IOS) |
348 // On iOS, VPIO provides built-in EC, NS and AGC. | 349 // On iOS, VPIO provides built-in EC. |
349 options.echo_cancellation = rtc::Optional<bool>(false); | 350 options.echo_cancellation = rtc::Optional<bool>(false); |
350 options.auto_gain_control = rtc::Optional<bool>(false); | 351 options.extended_filter_aec = rtc::Optional<bool>(false); |
351 options.noise_suppression = rtc::Optional<bool>(false); | 352 LOG(LS_INFO) << "Always disable AEC on iOS. Use built-in instead."; |
352 LOG(LS_INFO) | |
353 << "Always disable AEC, NS and AGC on iOS. Use built-in instead."; | |
354 #elif defined(ANDROID) | 353 #elif defined(ANDROID) |
355 ec_mode = webrtc::kEcAecm; | 354 ec_mode = webrtc::kEcAecm; |
356 #endif | |
357 | |
358 #if defined(WEBRTC_IOS) || defined(ANDROID) | |
359 options.typing_detection = rtc::Optional<bool>(false); | |
360 options.experimental_agc = rtc::Optional<bool>(false); | |
361 options.extended_filter_aec = rtc::Optional<bool>(false); | 355 options.extended_filter_aec = rtc::Optional<bool>(false); |
362 options.experimental_ns = rtc::Optional<bool>(false); | |
363 #endif | 356 #endif |
364 | 357 |
365 // Delay Agnostic AEC automatically turns on EC if not set except on iOS | 358 // Delay Agnostic AEC automatically turns on EC if not set except on iOS |
366 // where the feature is not supported. | 359 // where the feature is not supported. |
367 bool use_delay_agnostic_aec = false; | 360 bool use_delay_agnostic_aec = false; |
368 #if !defined(WEBRTC_IOS) | 361 #if !defined(WEBRTC_IOS) |
369 if (options.delay_agnostic_aec) { | 362 if (options.delay_agnostic_aec) { |
370 use_delay_agnostic_aec = *options.delay_agnostic_aec; | 363 use_delay_agnostic_aec = *options.delay_agnostic_aec; |
371 if (use_delay_agnostic_aec) { | 364 if (use_delay_agnostic_aec) { |
372 options.echo_cancellation = rtc::Optional<bool>(true); | 365 options.echo_cancellation = rtc::Optional<bool>(true); |
373 options.extended_filter_aec = rtc::Optional<bool>(true); | 366 options.extended_filter_aec = rtc::Optional<bool>(true); |
374 ec_mode = webrtc::kEcConference; | 367 ec_mode = webrtc::kEcConference; |
375 } | 368 } |
376 } | 369 } |
377 #endif | 370 #endif |
378 | 371 |
372 // Set and adjust noise suppressor options. | |
henrika_webrtc
2017/05/12 09:27:31
It is not clear to me what you change here. Is it
peah-webrtc
2017/05/12 09:54:07
The actual changes related to the field trial are
henrika_webrtc
2017/05/17 07:32:59
The new code looks less bad ;-)
peah-webrtc
2017/05/22 21:47:19
:-) That is a step in the right direction.
| |
373 #if defined(WEBRTC_IOS) | |
374 // On iOS, VPIO provides built-in NS. | |
375 options.noise_suppression = rtc::Optional<bool>(false); | |
376 options.typing_detection = rtc::Optional<bool>(false); | |
377 options.experimental_ns = rtc::Optional<bool>(false); | |
378 LOG(LS_INFO) << "Always disable NS on iOS. Use built-in instead."; | |
379 #elif defined(ANDROID) | |
380 options.typing_detection = rtc::Optional<bool>(false); | |
381 options.experimental_ns = rtc::Optional<bool>(false); | |
382 #endif | |
383 | |
384 // Set and adjust gain control options. | |
385 #if defined(WEBRTC_IOS) | |
386 // On iOS, VPIO provides built-in AGC. | |
387 options.auto_gain_control = rtc::Optional<bool>(false); | |
388 options.experimental_agc = rtc::Optional<bool>(false); | |
389 LOG(LS_INFO) << "Always disable AGC on iOS. Use built-in instead."; | |
390 #elif defined(ANDROID) | |
391 options.experimental_agc = rtc::Optional<bool>(false); | |
392 #endif | |
393 | |
394 #if defined(WEBRTC_IOS) || defined(WEBRTC_ANDROID) | |
henrika_webrtc
2017/05/12 12:20:47
Please add some comments here about what you inten
peah-webrtc
2017/05/22 21:47:19
Done.
| |
395 // Turn off the gain control if specified by the field trial. | |
396 if (webrtc::field_trial::IsEnabled( | |
397 "WebRTC-Audio-MinimizeResamplingOnMobile")) { | |
398 options.auto_gain_control = rtc::Optional<bool>(false); | |
399 LOG(LS_INFO) << "Disable AGC according to field trial."; | |
400 if (!(options.noise_suppression.value_or(false) or | |
401 options.echo_cancellation.value_or(false))) { | |
402 // If possible, turn off the high-pass filter. | |
403 LOG(LS_INFO) << "Disable high-pass filter in response to field trial."; | |
404 options.highpass_filter = rtc::Optional<bool>(false); | |
405 } | |
406 } | |
407 #endif | |
408 | |
379 #if (WEBRTC_INTELLIGIBILITY_ENHANCER == 0) | 409 #if (WEBRTC_INTELLIGIBILITY_ENHANCER == 0) |
380 // Hardcode the intelligibility enhancer to be off. | 410 // Hardcode the intelligibility enhancer to be off. |
381 options.intelligibility_enhancer = rtc::Optional<bool>(false); | 411 options.intelligibility_enhancer = rtc::Optional<bool>(false); |
382 #endif | 412 #endif |
383 | 413 |
384 if (options.echo_cancellation) { | 414 if (options.echo_cancellation) { |
385 // Check if platform supports built-in EC. Currently only supported on | 415 // Check if platform supports built-in EC. Currently only supported on |
386 // Android and in combination with Java based audio layer. | 416 // Android and in combination with Java based audio layer. |
387 // TODO(henrika): investigate possibility to support built-in EC also | 417 // TODO(henrika): investigate possibility to support built-in EC also |
388 // in combination with Open SL ES audio. | 418 // in combination with Open SL ES audio. |
(...skipping 1938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2327 ssrc); | 2357 ssrc); |
2328 if (it != unsignaled_recv_ssrcs_.end()) { | 2358 if (it != unsignaled_recv_ssrcs_.end()) { |
2329 unsignaled_recv_ssrcs_.erase(it); | 2359 unsignaled_recv_ssrcs_.erase(it); |
2330 return true; | 2360 return true; |
2331 } | 2361 } |
2332 return false; | 2362 return false; |
2333 } | 2363 } |
2334 } // namespace cricket | 2364 } // namespace cricket |
2335 | 2365 |
2336 #endif // HAVE_WEBRTC_VOICE | 2366 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |