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

Side by Side Diff: webrtc/voice_engine/channel.cc

Issue 2424173003: Move functionality out from AudioFrame and into AudioFrameOperations. (Closed)
Patch Set: Created 4 years, 2 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 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 // error so that the audio mixer module doesn't add it to the mix. As 582 // error so that the audio mixer module doesn't add it to the mix. As
583 // a result, it won't be played out and the actions skipped here are 583 // a result, it won't be played out and the actions skipped here are
584 // irrelevant. 584 // irrelevant.
585 return MixerParticipant::AudioFrameInfo::kError; 585 return MixerParticipant::AudioFrameInfo::kError;
586 } 586 }
587 587
588 if (muted) { 588 if (muted) {
589 // TODO(henrik.lundin): We should be able to do better than this. But we 589 // TODO(henrik.lundin): We should be able to do better than this. But we
590 // will have to go through all the cases below where the audio samples may 590 // will have to go through all the cases below where the audio samples may
591 // be used, and handle the muted case in some way. 591 // be used, and handle the muted case in some way.
592 audioFrame->Mute(); 592 AudioFrameOperations::Mute(audioFrame);
593 } 593 }
594 594
595 // Convert module ID to internal VoE channel ID 595 // Convert module ID to internal VoE channel ID
596 audioFrame->id_ = VoEChannelId(audioFrame->id_); 596 audioFrame->id_ = VoEChannelId(audioFrame->id_);
597 // Store speech type for dead-or-alive detection 597 // Store speech type for dead-or-alive detection
598 _outputSpeechType = audioFrame->speech_type_; 598 _outputSpeechType = audioFrame->speech_type_;
599 599
600 ChannelState::State state = channel_state_.Get(); 600 ChannelState::State state = channel_state_.Get();
601 601
602 { 602 {
(...skipping 2446 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 3049
3050 if (_mixFileWithMicrophone) { 3050 if (_mixFileWithMicrophone) {
3051 // Currently file stream is always mono. 3051 // Currently file stream is always mono.
3052 // TODO(xians): Change the code when FilePlayer supports real stereo. 3052 // TODO(xians): Change the code when FilePlayer supports real stereo.
3053 MixWithSat(_audioFrame.data_, _audioFrame.num_channels_, fileBuffer.get(), 3053 MixWithSat(_audioFrame.data_, _audioFrame.num_channels_, fileBuffer.get(),
3054 1, fileSamples); 3054 1, fileSamples);
3055 } else { 3055 } else {
3056 // Replace ACM audio with file. 3056 // Replace ACM audio with file.
3057 // Currently file stream is always mono. 3057 // Currently file stream is always mono.
3058 // TODO(xians): Change the code when FilePlayer supports real stereo. 3058 // TODO(xians): Change the code when FilePlayer supports real stereo.
3059 _audioFrame.UpdateFrame( 3059 AudioFrameOperations::UpdateFrame(
3060 _channelId, 0xFFFFFFFF, fileBuffer.get(), fileSamples, mixingFrequency, 3060 _channelId, 0xFFFFFFFF, fileBuffer.get(), fileSamples, mixingFrequency,
3061 AudioFrame::kNormalSpeech, AudioFrame::kVadUnknown, 1); 3061 AudioFrame::kNormalSpeech, AudioFrame::kVadUnknown, 1, &_audioFrame);
3062 } 3062 }
3063 return 0; 3063 return 0;
3064 } 3064 }
3065 3065
3066 int32_t Channel::MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency) { 3066 int32_t Channel::MixAudioWithFile(AudioFrame& audioFrame, int mixingFrequency) {
3067 assert(mixingFrequency <= 48000); 3067 assert(mixingFrequency <= 48000);
3068 3068
3069 std::unique_ptr<int16_t[]> fileBuffer(new int16_t[960]); 3069 std::unique_ptr<int16_t[]> fileBuffer(new int16_t[960]);
3070 size_t fileSamples(0); 3070 size_t fileSamples(0);
3071 3071
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
3243 int64_t min_rtt = 0; 3243 int64_t min_rtt = 0;
3244 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) != 3244 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) !=
3245 0) { 3245 0) {
3246 return 0; 3246 return 0;
3247 } 3247 }
3248 return rtt; 3248 return rtt;
3249 } 3249 }
3250 3250
3251 } // namespace voe 3251 } // namespace voe
3252 } // namespace webrtc 3252 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698