OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 } | 525 } |
526 webrtc::Trace::set_level_filter(kDefaultTraceFilter); | 526 webrtc::Trace::set_level_filter(kDefaultTraceFilter); |
527 | 527 |
528 // Save the default AGC configuration settings. This must happen before | 528 // Save the default AGC configuration settings. This must happen before |
529 // calling ApplyOptions or the default will be overwritten. | 529 // calling ApplyOptions or the default will be overwritten. |
530 if (voe_wrapper_->processing()->GetAgcConfig(default_agc_config_) == -1) { | 530 if (voe_wrapper_->processing()->GetAgcConfig(default_agc_config_) == -1) { |
531 LOG_RTCERR0(GetAgcConfig); | 531 LOG_RTCERR0(GetAgcConfig); |
532 return false; | 532 return false; |
533 } | 533 } |
534 | 534 |
| 535 // Set default engine options. |
| 536 { |
| 537 AudioOptions options; |
| 538 options.echo_cancellation = rtc::Optional<bool>(true); |
| 539 options.auto_gain_control = rtc::Optional<bool>(true); |
| 540 options.noise_suppression = rtc::Optional<bool>(true); |
| 541 options.highpass_filter = rtc::Optional<bool>(true); |
| 542 options.stereo_swapping = rtc::Optional<bool>(false); |
| 543 options.audio_jitter_buffer_max_packets = rtc::Optional<int>(50); |
| 544 options.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>(false); |
| 545 options.typing_detection = rtc::Optional<bool>(true); |
| 546 options.adjust_agc_delta = rtc::Optional<int>(0); |
| 547 options.experimental_agc = rtc::Optional<bool>(false); |
| 548 options.extended_filter_aec = rtc::Optional<bool>(false); |
| 549 options.delay_agnostic_aec = rtc::Optional<bool>(false); |
| 550 options.experimental_ns = rtc::Optional<bool>(false); |
| 551 options.aec_dump = rtc::Optional<bool>(false); |
| 552 if (!ApplyOptions(options)) { |
| 553 return false; |
| 554 } |
| 555 } |
| 556 |
535 // Print our codec list again for the call diagnostic log | 557 // Print our codec list again for the call diagnostic log |
536 LOG(LS_INFO) << "WebRtc VoiceEngine codecs:"; | 558 LOG(LS_INFO) << "WebRtc VoiceEngine codecs:"; |
537 for (const AudioCodec& codec : codecs_) { | 559 for (const AudioCodec& codec : codecs_) { |
538 LOG(LS_INFO) << ToString(codec); | 560 LOG(LS_INFO) << ToString(codec); |
539 } | 561 } |
540 | 562 |
541 SetDefaultDevices(); | 563 SetDefaultDevices(); |
542 | 564 |
543 initialized_ = true; | 565 initialized_ = true; |
544 return true; | 566 return true; |
(...skipping 17 matching lines...) Expand all Loading... |
562 | 584 |
563 VoiceMediaChannel* WebRtcVoiceEngine::CreateChannel(webrtc::Call* call, | 585 VoiceMediaChannel* WebRtcVoiceEngine::CreateChannel(webrtc::Call* call, |
564 const AudioOptions& options) { | 586 const AudioOptions& options) { |
565 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 587 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
566 return new WebRtcVoiceMediaChannel(this, options, call); | 588 return new WebRtcVoiceMediaChannel(this, options, call); |
567 } | 589 } |
568 | 590 |
569 bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { | 591 bool WebRtcVoiceEngine::ApplyOptions(const AudioOptions& options_in) { |
570 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 592 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
571 LOG(LS_INFO) << "ApplyOptions: " << options_in.ToString(); | 593 LOG(LS_INFO) << "ApplyOptions: " << options_in.ToString(); |
572 | 594 AudioOptions options = options_in; // The options are modified below. |
573 // Default engine options. | |
574 AudioOptions options; | |
575 options.echo_cancellation = rtc::Optional<bool>(true); | |
576 options.auto_gain_control = rtc::Optional<bool>(true); | |
577 options.noise_suppression = rtc::Optional<bool>(true); | |
578 options.highpass_filter = rtc::Optional<bool>(true); | |
579 options.stereo_swapping = rtc::Optional<bool>(false); | |
580 options.audio_jitter_buffer_max_packets = rtc::Optional<int>(50); | |
581 options.audio_jitter_buffer_fast_accelerate = rtc::Optional<bool>(false); | |
582 options.typing_detection = rtc::Optional<bool>(true); | |
583 options.adjust_agc_delta = rtc::Optional<int>(0); | |
584 options.experimental_agc = rtc::Optional<bool>(false); | |
585 options.extended_filter_aec = rtc::Optional<bool>(false); | |
586 options.delay_agnostic_aec = rtc::Optional<bool>(false); | |
587 options.experimental_ns = rtc::Optional<bool>(false); | |
588 options.aec_dump = rtc::Optional<bool>(false); | |
589 | |
590 // Apply any given options on top. | |
591 options.SetAll(options_in); | |
592 | 595 |
593 // kEcConference is AEC with high suppression. | 596 // kEcConference is AEC with high suppression. |
594 webrtc::EcModes ec_mode = webrtc::kEcConference; | 597 webrtc::EcModes ec_mode = webrtc::kEcConference; |
595 webrtc::AecmModes aecm_mode = webrtc::kAecmSpeakerphone; | 598 webrtc::AecmModes aecm_mode = webrtc::kAecmSpeakerphone; |
596 webrtc::AgcModes agc_mode = webrtc::kAgcAdaptiveAnalog; | 599 webrtc::AgcModes agc_mode = webrtc::kAgcAdaptiveAnalog; |
597 webrtc::NsModes ns_mode = webrtc::kNsHighSuppression; | 600 webrtc::NsModes ns_mode = webrtc::kNsHighSuppression; |
598 if (options.aecm_generate_comfort_noise) { | 601 if (options.aecm_generate_comfort_noise) { |
599 LOG(LS_VERBOSE) << "Comfort noise explicitly set to " | 602 LOG(LS_VERBOSE) << "Comfort noise explicitly set to " |
600 << *options.aecm_generate_comfort_noise | 603 << *options.aecm_generate_comfort_noise |
601 << " (default is false)."; | 604 << " (default is false)."; |
(...skipping 1898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 } | 2503 } |
2501 } else { | 2504 } else { |
2502 LOG(LS_INFO) << "Stopping playout for channel #" << channel; | 2505 LOG(LS_INFO) << "Stopping playout for channel #" << channel; |
2503 engine()->voe()->base()->StopPlayout(channel); | 2506 engine()->voe()->base()->StopPlayout(channel); |
2504 } | 2507 } |
2505 return true; | 2508 return true; |
2506 } | 2509 } |
2507 } // namespace cricket | 2510 } // namespace cricket |
2508 | 2511 |
2509 #endif // HAVE_WEBRTC_VOICE | 2512 #endif // HAVE_WEBRTC_VOICE |
OLD | NEW |