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

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

Issue 1725143003: Changed AudioEncoder::Encode to take an rtc::Buffer* instead of uint8_t* and a maximum size. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added more fixes for override hiding in AudioEncoder implementations. Created 4 years, 10 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
Index: webrtc/modules/audio_coding/acm2/audio_coding_module_unittest_oldapi.cc
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 f169d0500872c18a868d2a74d803548b9f4af03a..00c1f04f77bf89f381313dfa931595b549bebc0f 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
@@ -774,8 +774,7 @@ class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
bool CbReceiveImpl() {
SleepMs(1);
- const size_t max_encoded_bytes = isac_encoder_->MaxEncodedBytes();
- std::unique_ptr<uint8_t[]> encoded(new uint8_t[max_encoded_bytes]);
+ rtc::Buffer encoded;
AudioEncoder::EncodedInfo info;
{
rtc::CritScope lock(&crit_sect_);
@@ -790,7 +789,7 @@ class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
while (info.encoded_bytes == 0) {
info =
isac_encoder_->Encode(input_timestamp, audio_loop_.GetNextBlock(),
- max_encoded_bytes, encoded.get());
+ &encoded);
input_timestamp += 160; // 10 ms at 16 kHz.
}
EXPECT_EQ(rtp_header_.header.timestamp + kPacketSizeSamples,
@@ -801,7 +800,7 @@ class AcmReRegisterIsacMtTestOldApi : public AudioCodingModuleTestOldApi {
// Now we're not holding the crit sect when calling ACM.
// Insert into ACM.
- EXPECT_EQ(0, acm_->IncomingPacket(encoded.get(), info.encoded_bytes,
+ EXPECT_EQ(0, acm_->IncomingPacket(encoded.data(), info.encoded_bytes,
rtp_header_));
// Pull audio.
@@ -1633,9 +1632,6 @@ TEST_F(AcmSenderBitExactnessOldApi, External_Pcmu_20ms) {
MockAudioEncoder mock_encoder;
// Set expectations on the mock encoder and also delegate the calls to the
// real encoder.
- EXPECT_CALL(mock_encoder, MaxEncodedBytes())
- .Times(AtLeast(1))
- .WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::MaxEncodedBytes));
EXPECT_CALL(mock_encoder, SampleRateHz())
.Times(AtLeast(1))
.WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::SampleRateHz));
@@ -1652,9 +1648,14 @@ 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, EncodeInternal(_, _, _))
.Times(AtLeast(1))
- .WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::EncodeInternal));
+ .WillRepeatedly(Invoke(&encoder,
+ static_cast<
+ AudioEncoder::EncodedInfo(AudioEncoder::*)(
+ uint32_t,
+ rtc::ArrayView<const int16_t>,
+ rtc::Buffer*)>(&AudioEncoderPcmU::Encode)));
EXPECT_CALL(mock_encoder, SetFec(_))
.Times(AtLeast(1))
.WillRepeatedly(Invoke(&encoder, &AudioEncoderPcmU::SetFec));

Powered by Google App Engine
This is Rietveld 408576698