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

Unified Diff: webrtc/modules/audio_coding/codecs/cng/audio_encoder_cng_unittest.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: Reverted unnecessary change to buffer_unittest.cc 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/codecs/cng/audio_encoder_cng_unittest.cc
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 fbfd999d39855b067299566a912368ef4eb46778..e191dd03b98486fe58d501cd0c72de4b2aebd68a 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
@@ -70,7 +70,6 @@ class AudioEncoderCngTest : public ::testing::Test {
EXPECT_CALL(mock_encoder_, MaxEncodedBytes())
.WillRepeatedly(Return(kMockMaxEncodedBytes));
cng_.reset(new AudioEncoderCng(config_));
- encoded_.resize(cng_->MaxEncodedBytes(), 0);
}
void Encode() {
@@ -78,7 +77,7 @@ class AudioEncoderCngTest : public ::testing::Test {
encoded_info_ = cng_->Encode(
timestamp_,
rtc::ArrayView<const int16_t>(audio_, num_audio_samples_10ms_),
- encoded_.size(), &encoded_[0]);
+ &encoded_);
timestamp_ += static_cast<uint32_t>(num_audio_samples_10ms_);
}
@@ -89,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_, EncodeInternal(_, _, _))
.WillOnce(Return(info));
}
info.encoded_bytes = kMockReturnEncodedBytes;
- EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _, _))
+ EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _))
.WillOnce(Return(info));
}
@@ -108,7 +107,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_, EncodeInternal(_, _, _)).Times(0);
for (size_t i = 0; i < blocks_per_frame - 1; ++i) {
Encode();
EXPECT_EQ(0u, encoded_info_.encoded_bytes);
@@ -191,7 +190,7 @@ class AudioEncoderCngTest : public ::testing::Test {
uint32_t timestamp_;
int16_t audio_[kMaxNumSamples];
size_t num_audio_samples_10ms_;
- std::vector<uint8_t> encoded_;
+ rtc::Buffer encoded_;
AudioEncoder::EncodedInfo encoded_info_;
int sample_rate_hz_;
};
@@ -259,7 +258,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_, EncodeInternal(_, _, _)).Times(0);
uint32_t expected_timestamp = timestamp_;
for (size_t i = 0; i < 100; ++i) {
Encode();
@@ -341,7 +340,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_, EncodeInternal(_, _, _)).Times(0);
EXPECT_CALL(mock_encoder_, Num10MsFramesInNextPacket()).WillOnce(Return(1U));
EXPECT_CALL(*mock_vad_, VoiceActivity(_, _, _))
.WillOnce(Return(Vad::kPassive));
@@ -375,7 +374,7 @@ TEST_F(AudioEncoderCngTest, VerifySidFrameAfterSpeech) {
.WillOnce(Return(Vad::kActive));
AudioEncoder::EncodedInfo info;
info.encoded_bytes = kMockReturnEncodedBytes;
- EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _, _)).WillOnce(Return(info));
+ EXPECT_CALL(mock_encoder_, EncodeInternal(_, _, _)).WillOnce(Return(info));
Encode();
EXPECT_EQ(kMockReturnEncodedBytes, encoded_info_.encoded_bytes);

Powered by Google App Engine
This is Rietveld 408576698