From 4f43fcfd496485e5dc866231de0fd1d298442cfa Mon Sep 17 00:00:00 2001 From: ossu Date: Fri, 4 Mar 2016 00:54:32 -0800 Subject: [PATCH] Renamed new EncodeInternal to EncodeImpl to ensure proper backwards compatibility. Renamed the new variant of EncodeInternal to EncodeImpl, so that subclasses implementing one of the EncodeInternal don't need to explicitly contain 'using AudioEncoder::EncodeInternal' to avoid their implementation hiding the other variant of EncodeInternal. This causes a warning (treated as an error) when building using GCC. Review URL: https://codereview.webrtc.org/1764583003 Cr-Commit-Position: refs/heads/master@{#11868} --- .../audio_coding_module_unittest_oldapi.cc | 2 +- .../acm2/rent_a_codec_unittest.cc | 4 ++-- .../audio_coding/codecs/audio_encoder.cc | 6 ++--- .../audio_coding/codecs/audio_encoder.h | 22 +++++++++---------- .../codecs/audio_encoder_unittest.cc | 2 +- .../codecs/cng/audio_encoder_cng.cc | 2 +- .../codecs/cng/audio_encoder_cng.h | 8 +++---- .../codecs/cng/audio_encoder_cng_unittest.cc | 12 +++++----- .../codecs/g711/audio_encoder_pcm.cc | 2 +- .../codecs/g711/audio_encoder_pcm.h | 8 +++---- .../codecs/g722/audio_encoder_g722.cc | 2 +- .../codecs/g722/audio_encoder_g722.h | 8 +++---- .../codecs/ilbc/audio_encoder_ilbc.cc | 2 +- .../codecs/ilbc/audio_encoder_ilbc.h | 8 +++---- .../codecs/isac/audio_encoder_isac_t.h | 8 +++---- .../codecs/isac/audio_encoder_isac_t_impl.h | 2 +- .../codecs/mock/mock_audio_encoder.h | 6 +---- .../codecs/opus/audio_encoder_opus.cc | 2 +- .../codecs/opus/audio_encoder_opus.h | 8 +++---- .../codecs/pcm16b/audio_encoder_pcm16b.h | 2 -- .../codecs/red/audio_encoder_copy_red.cc | 2 +- .../codecs/red/audio_encoder_copy_red.h | 8 +++---- .../red/audio_encoder_copy_red_unittest.cc | 18 +++++++-------- 23 files changed, 62 insertions(+), 82 deletions(-) diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc index 00c1f04f77..463ff7b2ed 100644 --- a/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc +++ b/webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc @@ -1648,7 +1648,7 @@ TEST_F(AcmSenderBitExactnessOldApi, External_Pcmu_20ms) { EXPECT_CALL(mock_encoder, GetTargetBitrate()) .Times(AtLeast(1)) .WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::GetTargetBitrate)); - EXPECT_CALL(mock_encoder, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder, EncodeImpl(_, _, _)) .Times(AtLeast(1)) .WillRepeatedly(Invoke(&encoder, static_cast< diff --git a/webrtc/modules/audio_coding/acm2/rent_a_codec_unittest.cc b/webrtc/modules/audio_coding/acm2/rent_a_codec_unittest.cc index bc68f155bb..8cc59d6151 100644 --- a/webrtc/modules/audio_coding/acm2/rent_a_codec_unittest.cc +++ b/webrtc/modules/audio_coding/acm2/rent_a_codec_unittest.cc @@ -122,14 +122,14 @@ TEST(RentACodecTest, ExternalEncoder) { ::testing::InSequence s; info.encoded_timestamp = 0; EXPECT_CALL(external_encoder, - EncodeInternal(0, rtc::ArrayView(audio), + EncodeImpl(0, rtc::ArrayView(audio), &encoded)) .WillOnce(Return(info)); EXPECT_CALL(external_encoder, Mark("A")); EXPECT_CALL(external_encoder, Mark("B")); info.encoded_timestamp = 2; EXPECT_CALL(external_encoder, - EncodeInternal(2, rtc::ArrayView(audio), + EncodeImpl(2, rtc::ArrayView(audio), &encoded)) .WillOnce(Return(info)); EXPECT_CALL(external_encoder, Die()); diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.cc b/webrtc/modules/audio_coding/codecs/audio_encoder.cc index 0520918f9f..6f793e2531 100644 --- a/webrtc/modules/audio_coding/codecs/audio_encoder.cc +++ b/webrtc/modules/audio_coding/codecs/audio_encoder.cc @@ -32,7 +32,7 @@ AudioEncoder::EncodedInfo AudioEncoder::Encode( static_cast(NumChannels() * SampleRateHz() / 100)); const size_t old_size = encoded->size(); - EncodedInfo info = EncodeInternal(rtp_timestamp, audio, encoded); + EncodedInfo info = EncodeImpl(rtp_timestamp, audio, encoded); RTC_CHECK_EQ(encoded->size() - old_size, info.encoded_bytes); return info; } @@ -59,7 +59,7 @@ AudioEncoder::EncodedInfo AudioEncoder::DEPRECATED_Encode( return info; } -AudioEncoder::EncodedInfo AudioEncoder::EncodeInternal( +AudioEncoder::EncodedInfo AudioEncoder::EncodeImpl( uint32_t rtp_timestamp, rtc::ArrayView audio, rtc::Buffer* encoded) @@ -80,7 +80,7 @@ AudioEncoder::EncodedInfo AudioEncoder::EncodeInternal( uint8_t* encoded) { rtc::Buffer temp_buffer; - EncodedInfo info = EncodeInternal(rtp_timestamp, audio, &temp_buffer); + EncodedInfo info = EncodeImpl(rtp_timestamp, audio, &temp_buffer); RTC_DCHECK_LE(temp_buffer.size(), max_encoded_bytes); std::memcpy(encoded, temp_buffer.data(), info.encoded_bytes); return info; diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.h b/webrtc/modules/audio_coding/codecs/audio_encoder.h index 8da7ebd728..3fdee259ce 100644 --- a/webrtc/modules/audio_coding/codecs/audio_encoder.h +++ b/webrtc/modules/audio_coding/codecs/audio_encoder.h @@ -89,7 +89,7 @@ class AudioEncoder { // NumChannels() samples). Multi-channel audio must be sample-interleaved. // The encoder appends zero or more bytes of output to |encoded| and returns // additional encoding information. Encode() checks some preconditions, calls - // EncodeInternal() which does the actual work, and then checks some + // EncodeImpl() which does the actual work, and then checks some // postconditions. EncodedInfo Encode(uint32_t rtp_timestamp, rtc::ArrayView audio, @@ -110,12 +110,12 @@ class AudioEncoder { size_t max_encoded_bytes, uint8_t* encoded); - // Deprecated interface of EncodeInternal (also bug 5591). May incur a copy. + // Deprecated interface EncodeInternal (see bug 5591). May incur a copy. // Subclasses implement this to perform the actual encoding. Called by // Encode(). By default, this is implemented as a call to the newer - // EncodeInternal() that accepts an rtc::Buffer instead of a raw pointer. - // That version is protected, so see below. At least one of the two - // interfaces of EncodeInternal _must_ be implemented by a subclass. + // EncodeImpl() that accepts an rtc::Buffer instead of a raw pointer. + // That version is protected, so see below. At least one of EncodeInternal + // or EncodeImpl _must_ be implemented by a subclass. virtual EncodedInfo EncodeInternal( uint32_t rtp_timestamp, rtc::ArrayView audio, @@ -163,12 +163,12 @@ class AudioEncoder { protected: // Subclasses implement this to perform the actual encoding. Called by // Encode(). For compatibility reasons, this is implemented by default as a - // call to the older version of EncodeInternal(). At least one of the two - // interfaces of EncodeInternal _must_ be implemented by a subclass. - // Preferably this one. - virtual EncodedInfo EncodeInternal(uint32_t rtp_timestamp, - rtc::ArrayView audio, - rtc::Buffer* encoded); + // call to the older interface EncodeInternal(). At least one of + // EncodeInternal or EncodeImpl _must_ be implemented by a + // subclass. Preferably this one. + virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp, + rtc::ArrayView audio, + rtc::Buffer* encoded); }; } // namespace webrtc #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_ diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder_unittest.cc b/webrtc/modules/audio_coding/codecs/audio_encoder_unittest.cc index 8252c6a250..71ffcde323 100644 --- a/webrtc/modules/audio_coding/codecs/audio_encoder_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/audio_encoder_unittest.cc @@ -37,7 +37,7 @@ TEST(AudioEncoderTest, EncodeInternalRedirectsOk) { EXPECT_CALL(old_impl, EncodeInternal(_, _, _, _)).WillOnce( Invoke(MockAudioEncoderDeprecated::CopyEncoding(payload))); - EXPECT_CALL(new_impl, EncodeInternal(_, _, _)).WillOnce( + EXPECT_CALL(new_impl, EncodeImpl(_, _, _)).WillOnce( Invoke(MockAudioEncoder::CopyEncoding(payload))); int16_t audio[80]; diff --git a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc index ab699cae79..5daf7be304 100644 --- a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc +++ b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.cc @@ -97,7 +97,7 @@ int AudioEncoderCng::GetTargetBitrate() const { return speech_encoder_->GetTargetBitrate(); } -AudioEncoder::EncodedInfo AudioEncoderCng::EncodeInternal( +AudioEncoder::EncodedInfo AudioEncoderCng::EncodeImpl( uint32_t rtp_timestamp, rtc::ArrayView audio, rtc::Buffer* encoded) { diff --git a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.h b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.h index 3c24260774..b581e32082 100644 --- a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.h +++ b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng.h @@ -30,8 +30,6 @@ class Vad; class AudioEncoderCng final : public AudioEncoder { public: - using AudioEncoder::EncodeInternal; - struct Config { bool IsOk() const; @@ -59,9 +57,9 @@ class AudioEncoderCng final : public AudioEncoder { size_t Num10MsFramesInNextPacket() const override; size_t Max10MsFramesInAPacket() const override; int GetTargetBitrate() const override; - EncodedInfo EncodeInternal(uint32_t rtp_timestamp, - rtc::ArrayView audio, - rtc::Buffer* encoded) override; + EncodedInfo EncodeImpl(uint32_t rtp_timestamp, + rtc::ArrayView audio, + rtc::Buffer* encoded) override; void Reset() override; bool SetFec(bool enable) override; bool SetDtx(bool enable) override; diff --git a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc index 459ccb58c0..a4416c955a 100644 --- a/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.cc @@ -88,11 +88,11 @@ class AudioEncoderCngTest : public ::testing::Test { InSequence s; AudioEncoder::EncodedInfo info; for (size_t j = 0; j < num_calls - 1; ++j) { - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillOnce(Return(info)); } info.encoded_bytes = kMockReturnEncodedBytes; - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillOnce(Invoke( MockAudioEncoder::FakeEncoding(kMockReturnEncodedBytes))); } @@ -108,7 +108,7 @@ class AudioEncoderCngTest : public ::testing::Test { .WillRepeatedly(Return(active_speech ? Vad::kActive : Vad::kPassive)); // Don't expect any calls to the encoder yet. - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)).Times(0); + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)).Times(0); for (size_t i = 0; i < blocks_per_frame - 1; ++i) { Encode(); EXPECT_EQ(0u, encoded_info_.encoded_bytes); @@ -259,7 +259,7 @@ TEST_F(AudioEncoderCngTest, EncodePassive) { EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _)) .WillRepeatedly(Return(Vad::kPassive)); // Expect no calls at all to the speech encoder mock. - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)).Times(0); + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)).Times(0); uint32_t expected_timestamp = timestamp_; for (size_t i = 0; i < 100; ++i) { Encode(); @@ -341,7 +341,7 @@ TEST_F(AudioEncoderCngTest, VadInputSize60Ms) { // Verifies that the correct payload type is set when CNG is encoded. TEST_F(AudioEncoderCngTest, VerifyCngPayloadType) { CreateCng(); - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)).Times(0); + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)).Times(0); EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket()).WillOnce(Return(1U)); EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _)) .WillOnce(Return(Vad::kPassive)); @@ -373,7 +373,7 @@ TEST_F(AudioEncoderCngTest, VerifySidFrameAfterSpeech) { encoded_info_.payload_type = 0; EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _)) .WillOnce(Return(Vad::kActive)); - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)).WillOnce( + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)).WillOnce( Invoke(MockAudioEncoder::FakeEncoding(kMockReturnEncodedBytes))); Encode(); EXPECT_EQ(kMockReturnEncodedBytes, encoded_info_.encoded_bytes); diff --git a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc index d850675244..a24b1526fd 100644 --- a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc +++ b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc @@ -77,7 +77,7 @@ int AudioEncoderPcm::GetTargetBitrate() const { 8 * BytesPerSample() * SampleRateHz() * NumChannels()); } -AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal( +AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeImpl( uint32_t rtp_timestamp, rtc::ArrayView audio, rtc::Buffer* encoded) { diff --git a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h index 0b8baab209..6b3cebfb33 100644 --- a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h +++ b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.h @@ -20,8 +20,6 @@ namespace webrtc { class AudioEncoderPcm : public AudioEncoder { public: - using AudioEncoder::EncodeInternal; - struct Config { public: bool IsOk() const; @@ -48,9 +46,9 @@ class AudioEncoderPcm : public AudioEncoder { protected: AudioEncoderPcm(const Config& config, int sample_rate_hz); - EncodedInfo EncodeInternal(uint32_t rtp_timestamp, - rtc::ArrayView audio, - rtc::Buffer* encoded) override; + EncodedInfo EncodeImpl(uint32_t rtp_timestamp, + rtc::ArrayView audio, + rtc::Buffer* encoded) override; virtual size_t EncodeCall(const int16_t* audio, size_t input_len, diff --git a/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc b/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc index 57d95947c3..9256518445 100644 --- a/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc +++ b/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.cc @@ -97,7 +97,7 @@ void AudioEncoderG722::Reset() { RTC_CHECK_EQ(0, WebRtcG722_EncoderInit(encoders_[i].encoder)); } -AudioEncoder::EncodedInfo AudioEncoderG722::EncodeInternal( +AudioEncoder::EncodedInfo AudioEncoderG722::EncodeImpl( uint32_t rtp_timestamp, rtc::ArrayView audio, rtc::Buffer* encoded) { diff --git a/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h b/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h index 0d7b919aa2..dec87b2b7a 100644 --- a/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h +++ b/webrtc/modules/audio_coding/codecs/g722/audio_encoder_g722.h @@ -23,8 +23,6 @@ struct CodecInst; class AudioEncoderG722 final : public AudioEncoder { public: - using AudioEncoder::EncodeInternal; - struct Config { bool IsOk() const; @@ -47,9 +45,9 @@ class AudioEncoderG722 final : public AudioEncoder { void Reset() override; protected: - EncodedInfo EncodeInternal(uint32_t rtp_timestamp, - rtc::ArrayView audio, - rtc::Buffer* encoded) override; + EncodedInfo EncodeImpl(uint32_t rtp_timestamp, + rtc::ArrayView audio, + rtc::Buffer* encoded) override; private: // The encoder state for one channel. diff --git a/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc b/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc index 419fdfb54a..c7d7411c45 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc +++ b/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.cc @@ -89,7 +89,7 @@ int AudioEncoderIlbc::GetTargetBitrate() const { } } -AudioEncoder::EncodedInfo AudioEncoderIlbc::EncodeInternal( +AudioEncoder::EncodedInfo AudioEncoderIlbc::EncodeImpl( uint32_t rtp_timestamp, rtc::ArrayView audio, rtc::Buffer* encoded) { diff --git a/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h b/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h index e0ba289d76..27329bbc4e 100644 --- a/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h +++ b/webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h @@ -21,8 +21,6 @@ struct CodecInst; class AudioEncoderIlbc final : public AudioEncoder { public: - using AudioEncoder::EncodeInternal; - struct Config { bool IsOk() const; @@ -42,9 +40,9 @@ class AudioEncoderIlbc final : public AudioEncoder { size_t Num10MsFramesInNextPacket() const override; size_t Max10MsFramesInAPacket() const override; int GetTargetBitrate() const override; - EncodedInfo EncodeInternal(uint32_t rtp_timestamp, - rtc::ArrayView audio, - rtc::Buffer* encoded) override; + EncodedInfo EncodeImpl(uint32_t rtp_timestamp, + rtc::ArrayView audio, + rtc::Buffer* encoded) override; void Reset() override; private: diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h index 2e15fb5620..e840f3b1b1 100644 --- a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h +++ b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h @@ -23,8 +23,6 @@ struct CodecInst; template class AudioEncoderIsacT final : public AudioEncoder { public: - using AudioEncoder::EncodeInternal; - // Allowed combinations of sample rate, frame size, and bit rate are // - 16000 Hz, 30 ms, 10000-32000 bps // - 16000 Hz, 60 ms, 10000-32000 bps @@ -62,9 +60,9 @@ class AudioEncoderIsacT final : public AudioEncoder { size_t Num10MsFramesInNextPacket() const override; size_t Max10MsFramesInAPacket() const override; int GetTargetBitrate() const override; - EncodedInfo EncodeInternal(uint32_t rtp_timestamp, - rtc::ArrayView audio, - rtc::Buffer* encoded) override; + EncodedInfo EncodeImpl(uint32_t rtp_timestamp, + rtc::ArrayView audio, + rtc::Buffer* encoded) override; void Reset() override; private: diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h index 3832216d57..3ad0f27d4b 100644 --- a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h +++ b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h @@ -114,7 +114,7 @@ int AudioEncoderIsacT::GetTargetBitrate() const { } template -AudioEncoder::EncodedInfo AudioEncoderIsacT::EncodeInternal( +AudioEncoder::EncodedInfo AudioEncoderIsacT::EncodeImpl( uint32_t rtp_timestamp, rtc::ArrayView audio, rtc::Buffer* encoded) { diff --git a/webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h b/webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h index 09cd078953..58a1e756f9 100644 --- a/webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h +++ b/webrtc/modules/audio_coding/codecs/mock/mock_audio_encoder.h @@ -43,10 +43,8 @@ class MockAudioEncoderBase : public AudioEncoder { class MockAudioEncoder final : public MockAudioEncoderBase { public: - using AudioEncoder::EncodeInternal; - // Note, we explicitly chose not to create a mock for the Encode method. - MOCK_METHOD3(EncodeInternal, + MOCK_METHOD3(EncodeImpl, EncodedInfo(uint32_t timestamp, rtc::ArrayView audio, rtc::Buffer* encoded)); @@ -96,8 +94,6 @@ class MockAudioEncoder final : public MockAudioEncoderBase { class MockAudioEncoderDeprecated final : public MockAudioEncoderBase { public: - using AudioEncoder::EncodeInternal; - // Note, we explicitly chose not to create a mock for the Encode method. MOCK_METHOD4(EncodeInternal, EncodedInfo(uint32_t timestamp, diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc index 1f68e154ce..a599e291d4 100644 --- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc +++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.cc @@ -182,7 +182,7 @@ void AudioEncoderOpus::SetTargetBitrate(int bits_per_second) { RTC_CHECK_EQ(0, WebRtcOpus_SetBitRate(inst_, config_.bitrate_bps)); } -AudioEncoder::EncodedInfo AudioEncoderOpus::EncodeInternal( +AudioEncoder::EncodedInfo AudioEncoderOpus::EncodeImpl( uint32_t rtp_timestamp, rtc::ArrayView audio, rtc::Buffer* encoded) { diff --git a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h index 343acd7bd0..3f11af1f9e 100644 --- a/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h +++ b/webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h @@ -23,8 +23,6 @@ struct CodecInst; class AudioEncoderOpus final : public AudioEncoder { public: - using AudioEncoder::EncodeInternal; - enum ApplicationMode { kVoip = 0, kAudio = 1, @@ -82,9 +80,9 @@ class AudioEncoderOpus final : public AudioEncoder { bool dtx_enabled() const { return config_.dtx_enabled; } protected: - EncodedInfo EncodeInternal(uint32_t rtp_timestamp, - rtc::ArrayView audio, - rtc::Buffer* encoded) override; + EncodedInfo EncodeImpl(uint32_t rtp_timestamp, + rtc::ArrayView audio, + rtc::Buffer* encoded) override; private: size_t Num10msFramesPerPacket() const; diff --git a/webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h b/webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h index d298b992ba..34a780b49d 100644 --- a/webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h +++ b/webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h @@ -19,8 +19,6 @@ struct CodecInst; class AudioEncoderPcm16B final : public AudioEncoderPcm { public: - using AudioEncoder::EncodeInternal; - struct Config : public AudioEncoderPcm::Config { public: Config() : AudioEncoderPcm::Config(107), sample_rate_hz(8000) {} diff --git a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc index 1dde49d1ba..b5a124e43d 100644 --- a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc +++ b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.cc @@ -52,7 +52,7 @@ int AudioEncoderCopyRed::GetTargetBitrate() const { return speech_encoder_->GetTargetBitrate(); } -AudioEncoder::EncodedInfo AudioEncoderCopyRed::EncodeInternal( +AudioEncoder::EncodedInfo AudioEncoderCopyRed::EncodeImpl( uint32_t rtp_timestamp, rtc::ArrayView audio, rtc::Buffer* encoded) { diff --git a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h index 48cec6549d..2aa8edcfcd 100644 --- a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h +++ b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h @@ -24,8 +24,6 @@ namespace webrtc { // into one packet. class AudioEncoderCopyRed final : public AudioEncoder { public: - using AudioEncoder::EncodeInternal; - struct Config { public: int payload_type; @@ -53,9 +51,9 @@ class AudioEncoderCopyRed final : public AudioEncoder { void SetTargetBitrate(int target_bps) override; protected: - EncodedInfo EncodeInternal(uint32_t rtp_timestamp, - rtc::ArrayView audio, - rtc::Buffer* encoded) override; + EncodedInfo EncodeImpl(uint32_t rtp_timestamp, + rtc::ArrayView audio, + rtc::Buffer* encoded) override; private: AudioEncoder* speech_encoder_; diff --git a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc index 74b3f30087..fefcbe22f8 100644 --- a/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red_unittest.cc @@ -115,12 +115,12 @@ TEST_F(AudioEncoderCopyRedTest, CheckProjectedPacketLossRatePropagation) { // encoder. TEST_F(AudioEncoderCopyRedTest, CheckImmediateEncode) { // Interleaving the EXPECT_CALL sequence with expectations on the MockFunction - // check ensures that exactly one call to EncodeInternal happens in each + // check ensures that exactly one call to EncodeImpl happens in each // Encode call. InSequence s; MockFunction check; for (int i = 1; i <= 6; ++i) { - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillRepeatedly(Return(AudioEncoder::EncodedInfo())); EXPECT_CALL(check, Call(i)); Encode(); @@ -134,7 +134,7 @@ TEST_F(AudioEncoderCopyRedTest, CheckNoOutput) { static const size_t kEncodedSize = 17; { InSequence s; - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillOnce(Invoke(MockAudioEncoder::FakeEncoding(kEncodedSize))) .WillOnce(Invoke(MockAudioEncoder::FakeEncoding(0))) .WillOnce(Invoke(MockAudioEncoder::FakeEncoding(kEncodedSize))); @@ -165,7 +165,7 @@ TEST_F(AudioEncoderCopyRedTest, CheckPayloadSizes) { static const int kNumPackets = 10; InSequence s; for (int encode_size = 1; encode_size <= kNumPackets; ++encode_size) { - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillOnce(Invoke(MockAudioEncoder::FakeEncoding(encode_size))); } @@ -191,7 +191,7 @@ TEST_F(AudioEncoderCopyRedTest, CheckTimestamps) { info.encoded_bytes = 17; info.encoded_timestamp = timestamp_; - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillOnce(Invoke(MockAudioEncoder::FakeEncoding(info))); // First call is a special case, since it does not include a secondary @@ -202,7 +202,7 @@ TEST_F(AudioEncoderCopyRedTest, CheckTimestamps) { uint32_t secondary_timestamp = primary_timestamp; primary_timestamp = timestamp_; info.encoded_timestamp = timestamp_; - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillOnce(Invoke(MockAudioEncoder::FakeEncoding(info))); Encode(); @@ -221,7 +221,7 @@ TEST_F(AudioEncoderCopyRedTest, CheckPayloads) { for (uint8_t i = 0; i < kPayloadLenBytes; ++i) { payload[i] = i; } - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillRepeatedly(Invoke(MockAudioEncoder::CopyEncoding(payload))); // First call is a special case, since it does not include a secondary @@ -257,7 +257,7 @@ TEST_F(AudioEncoderCopyRedTest, CheckPayloadType) { AudioEncoder::EncodedInfo info; info.encoded_bytes = 17; info.payload_type = primary_payload_type; - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillOnce(Invoke(MockAudioEncoder::FakeEncoding(info))); // First call is a special case, since it does not include a secondary @@ -269,7 +269,7 @@ TEST_F(AudioEncoderCopyRedTest, CheckPayloadType) { const int secondary_payload_type = red_payload_type_ + 2; info.payload_type = secondary_payload_type; - EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)) + EXPECT_CALL(mock_encoder_, EncodeImpl(_, _, _)) .WillOnce(Invoke(MockAudioEncoder::FakeEncoding(info))); Encode();