Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: webrtc/media/engine/webrtcvoiceengine.cc

Issue 2562333003: Revert of Support external audio mixer. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 // If OPUS, change what we send according to the "stereo" codec 271 // If OPUS, change what we send according to the "stereo" codec
272 // parameter, and not the "channels" parameter. We set 272 // parameter, and not the "channels" parameter. We set
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( 280 webrtc::AudioState::Config MakeAudioStateConfig(VoEWrapper* voe_wrapper) {
281 VoEWrapper* voe_wrapper,
282 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer) {
283 webrtc::AudioState::Config config; 281 webrtc::AudioState::Config config;
284 config.voice_engine = voe_wrapper->engine(); 282 config.voice_engine = voe_wrapper->engine();
285 if (audio_mixer) { 283 config.audio_mixer = webrtc::AudioMixerImpl::Create();
286 config.audio_mixer = audio_mixer;
287 } else {
288 config.audio_mixer = webrtc::AudioMixerImpl::Create();
289 }
290 return config; 284 return config;
291 } 285 }
292 286
293 class WebRtcVoiceCodecs final { 287 class WebRtcVoiceCodecs final {
294 public: 288 public:
295 // TODO(solenberg): Do this filtering once off-line, add a simple AudioCodec 289 // TODO(solenberg): Do this filtering once off-line, add a simple AudioCodec
296 // list and add a test which verifies VoE supports the listed codecs. 290 // list and add a test which verifies VoE supports the listed codecs.
297 static std::vector<AudioCodec> SupportedSendCodecs() { 291 static std::vector<AudioCodec> SupportedSendCodecs() {
298 std::vector<AudioCodec> result; 292 std::vector<AudioCodec> result;
299 // Iterate first over our preferred codecs list, so that the results are 293 // Iterate first over our preferred codecs list, so that the results are
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 533
540 } // namespace { 534 } // namespace {
541 535
542 bool WebRtcVoiceEngine::ToCodecInst(const AudioCodec& in, 536 bool WebRtcVoiceEngine::ToCodecInst(const AudioCodec& in,
543 webrtc::CodecInst* out) { 537 webrtc::CodecInst* out) {
544 return WebRtcVoiceCodecs::ToCodecInst(in, out); 538 return WebRtcVoiceCodecs::ToCodecInst(in, out);
545 } 539 }
546 540
547 WebRtcVoiceEngine::WebRtcVoiceEngine( 541 WebRtcVoiceEngine::WebRtcVoiceEngine(
548 webrtc::AudioDeviceModule* adm, 542 webrtc::AudioDeviceModule* adm,
549 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, 543 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory)
550 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer) 544 : WebRtcVoiceEngine(adm, decoder_factory, new VoEWrapper()) {
551 : WebRtcVoiceEngine(adm, decoder_factory, audio_mixer, new VoEWrapper()) { 545 audio_state_ = webrtc::AudioState::Create(MakeAudioStateConfig(voe()));
552 audio_state_ =
553 webrtc::AudioState::Create(MakeAudioStateConfig(voe(), audio_mixer));
554 } 546 }
555 547
556 WebRtcVoiceEngine::WebRtcVoiceEngine( 548 WebRtcVoiceEngine::WebRtcVoiceEngine(
557 webrtc::AudioDeviceModule* adm, 549 webrtc::AudioDeviceModule* adm,
558 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory, 550 const rtc::scoped_refptr<webrtc::AudioDecoderFactory>& decoder_factory,
559 rtc::scoped_refptr<webrtc::AudioMixer> audio_mixer,
560 VoEWrapper* voe_wrapper) 551 VoEWrapper* voe_wrapper)
561 : adm_(adm), decoder_factory_(decoder_factory), voe_wrapper_(voe_wrapper) { 552 : adm_(adm), decoder_factory_(decoder_factory), voe_wrapper_(voe_wrapper) {
562 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 553 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
563 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine"; 554 LOG(LS_INFO) << "WebRtcVoiceEngine::WebRtcVoiceEngine";
564 RTC_DCHECK(voe_wrapper); 555 RTC_DCHECK(voe_wrapper);
565 RTC_DCHECK(decoder_factory); 556 RTC_DCHECK(decoder_factory);
566 557
567 signal_thread_checker_.DetachFromThread(); 558 signal_thread_checker_.DetachFromThread();
568 559
569 // Load our audio codec list. 560 // Load our audio codec list.
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after
2647 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); 2638 RTC_DCHECK(worker_thread_checker_.CalledOnValidThread());
2648 const auto it = send_streams_.find(ssrc); 2639 const auto it = send_streams_.find(ssrc);
2649 if (it != send_streams_.end()) { 2640 if (it != send_streams_.end()) {
2650 return it->second->channel(); 2641 return it->second->channel();
2651 } 2642 }
2652 return -1; 2643 return -1;
2653 } 2644 }
2654 } // namespace cricket 2645 } // namespace cricket
2655 2646
2656 #endif // HAVE_WEBRTC_VOICE 2647 #endif // HAVE_WEBRTC_VOICE
OLDNEW
« no previous file with comments | « webrtc/media/engine/webrtcvoiceengine.h ('k') | webrtc/media/engine/webrtcvoiceengine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698