| 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 722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 // Get ready for the next payload. | 733 // Get ready for the next payload. |
| 734 aux_rtp_header_->header.sequenceNumber++; | 734 aux_rtp_header_->header.sequenceNumber++; |
| 735 return 0; | 735 return 0; |
| 736 } | 736 } |
| 737 | 737 |
| 738 int AudioCodingModuleImpl::SetOpusApplication(OpusApplicationMode application) { | 738 int AudioCodingModuleImpl::SetOpusApplication(OpusApplicationMode application) { |
| 739 CriticalSectionScoped lock(acm_crit_sect_.get()); | 739 CriticalSectionScoped lock(acm_crit_sect_.get()); |
| 740 if (!HaveValidEncoder("SetOpusApplication")) { | 740 if (!HaveValidEncoder("SetOpusApplication")) { |
| 741 return -1; | 741 return -1; |
| 742 } | 742 } |
| 743 if (!codec_manager_.CurrentEncoderIsOpus()) | |
| 744 return -1; | |
| 745 AudioEncoder::Application app; | 743 AudioEncoder::Application app; |
| 746 switch (application) { | 744 switch (application) { |
| 747 case kVoip: | 745 case kVoip: |
| 748 app = AudioEncoder::Application::kSpeech; | 746 app = AudioEncoder::Application::kSpeech; |
| 749 break; | 747 break; |
| 750 case kAudio: | 748 case kAudio: |
| 751 app = AudioEncoder::Application::kAudio; | 749 app = AudioEncoder::Application::kAudio; |
| 752 break; | 750 break; |
| 753 default: | 751 default: |
| 754 FATAL(); | 752 FATAL(); |
| 755 return 0; | 753 return 0; |
| 756 } | 754 } |
| 757 return rent_a_codec_.GetEncoderStack()->SetApplication(app) ? 0 : -1; | 755 return rent_a_codec_.GetEncoderStack()->SetApplication(app) ? 0 : -1; |
| 758 } | 756 } |
| 759 | 757 |
| 760 // Informs Opus encoder of the maximum playback rate the receiver will render. | 758 // Informs Opus encoder of the maximum playback rate the receiver will render. |
| 761 int AudioCodingModuleImpl::SetOpusMaxPlaybackRate(int frequency_hz) { | 759 int AudioCodingModuleImpl::SetOpusMaxPlaybackRate(int frequency_hz) { |
| 762 CriticalSectionScoped lock(acm_crit_sect_.get()); | 760 CriticalSectionScoped lock(acm_crit_sect_.get()); |
| 763 if (!HaveValidEncoder("SetOpusMaxPlaybackRate")) { | 761 if (!HaveValidEncoder("SetOpusMaxPlaybackRate")) { |
| 764 return -1; | 762 return -1; |
| 765 } | 763 } |
| 766 if (!codec_manager_.CurrentEncoderIsOpus()) | |
| 767 return -1; | |
| 768 rent_a_codec_.GetEncoderStack()->SetMaxPlaybackRate(frequency_hz); | 764 rent_a_codec_.GetEncoderStack()->SetMaxPlaybackRate(frequency_hz); |
| 769 return 0; | 765 return 0; |
| 770 } | 766 } |
| 771 | 767 |
| 772 int AudioCodingModuleImpl::EnableOpusDtx() { | 768 int AudioCodingModuleImpl::EnableOpusDtx() { |
| 773 CriticalSectionScoped lock(acm_crit_sect_.get()); | 769 CriticalSectionScoped lock(acm_crit_sect_.get()); |
| 774 if (!HaveValidEncoder("EnableOpusDtx")) { | 770 if (!HaveValidEncoder("EnableOpusDtx")) { |
| 775 return -1; | 771 return -1; |
| 776 } | 772 } |
| 777 if (!codec_manager_.CurrentEncoderIsOpus()) | |
| 778 return -1; | |
| 779 return rent_a_codec_.GetEncoderStack()->SetDtx(true) ? 0 : -1; | 773 return rent_a_codec_.GetEncoderStack()->SetDtx(true) ? 0 : -1; |
| 780 } | 774 } |
| 781 | 775 |
| 782 int AudioCodingModuleImpl::DisableOpusDtx() { | 776 int AudioCodingModuleImpl::DisableOpusDtx() { |
| 783 CriticalSectionScoped lock(acm_crit_sect_.get()); | 777 CriticalSectionScoped lock(acm_crit_sect_.get()); |
| 784 if (!HaveValidEncoder("DisableOpusDtx")) { | 778 if (!HaveValidEncoder("DisableOpusDtx")) { |
| 785 return -1; | 779 return -1; |
| 786 } | 780 } |
| 787 if (!codec_manager_.CurrentEncoderIsOpus()) | |
| 788 return -1; | |
| 789 return rent_a_codec_.GetEncoderStack()->SetDtx(false) ? 0 : -1; | 781 return rent_a_codec_.GetEncoderStack()->SetDtx(false) ? 0 : -1; |
| 790 } | 782 } |
| 791 | 783 |
| 792 int AudioCodingModuleImpl::PlayoutTimestamp(uint32_t* timestamp) { | 784 int AudioCodingModuleImpl::PlayoutTimestamp(uint32_t* timestamp) { |
| 793 return receiver_.GetPlayoutTimestamp(timestamp) ? 0 : -1; | 785 return receiver_.GetPlayoutTimestamp(timestamp) ? 0 : -1; |
| 794 } | 786 } |
| 795 | 787 |
| 796 bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const { | 788 bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const { |
| 797 if (!rent_a_codec_.GetEncoderStack()) { | 789 if (!rent_a_codec_.GetEncoderStack()) { |
| 798 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, | 790 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 823 return receiver_.LeastRequiredDelayMs(); | 815 return receiver_.LeastRequiredDelayMs(); |
| 824 } | 816 } |
| 825 | 817 |
| 826 void AudioCodingModuleImpl::GetDecodingCallStatistics( | 818 void AudioCodingModuleImpl::GetDecodingCallStatistics( |
| 827 AudioDecodingCallStats* call_stats) const { | 819 AudioDecodingCallStats* call_stats) const { |
| 828 receiver_.GetDecodingCallStatistics(call_stats); | 820 receiver_.GetDecodingCallStatistics(call_stats); |
| 829 } | 821 } |
| 830 | 822 |
| 831 } // namespace acm2 | 823 } // namespace acm2 |
| 832 } // namespace webrtc | 824 } // namespace webrtc |
| OLD | NEW |