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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
553 ChannelState::State state = channel_state_.Get(); | 553 ChannelState::State state = channel_state_.Get(); |
554 | 554 |
555 if (state.rx_apm_is_enabled) { | 555 if (state.rx_apm_is_enabled) { |
556 int err = rx_audioproc_->ProcessStream(audioFrame); | 556 int err = rx_audioproc_->ProcessStream(audioFrame); |
557 if (err) { | 557 if (err) { |
558 LOG(LS_ERROR) << "ProcessStream() error: " << err; | 558 LOG(LS_ERROR) << "ProcessStream() error: " << err; |
559 assert(false); | 559 assert(false); |
560 } | 560 } |
561 } | 561 } |
562 | 562 |
563 // External media. | |
564 // Pass the audio buffers to the external media callback, if set, before | |
565 // applying scaling/panning, as that applies to the mix operation. | |
the sun
2015/12/10 12:36:32
Does this break any of our tests? It might break 3
| |
566 // External recipients of the audio (e.g. via AudioTrack), will do their own | |
567 // mixing. | |
568 if (_outputExternalMedia) | |
569 { | |
570 CriticalSectionScoped cs(&_callbackCritSect); | |
571 const bool isStereo = (audioFrame->num_channels_ == 2); | |
572 if (_outputExternalMediaCallbackPtr) | |
573 { | |
574 // TODO(tommi, hlundin): There's no timestamp information that | |
575 // accompanies the audio data. Fix pwetty pwease. | |
576 _outputExternalMediaCallbackPtr->Process( | |
577 _channelId, | |
578 kPlaybackPerChannel, | |
579 reinterpret_cast<int16_t*>(audioFrame->data_), | |
580 audioFrame->samples_per_channel_, | |
581 audioFrame->sample_rate_hz_, | |
582 isStereo); | |
583 } | |
584 } | |
585 | |
563 float output_gain = 1.0f; | 586 float output_gain = 1.0f; |
564 float left_pan = 1.0f; | 587 float left_pan = 1.0f; |
565 float right_pan = 1.0f; | 588 float right_pan = 1.0f; |
566 { | 589 { |
567 CriticalSectionScoped cs(&volume_settings_critsect_); | 590 CriticalSectionScoped cs(&volume_settings_critsect_); |
568 output_gain = _outputGain; | 591 output_gain = _outputGain; |
569 left_pan = _panLeft; | 592 left_pan = _panLeft; |
570 right_pan= _panRight; | 593 right_pan= _panRight; |
571 } | 594 } |
572 | 595 |
(...skipping 21 matching lines...) Expand all Loading... | |
594 // stage) | 617 // stage) |
595 AudioFrameOperations::Scale(left_pan, right_pan, *audioFrame); | 618 AudioFrameOperations::Scale(left_pan, right_pan, *audioFrame); |
596 } | 619 } |
597 | 620 |
598 // Mix decoded PCM output with file if file mixing is enabled | 621 // Mix decoded PCM output with file if file mixing is enabled |
599 if (state.output_file_playing) | 622 if (state.output_file_playing) |
600 { | 623 { |
601 MixAudioWithFile(*audioFrame, audioFrame->sample_rate_hz_); | 624 MixAudioWithFile(*audioFrame, audioFrame->sample_rate_hz_); |
602 } | 625 } |
603 | 626 |
604 // External media | |
605 if (_outputExternalMedia) | |
606 { | |
607 CriticalSectionScoped cs(&_callbackCritSect); | |
608 const bool isStereo = (audioFrame->num_channels_ == 2); | |
609 if (_outputExternalMediaCallbackPtr) | |
610 { | |
611 _outputExternalMediaCallbackPtr->Process( | |
612 _channelId, | |
613 kPlaybackPerChannel, | |
614 (int16_t*)audioFrame->data_, | |
615 audioFrame->samples_per_channel_, | |
616 audioFrame->sample_rate_hz_, | |
617 isStereo); | |
618 } | |
619 } | |
620 | |
621 // Record playout if enabled | 627 // Record playout if enabled |
622 { | 628 { |
623 CriticalSectionScoped cs(&_fileCritSect); | 629 CriticalSectionScoped cs(&_fileCritSect); |
624 | 630 |
625 if (_outputFileRecording && _outputFileRecorderPtr) | 631 if (_outputFileRecording && _outputFileRecorderPtr) |
626 { | 632 { |
627 _outputFileRecorderPtr->RecordAudioToFile(*audioFrame); | 633 _outputFileRecorderPtr->RecordAudioToFile(*audioFrame); |
628 } | 634 } |
629 } | 635 } |
630 | 636 |
(...skipping 3455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4086 int64_t min_rtt = 0; | 4092 int64_t min_rtt = 0; |
4087 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) | 4093 if (_rtpRtcpModule->RTT(remoteSSRC, &rtt, &avg_rtt, &min_rtt, &max_rtt) |
4088 != 0) { | 4094 != 0) { |
4089 return 0; | 4095 return 0; |
4090 } | 4096 } |
4091 return rtt; | 4097 return rtt; |
4092 } | 4098 } |
4093 | 4099 |
4094 } // namespace voe | 4100 } // namespace voe |
4095 } // namespace webrtc | 4101 } // namespace webrtc |
OLD | NEW |