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

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc

Issue 1527453005: AudioCodingModuleImpl: Stop failing artificially for non-Opus encoders (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@rac1
Patch Set: rebase Created 5 years 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 | « no previous file | webrtc/modules/audio_coding/acm2/codec_manager.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 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 // Get ready for the next payload. 737 // Get ready for the next payload.
738 aux_rtp_header_->header.sequenceNumber++; 738 aux_rtp_header_->header.sequenceNumber++;
739 return 0; 739 return 0;
740 } 740 }
741 741
742 int AudioCodingModuleImpl::SetOpusApplication(OpusApplicationMode application) { 742 int AudioCodingModuleImpl::SetOpusApplication(OpusApplicationMode application) {
743 CriticalSectionScoped lock(acm_crit_sect_.get()); 743 CriticalSectionScoped lock(acm_crit_sect_.get());
744 if (!HaveValidEncoder("SetOpusApplication")) { 744 if (!HaveValidEncoder("SetOpusApplication")) {
745 return -1; 745 return -1;
746 } 746 }
747 if (!codec_manager_.CurrentEncoderIsOpus())
748 return -1;
749 AudioEncoder::Application app; 747 AudioEncoder::Application app;
750 switch (application) { 748 switch (application) {
751 case kVoip: 749 case kVoip:
752 app = AudioEncoder::Application::kSpeech; 750 app = AudioEncoder::Application::kSpeech;
753 break; 751 break;
754 case kAudio: 752 case kAudio:
755 app = AudioEncoder::Application::kAudio; 753 app = AudioEncoder::Application::kAudio;
756 break; 754 break;
757 default: 755 default:
758 FATAL(); 756 FATAL();
759 return 0; 757 return 0;
760 } 758 }
761 return rent_a_codec_.GetEncoderStack()->SetApplication(app) ? 0 : -1; 759 return rent_a_codec_.GetEncoderStack()->SetApplication(app) ? 0 : -1;
762 } 760 }
763 761
764 // Informs Opus encoder of the maximum playback rate the receiver will render. 762 // Informs Opus encoder of the maximum playback rate the receiver will render.
765 int AudioCodingModuleImpl::SetOpusMaxPlaybackRate(int frequency_hz) { 763 int AudioCodingModuleImpl::SetOpusMaxPlaybackRate(int frequency_hz) {
766 CriticalSectionScoped lock(acm_crit_sect_.get()); 764 CriticalSectionScoped lock(acm_crit_sect_.get());
767 if (!HaveValidEncoder("SetOpusMaxPlaybackRate")) { 765 if (!HaveValidEncoder("SetOpusMaxPlaybackRate")) {
768 return -1; 766 return -1;
769 } 767 }
770 if (!codec_manager_.CurrentEncoderIsOpus())
771 return -1;
772 rent_a_codec_.GetEncoderStack()->SetMaxPlaybackRate(frequency_hz); 768 rent_a_codec_.GetEncoderStack()->SetMaxPlaybackRate(frequency_hz);
773 return 0; 769 return 0;
774 } 770 }
775 771
776 int AudioCodingModuleImpl::EnableOpusDtx() { 772 int AudioCodingModuleImpl::EnableOpusDtx() {
777 CriticalSectionScoped lock(acm_crit_sect_.get()); 773 CriticalSectionScoped lock(acm_crit_sect_.get());
778 if (!HaveValidEncoder("EnableOpusDtx")) { 774 if (!HaveValidEncoder("EnableOpusDtx")) {
779 return -1; 775 return -1;
780 } 776 }
781 if (!codec_manager_.CurrentEncoderIsOpus())
782 return -1;
783 return rent_a_codec_.GetEncoderStack()->SetDtx(true) ? 0 : -1; 777 return rent_a_codec_.GetEncoderStack()->SetDtx(true) ? 0 : -1;
784 } 778 }
785 779
786 int AudioCodingModuleImpl::DisableOpusDtx() { 780 int AudioCodingModuleImpl::DisableOpusDtx() {
787 CriticalSectionScoped lock(acm_crit_sect_.get()); 781 CriticalSectionScoped lock(acm_crit_sect_.get());
788 if (!HaveValidEncoder("DisableOpusDtx")) { 782 if (!HaveValidEncoder("DisableOpusDtx")) {
789 return -1; 783 return -1;
790 } 784 }
791 if (!codec_manager_.CurrentEncoderIsOpus())
792 return -1;
793 return rent_a_codec_.GetEncoderStack()->SetDtx(false) ? 0 : -1; 785 return rent_a_codec_.GetEncoderStack()->SetDtx(false) ? 0 : -1;
794 } 786 }
795 787
796 int AudioCodingModuleImpl::PlayoutTimestamp(uint32_t* timestamp) { 788 int AudioCodingModuleImpl::PlayoutTimestamp(uint32_t* timestamp) {
797 return receiver_.GetPlayoutTimestamp(timestamp) ? 0 : -1; 789 return receiver_.GetPlayoutTimestamp(timestamp) ? 0 : -1;
798 } 790 }
799 791
800 bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const { 792 bool AudioCodingModuleImpl::HaveValidEncoder(const char* caller_name) const {
801 if (!rent_a_codec_.GetEncoderStack()) { 793 if (!rent_a_codec_.GetEncoderStack()) {
802 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 794 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
(...skipping 24 matching lines...) Expand all
827 return receiver_.LeastRequiredDelayMs(); 819 return receiver_.LeastRequiredDelayMs();
828 } 820 }
829 821
830 void AudioCodingModuleImpl::GetDecodingCallStatistics( 822 void AudioCodingModuleImpl::GetDecodingCallStatistics(
831 AudioDecodingCallStats* call_stats) const { 823 AudioDecodingCallStats* call_stats) const {
832 receiver_.GetDecodingCallStatistics(call_stats); 824 receiver_.GetDecodingCallStatistics(call_stats);
833 } 825 }
834 826
835 } // namespace acm2 827 } // namespace acm2
836 } // namespace webrtc 828 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/acm2/codec_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698