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

Unified Diff: webrtc/modules/audio_coding/acm2/audio_coding_module.cc

Issue 2392743004: Remove old AudioCodingModule::RegisterReceiveCodec overloads
Patch Set: rebase Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/include/audio_coding_module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_coding/acm2/audio_coding_module.cc
diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
index ee1034b75a7ebb1dcec199abd3394bdc50a57d0c..5ff28ab043838ad43ab91aa3c30acbd089672109 100644
--- a/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
+++ b/webrtc/modules/audio_coding/acm2/audio_coding_module.cc
@@ -124,17 +124,6 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
bool RegisterReceiveCodec(int rtp_payload_type,
const SdpAudioFormat& audio_format) override;
- int RegisterReceiveCodec(const CodecInst& receive_codec) override;
- int RegisterReceiveCodec(
- const CodecInst& receive_codec,
- rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory) override;
-
- int RegisterExternalReceiveCodec(int rtp_payload_type,
- AudioDecoder* external_decoder,
- int sample_rate_hz,
- int num_channels,
- const std::string& name) override;
-
// Get current received codec.
int ReceiveCodec(CodecInst* current_codec) const override;
@@ -227,11 +216,6 @@ class AudioCodingModuleImpl final : public AudioCodingModule {
const std::string histogram_name_;
};
- int RegisterReceiveCodecUnlocked(
- const CodecInst& codec,
- rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory)
- EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
-
int Add10MsDataInternal(const AudioFrame& audio_frame, InputData* input_data)
EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
int Encode(const InputData& input_data)
@@ -1007,82 +991,6 @@ bool AudioCodingModuleImpl::RegisterReceiveCodec(
return receiver_.AddCodec(rtp_payload_type, audio_format);
}
-int AudioCodingModuleImpl::RegisterReceiveCodec(const CodecInst& codec) {
- rtc::CritScope lock(&acm_crit_sect_);
- auto* ef = encoder_factory_.get();
- return RegisterReceiveCodecUnlocked(
- codec, [&] { return ef->rent_a_codec.RentIsacDecoder(codec.plfreq); });
-}
-
-int AudioCodingModuleImpl::RegisterReceiveCodec(
- const CodecInst& codec,
- rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory) {
- rtc::CritScope lock(&acm_crit_sect_);
- return RegisterReceiveCodecUnlocked(codec, isac_factory);
-}
-
-int AudioCodingModuleImpl::RegisterReceiveCodecUnlocked(
- const CodecInst& codec,
- rtc::FunctionView<std::unique_ptr<AudioDecoder>()> isac_factory) {
- RTC_DCHECK(receiver_initialized_);
- if (codec.channels > 2) {
- LOG_F(LS_ERROR) << "Unsupported number of channels: " << codec.channels;
- return -1;
- }
-
- auto codec_id = acm2::RentACodec::CodecIdByParams(codec.plname, codec.plfreq,
- codec.channels);
- if (!codec_id) {
- LOG_F(LS_ERROR) << "Wrong codec params to be registered as receive codec";
- return -1;
- }
- auto codec_index = acm2::RentACodec::CodecIndexFromId(*codec_id);
- RTC_CHECK(codec_index) << "Invalid codec ID: " << static_cast<int>(*codec_id);
-
- // Check if the payload-type is valid.
- if (!acm2::RentACodec::IsPayloadTypeValid(codec.pltype)) {
- LOG_F(LS_ERROR) << "Invalid payload type " << codec.pltype << " for "
- << codec.plname;
- return -1;
- }
-
- AudioDecoder* isac_decoder = nullptr;
- if (STR_CASE_CMP(codec.plname, "isac") == 0) {
- std::unique_ptr<AudioDecoder>& saved_isac_decoder =
- codec.plfreq == 16000 ? isac_decoder_16k_ : isac_decoder_32k_;
- if (!saved_isac_decoder) {
- saved_isac_decoder = isac_factory();
- }
- isac_decoder = saved_isac_decoder.get();
- }
- return receiver_.AddCodec(*codec_index, codec.pltype, codec.channels,
- codec.plfreq, isac_decoder, codec.plname);
-}
-
-int AudioCodingModuleImpl::RegisterExternalReceiveCodec(
- int rtp_payload_type,
- AudioDecoder* external_decoder,
- int sample_rate_hz,
- int num_channels,
- const std::string& name) {
- rtc::CritScope lock(&acm_crit_sect_);
- RTC_DCHECK(receiver_initialized_);
- if (num_channels > 2 || num_channels < 0) {
- LOG_F(LS_ERROR) << "Unsupported number of channels: " << num_channels;
- return -1;
- }
-
- // Check if the payload-type is valid.
- if (!acm2::RentACodec::IsPayloadTypeValid(rtp_payload_type)) {
- LOG_F(LS_ERROR) << "Invalid payload-type " << rtp_payload_type
- << " for external decoder.";
- return -1;
- }
-
- return receiver_.AddCodec(-1 /* external */, rtp_payload_type, num_channels,
- sample_rate_hz, external_decoder, name);
-}
-
// Get current received codec.
int AudioCodingModuleImpl::ReceiveCodec(CodecInst* current_codec) const {
rtc::CritScope lock(&acm_crit_sect_);
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/include/audio_coding_module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698