| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::ProcessAudio() { |
| 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 | 325 // TODO(henrika): investigate the possibility of removing this method. |
| 350 TransmitMixer::EncodeAndSend() | 326 void TransmitMixer::ProcessAudio(const int voe_channels[], |
| 351 { | 327 size_t number_of_voe_channels) { |
| 352 WEBRTC_TRACE(kTraceStream, kTraceVoice, VoEId(_instanceId, -1), | 328 RTC_DCHECK_GT(_audioFrame.samples_per_channel_, 0); |
| 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) { | 329 for (size_t i = 0; i < number_of_voe_channels; ++i) { |
| 370 voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]); | 330 voe::ChannelOwner ch = _channelManagerPtr->GetChannel(voe_channels[i]); |
| 371 voe::Channel* channel_ptr = ch.channel(); | 331 voe::Channel* channel = ch.channel(); |
| 372 if (channel_ptr && channel_ptr->Sending()) | 332 if (channel) { |
| 373 channel_ptr->EncodeAndSend(); | 333 if (channel->Sending()) { |
| 334 channel->ProcessAndEncodeAudio(_audioFrame); |
| 335 } |
| 336 } |
| 374 } | 337 } |
| 375 } | 338 } |
| 376 | 339 |
| 377 uint32_t TransmitMixer::CaptureLevel() const | 340 uint32_t TransmitMixer::CaptureLevel() const |
| 378 { | 341 { |
| 379 return _captureLevel; | 342 return _captureLevel; |
| 380 } | 343 } |
| 381 | 344 |
| 382 int32_t | 345 int32_t |
| 383 TransmitMixer::StopSend() | 346 TransmitMixer::StopSend() |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { | 1031 void TransmitMixer::EnableStereoChannelSwapping(bool enable) { |
| 1069 swap_stereo_channels_ = enable; | 1032 swap_stereo_channels_ = enable; |
| 1070 } | 1033 } |
| 1071 | 1034 |
| 1072 bool TransmitMixer::IsStereoChannelSwappingEnabled() { | 1035 bool TransmitMixer::IsStereoChannelSwappingEnabled() { |
| 1073 return swap_stereo_channels_; | 1036 return swap_stereo_channels_; |
| 1074 } | 1037 } |
| 1075 | 1038 |
| 1076 } // namespace voe | 1039 } // namespace voe |
| 1077 } // namespace webrtc | 1040 } // namespace webrtc |
| OLD | NEW |