| OLD | NEW |
| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 _audioFrame.sample_rate_hz_, | 375 _audioFrame.sample_rate_hz_, |
| 376 _audioFrame.num_channels_ == 2); | 376 _audioFrame.num_channels_ == 2); |
| 377 } | 377 } |
| 378 } | 378 } |
| 379 | 379 |
| 380 // --- Measure audio level of speech after all processing. | 380 // --- Measure audio level of speech after all processing. |
| 381 _audioLevel.ComputeLevel(_audioFrame); | 381 _audioLevel.ComputeLevel(_audioFrame); |
| 382 return 0; | 382 return 0; |
| 383 } | 383 } |
| 384 | 384 |
| 385 int32_t | 385 void TransmitMixer::ProcessAudio() { |
| 386 TransmitMixer::DemuxAndMix() | 386 RTC_DCHECK_GT(_audioFrame.samples_per_channel_, 0); |
| 387 { | 387 for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid(); |
| 388 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1), | 388 it.Increment()) { |
| 389 "TransmitMixer::DemuxAndMix()"); | 389 Channel* const channel = it.GetChannel(); |
| 390 | 390 if (channel->Sending()) { |
| 391 for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid(); | 391 channel->ProcessAndEncodeAudio(_audioFrame); |
| 392 it.Increment()) | |
| 393 { | |
| 394 Channel* channelPtr = it.GetChannel(); | |
| 395 if (channelPtr->Sending()) | |
| 396 { | |
| 397 // Demultiplex makes a copy of its input. | |
| 398 channelPtr->Demultiplex(_audioFrame); | |
| 399 channelPtr->PrepareEncodeAndSend(_audioFrame.sample_rate_hz_); | |
| 400 } | |
| 401 } | |
| 402 return 0; | |
| 403 } | |
| 404 | |
| 405 void TransmitMixer::DemuxAndMix(const int voe_channels[], | |
| 406 size_t number_of_voe_channels) { | |
| 407 for (size_t i = 0; i < number_of_voe_channels; ++i) { | |
| 408 voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]); | |
| 409 voe::Channel* channel_ptr = ch.channel(); | |
| 410 if (channel_ptr) { | |
| 411 if (channel_ptr->Sending()) { | |
| 412 // Demultiplex makes a copy of its input. | |
| 413 channel_ptr->Demultiplex(_audioFrame); | |
| 414 channel_ptr->PrepareEncodeAndSend(_audioFrame.sample_rate_hz_); | |
| 415 } | |
| 416 } | 392 } |
| 417 } | 393 } |
| 418 } | 394 } |
| 419 | 395 |
| 420 int32_t | 396 // TODO(henrika): investigate the possibility of removing this method. |
| 421 TransmitMixer::EncodeAndSend() | 397 void TransmitMixer::ProcessAudio(const int voe_channels[], |
| 422 { | 398 size_t number_of_voe_channels) { |
| 423 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1), | 399 RTC_DCHECK_GT(_audioFrame.samples_per_channel_, 0); |
| 424 "TransmitMixer::EncodeAndSend()"); | |
| 425 | |
| 426 for (ChannelManager::Iterator it(_channelManagerPtr); it.IsValid(); | |
| 427 it.Increment()) | |
| 428 { | |
| 429 Channel* channelPtr = it.GetChannel(); | |
| 430 if (channelPtr->Sending()) | |
| 431 { | |
| 432 channelPtr->EncodeAndSend(); | |
| 433 } | |
| 434 } | |
| 435 return 0; | |
| 436 } | |
| 437 | |
| 438 void TransmitMixer::EncodeAndSend(const int voe_channels[], | |
| 439 size_t number_of_voe_channels) { | |
| 440 for (size_t i = 0; i < number_of_voe_channels; ++i) { | 400 for (size_t i = 0; i < number_of_voe_channels; ++i) { |
| 441 voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]); | 401 voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]); |
| 442 voe::Channel* channel_ptr = ch.channel(); | 402 voe::Channel* channel = ch.channel(); |
| 443 if (channel_ptr && channel_ptr->Sending()) | 403 if (channel) { |
| 444 channel_ptr->EncodeAndSend(); | 404 if (channel->Sending()) { |
| 405 channel->ProcessAndEncodeAudio(_audioFrame); |
| 406 } |
| 407 } |
| 445 } | 408 } |
| 446 } | 409 } |
| 447 | 410 |
| 448 uint32_t TransmitMixer::CaptureLevel() const | 411 uint32_t TransmitMixer::CaptureLevel() const |
| 449 { | 412 { |
| 450 return _captureLevel; | 413 return _captureLevel; |
| 451 } | 414 } |
| 452 | 415 |
| 453 int32_t | 416 int32_t |
| 454 TransmitMixer::StopSend() | 417 TransmitMixer::StopSend() |
| (...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1228 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { | 1191 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { |
| 1229 swap_stereo_channels_ = enable; | 1192 swap_stereo_channels_ = enable; |
| 1230 } | 1193 } |
| 1231 | 1194 |
| 1232 bool TransmitMixer::IsStereoChannelSwappingEnabled() { | 1195 bool TransmitMixer::IsStereoChannelSwappingEnabled() { |
| 1233 return swap_stereo_channels_; | 1196 return swap_stereo_channels_; |
| 1234 } | 1197 } |
| 1235 | 1198 |
| 1236 } // namespace voe | 1199 } // namespace voe |
| 1237 } // namespace webrtc | 1200 } // namespace webrtc |
| OLD | NEW |