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

Side by Side Diff: webrtc/modules/audio_mixer/audio_mixer.cc

Issue 2221443002: Changed mixing api and removed resampler (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Described Mix args in comments. Created 4 years, 4 months 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) 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 int32_t AudioMixer::SetMixabilityStatus(MixerAudioSource& audio_source, 152 int32_t AudioMixer::SetMixabilityStatus(MixerAudioSource& audio_source,
153 bool mixable) { 153 bool mixable) {
154 return _mixerModule.SetMixabilityStatus(&audio_source, mixable); 154 return _mixerModule.SetMixabilityStatus(&audio_source, mixable);
155 } 155 }
156 156
157 int32_t AudioMixer::SetAnonymousMixabilityStatus(MixerAudioSource& audio_source, 157 int32_t AudioMixer::SetAnonymousMixabilityStatus(MixerAudioSource& audio_source,
158 bool mixable) { 158 bool mixable) {
159 return _mixerModule.SetAnonymousMixabilityStatus(&audio_source, mixable); 159 return _mixerModule.SetAnonymousMixabilityStatus(&audio_source, mixable);
160 } 160 }
161 161
162 int32_t AudioMixer::MixActiveChannels() {
163 _mixerModule.Mix(&_audioFrame);
164 return 0;
165 }
166
167 int AudioMixer::GetSpeechOutputLevel(uint32_t& level) { 162 int AudioMixer::GetSpeechOutputLevel(uint32_t& level) {
168 int8_t currentLevel = _audioLevel.Level(); 163 int8_t currentLevel = _audioLevel.Level();
169 level = static_cast<uint32_t>(currentLevel); 164 level = static_cast<uint32_t>(currentLevel);
170 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, -1), 165 WEBRTC_TRACE(kTraceStateInfo, kTraceVoice, VoEId(_instanceId, -1),
171 "GetSpeechOutputLevel() => level=%u", level); 166 "GetSpeechOutputLevel() => level=%u", level);
172 return 0; 167 return 0;
173 } 168 }
174 169
175 int AudioMixer::GetSpeechOutputLevelFullRange(uint32_t& level) { 170 int AudioMixer::GetSpeechOutputLevelFullRange(uint32_t& level) {
176 int16_t currentLevel = _audioLevel.LevelFullRange(); 171 int16_t currentLevel = _audioLevel.LevelFullRange();
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 "AudioMixer::GetMixedAudio(sample_rate_hz=%d, num_channels=%" PRIuS ")", 359 "AudioMixer::GetMixedAudio(sample_rate_hz=%d, num_channels=%" PRIuS ")",
365 sample_rate_hz, num_channels); 360 sample_rate_hz, num_channels);
366 361
367 // --- Record playout if enabled 362 // --- Record playout if enabled
368 { 363 {
369 rtc::CritScope cs(&_fileCritSect); 364 rtc::CritScope cs(&_fileCritSect);
370 if (_outputFileRecording && _outputFileRecorderPtr) 365 if (_outputFileRecording && _outputFileRecorderPtr)
371 _outputFileRecorderPtr->RecordAudioToFile(_audioFrame); 366 _outputFileRecorderPtr->RecordAudioToFile(_audioFrame);
372 } 367 }
373 368
374 frame->num_channels_ = num_channels; 369 _mixerModule.Mix(sample_rate_hz, num_channels, frame);
375 frame->sample_rate_hz_ = sample_rate_hz; 370
376 // TODO(andrew): Ideally the downmixing would occur much earlier, in
377 // AudioCodingModule.
378 RemixAndResample(_audioFrame, &resampler_, frame);
379 return 0; 371 return 0;
380 } 372 }
381 373
382 int32_t AudioMixer::DoOperationsOnCombinedSignal(bool feed_data_to_apm) { 374 int32_t AudioMixer::DoOperationsOnCombinedSignal(bool feed_data_to_apm) {
383 if (_audioFrame.sample_rate_hz_ != _mixingFrequencyHz) { 375 if (_audioFrame.sample_rate_hz_ != _mixingFrequencyHz) {
384 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1), 376 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),
385 "AudioMixer::DoOperationsOnCombinedSignal() => " 377 "AudioMixer::DoOperationsOnCombinedSignal() => "
386 "mixing frequency = %d", 378 "mixing frequency = %d",
387 _audioFrame.sample_rate_hz_); 379 _audioFrame.sample_rate_hz_);
388 _mixingFrequencyHz = _audioFrame.sample_rate_hz_; 380 _mixingFrequencyHz = _audioFrame.sample_rate_hz_;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 } 416 }
425 } 417 }
426 418
427 // --- Measure audio level (0-9) for the combined signal 419 // --- Measure audio level (0-9) for the combined signal
428 _audioLevel.ComputeLevel(_audioFrame); 420 _audioLevel.ComputeLevel(_audioFrame);
429 421
430 return 0; 422 return 0;
431 } 423 }
432 } // namespace voe 424 } // namespace voe
433 } // namespace webrtc 425 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_mixer/audio_mixer.h ('k') | webrtc/modules/audio_mixer/include/audio_mixer_defines.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698