Chromium Code Reviews| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 273 // voe_codec.channels to 2 if "stereo=1" and 1 otherwise. If | 273 // voe_codec.channels to 2 if "stereo=1" and 1 otherwise. If |
| 274 // the bitrate is not specified, i.e. is <= zero, we set it to the | 274 // the bitrate is not specified, i.e. is <= zero, we set it to the |
| 275 // appropriate default value for mono or stereo Opus. | 275 // appropriate default value for mono or stereo Opus. |
| 276 voe_codec->channels = IsCodecFeatureEnabled(codec, kCodecParamStereo) ? 2 : 1; | 276 voe_codec->channels = IsCodecFeatureEnabled(codec, kCodecParamStereo) ? 2 : 1; |
| 277 voe_codec->rate = GetOpusBitrate(codec, *max_playback_rate); | 277 voe_codec->rate = GetOpusBitrate(codec, *max_playback_rate); |
| 278 } | 278 } |
| 279 | 279 |
| 280 webrtc::AudioState::Config MakeAudioStateConfig(VoEWrapper* voe_wrapper) { | 280 webrtc::AudioState::Config MakeAudioStateConfig(VoEWrapper* voe_wrapper) { |
| 281 webrtc::AudioState::Config config; | 281 webrtc::AudioState::Config config; |
| 282 config.voice_engine = voe_wrapper->engine(); | 282 config.voice_engine = voe_wrapper->engine(); |
| 283 config.audio_mixer = webrtc::AudioMixerImpl::Create(); | 283 if (voe_wrapper->AudioMixer()) |
|
aleloi
2016/12/05 14:03:08
Please use brackets for one-line blocks consistent
GeorgeZ
2016/12/05 17:56:18
Done.
| |
| 284 config.audio_mixer = voe_wrapper->AudioMixer(); | |
| 285 else | |
| 286 config.audio_mixer = webrtc::AudioMixerImpl::Create(); | |
| 284 return config; | 287 return config; |
| 285 } | 288 } |
| 286 | 289 |
| 287 class WebRtcVoiceCodecs final { | 290 class WebRtcVoiceCodecs final { |
| 288 public: | 291 public: |
| 289 // TODO(solenberg): Do this filtering once off-line, add a simple AudioCodec | 292 // TODO(solenberg): Do this filtering once off-line, add a simple AudioCodec |
| 290 // list and add a test which verifies VoE supports the listed codecs. | 293 // list and add a test which verifies VoE supports the listed codecs. |
| 291 static std::vector<AudioCodec> SupportedSendCodecs() { | 294 static std::vector<AudioCodec> SupportedSendCodecs() { |
| 292 std::vector<AudioCodec> result; | 295 std::vector<AudioCodec> result; |
| 293 // Iterate first over our preferred codecs list, so that the results are | 296 // Iterate first over our preferred codecs list, so that the results are |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 533 | 536 |
| 534 } // namespace { | 537 } // namespace { |
| 535 | 538 |
| 536 bool WebRtcVoiceEngine::ToCodecInst(const AudioCodec& in, | 539 bool WebRtcVoiceEngine::ToCodecInst(const AudioCodec& in, |
| 537 webrtc::CodecInst* out) { | 540 webrtc::CodecInst* out) { |
| 538 return WebRtcVoiceCodecs::ToCodecInst(in, out); | 541 return WebRtcVoiceCodecs::ToCodecInst(in, out); |
| 539 } | 542 } |
| 540 | 543 |
| 541 WebRtcVoiceEngine::WebRtcVoiceEngine( | 544 WebRtcVoiceEngine::WebRtcVoiceEngine( |
| 542 webrtc::AudioDeviceModule* adm, | 545 webrtc::AudioDeviceModule* adm, |
| 543 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory) | 546 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
| 544 : WebRtcVoiceEngine(adm, decoder_factory, new VoEWrapper()) { | 547 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer) |
| 548 : WebRtcVoiceEngine(adm, | |
| 549 decoder_factory, | |
| 550 audio_mixer, | |
| 551 new VoEWrapper(audio_mixer)) { | |
| 545 audio_state_ = webrtc::AudioState::Create(MakeAudioStateConfig(voe())); | 552 audio_state_ = webrtc::AudioState::Create(MakeAudioStateConfig(voe())); |
| 546 } | 553 } |
| 547 | 554 |
| 548 WebRtcVoiceEngine::WebRtcVoiceEngine( | 555 WebRtcVoiceEngine::WebRtcVoiceEngine( |
| 549 webrtc::AudioDeviceModule* adm, | 556 webrtc::AudioDeviceModule* adm, |
| 550 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, | 557 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, |
| 558 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer, | |
| 551 VoEWrapper* voe_wrapper) | 559 VoEWrapper* voe_wrapper) |
| 552 : adm_(adm), decoder_factory_(decoder_factory), voe_wrapper_(voe_wrapper) { | 560 : adm_(adm), decoder_factory_(decoder_factory), voe_wrapper_(voe_wrapper) { |
| 553 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 561 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 554 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; | 562 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; |
| 555 RTC_DCHECK(voe_wrapper); | 563 RTC_DCHECK(voe_wrapper); |
| 556 RTC_DCHECK(decoder_factory); | 564 RTC_DCHECK(decoder_factory); |
| 557 | 565 |
| 558 signal_thread_checker_.DetachFromThread(); | 566 signal_thread_checker_.DetachFromThread(); |
| 559 | 567 |
| 560 // Load our audio codec list. | 568 // Load our audio codec list. |
| (...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2638 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); | 2646 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); |
| 2639 const auto it = send_streams_.find(ssrc); | 2647 const auto it = send_streams_.find(ssrc); |
| 2640 if (it != send_streams_.end()) { | 2648 if (it != send_streams_.end()) { |
| 2641 return it->second->channel(); | 2649 return it->second->channel(); |
| 2642 } | 2650 } |
| 2643 return -1; | 2651 return -1; |
| 2644 } | 2652 } |
| 2645 } // namespace cricket | 2653 } // namespace cricket |
| 2646 | 2654 |
| 2647 #endif // HAVE_WEBRTC_VOICE | 2655 #endif // HAVE_WEBRTC_VOICE |
| OLD | NEW |