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

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

Issue 2665693002: Moves channel-dependent audio input processing to separate encoder task queue (Closed)
Patch Set: Final comments from Tommi Created 3 years, 8 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
« no previous file with comments | « webrtc/voice_engine/transmit_mixer.h ('k') | webrtc/voice_engine/voe_base_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 if (file_recording) 304 if (file_recording)
305 { 305 {
306 RecordAudioToFile(_audioFrame.sample_rate_hz_); 306 RecordAudioToFile(_audioFrame.sample_rate_hz_);
307 } 307 }
308 308
309 // --- Measure audio level of speech after all processing. 309 // --- Measure audio level of speech after all processing.
310 _audioLevel.ComputeLevel(_audioFrame); 310 _audioLevel.ComputeLevel(_audioFrame);
311 return 0; 311 return 0;
312 } 312 }
313 313
314 int32_t 314 void TransmitMixer::ProcessAndEncodeAudio() {
315 TransmitMixer::DemuxAndMix() 315 RTC_DCHECK_GT(_audioFrame.samples_per_channel_, 0);
316 { 316 for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid();
317 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1), 317 it.Increment()) {
318 "TransmitMixer::DemuxAndMix()"); 318 Channel* const channel = it.GetChannel();
319 319 if (channel->Sending()) {
320 for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid(); 320 channel->ProcessAndEncodeAudio(_audioFrame);
321 it.Increment())
322 {
323 Channel* channelPtr = it.GetChannel();
324 if (channelPtr->Sending())
325 {
326 // Demultiplex makes a copy of its input.
327 channelPtr->Demultiplex(_audioFrame);
328 channelPtr->PrepareEncodeAndSend(_audioFrame.sample_rate_hz_);
329 }
330 }
331 return 0;
332 }
333
334 void TransmitMixer::DemuxAndMix(const int voe_channels[],
335 size_t number_of_voe_channels) {
336 for (size_t i = 0; i < number_of_voe_channels; ++i) {
337 voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]);
338 voe::Channel* channel_ptr = ch.channel();
339 if (channel_ptr) {
340 if (channel_ptr->Sending()) {
341 // Demultiplex makes a copy of its input.
342 channel_ptr->Demultiplex(_audioFrame);
343 channel_ptr->PrepareEncodeAndSend(_audioFrame.sample_rate_hz_);
344 }
345 } 321 }
346 } 322 }
347 } 323 }
348 324
349 int32_t
350 TransmitMixer::EncodeAndSend()
351 {
352 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1),
353 "TransmitMixer::EncodeAndSend()");
354
355 for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid();
356 it.Increment())
357 {
358 Channel* channelPtr = it.GetChannel();
359 if (channelPtr->Sending())
360 {
361 channelPtr->EncodeAndSend();
362 }
363 }
364 return 0;
365 }
366
367 void TransmitMixer::EncodeAndSend(const int voe_channels[],
368 size_t number_of_voe_channels) {
369 for (size_t i = 0; i < number_of_voe_channels; ++i) {
370 voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]);
371 voe::Channel* channel_ptr = ch.channel();
372 if (channel_ptr && channel_ptr->Sending())
373 channel_ptr->EncodeAndSend();
374 }
375 }
376
377 uint32_t TransmitMixer::CaptureLevel() const 325 uint32_t TransmitMixer::CaptureLevel() const
378 { 326 {
379 return _captureLevel; 327 return _captureLevel;
380 } 328 }
381 329
382 int32_t 330 int32_t
383 TransmitMixer::StopSend() 331 TransmitMixer::StopSend()
384 { 332 {
385 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1), 333 WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId, -1),
386 "TransmitMixer::StopSend()"); 334 "TransmitMixer::StopSend()");
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { 1016 void TransmitMixer::EnableStereoChannelSwapping(bool enable) {
1069 swap_stereo_channels_ = enable; 1017 swap_stereo_channels_ = enable;
1070 } 1018 }
1071 1019
1072 bool TransmitMixer::IsStereoChannelSwappingEnabled() { 1020 bool TransmitMixer::IsStereoChannelSwappingEnabled() {
1073 return swap_stereo_channels_; 1021 return swap_stereo_channels_;
1074 } 1022 }
1075 1023
1076 } // namespace voe 1024 } // namespace voe
1077 } // namespace webrtc 1025 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/voice_engine/transmit_mixer.h ('k') | webrtc/voice_engine/voe_base_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698