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

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

Issue 2393873002: Remove old AcmReceiver::AddCodec overload
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
Index: webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc
diff --git a/webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc b/webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc
index ce7e8fcb7cfafdca02559a85dbe605e3394e040c..5ca9aae8bfecbf9896e2c3f81cafd4519c156266 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc
+++ b/webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc
@@ -15,6 +15,7 @@
#include "webrtc/base/checks.h"
#include "webrtc/base/safe_conversions.h"
+#include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
@@ -119,9 +120,8 @@ class AcmReceiverTestOldApi : public AudioPacketizationCallback,
for (auto id : ids) {
const auto i = RentACodec::CodecIndexFromId(id);
ASSERT_TRUE(i);
- ASSERT_EQ(0, receiver_->AddCodec(*i, codecs_[*i].pltype,
- codecs_[*i].channels, codecs_[*i].plfreq,
- nullptr, codecs_[*i].plname));
+ ASSERT_EQ(true, receiver_->AddCodec(codecs_[*i].pltype,
+ CodecInstToSdp(codecs_[*i])));
}
}
@@ -175,9 +175,8 @@ TEST_F(AcmReceiverTestOldApi, MAYBE_AddCodecGetCodec) {
// Add codec.
for (size_t n = 0; n < codecs_.size(); ++n) {
if (n & 0x1) { // Just add codecs with odd index.
- EXPECT_EQ(
- 0, receiver_->AddCodec(n, codecs_[n].pltype, codecs_[n].channels,
- codecs_[n].plfreq, NULL, codecs_[n].plname));
+ EXPECT_EQ(true, receiver_->AddCodec(codecs_[n].pltype,
+ CodecInstToSdp(codecs_[n])));
}
}
// Get codec and compare.
@@ -208,11 +207,9 @@ TEST_F(AcmReceiverTestOldApi, MAYBE_AddCodecChangePayloadType) {
CodecInst test_codec;
// Register the same codec with different payloads.
- EXPECT_EQ(0, receiver_->AddCodec(codec1.id, codec1.inst.pltype,
- codec1.inst.channels, codec1.inst.plfreq,
- nullptr, codec1.inst.plname));
- EXPECT_EQ(0, receiver_->AddCodec(codec1.id, codec2.pltype, codec2.channels,
- codec2.plfreq, NULL, codec2.plname));
+ EXPECT_EQ(true, receiver_->AddCodec(codec1.inst.pltype,
+ CodecInstToSdp(codec1.inst)));
+ EXPECT_EQ(true, receiver_->AddCodec(codec2.pltype, CodecInstToSdp(codec2)));
// Both payload types should exist.
EXPECT_EQ(0,
@@ -233,13 +230,11 @@ TEST_F(AcmReceiverTestOldApi, AddCodecChangeCodecId) {
codec2.inst.pltype = codec1.inst.pltype;
CodecInst test_codec;
- // Register the same payload type with different codec ID.
- EXPECT_EQ(0, receiver_->AddCodec(codec1.id, codec1.inst.pltype,
- codec1.inst.channels, codec1.inst.plfreq,
- nullptr, codec1.inst.plname));
- EXPECT_EQ(0, receiver_->AddCodec(codec2.id, codec2.inst.pltype,
- codec2.inst.channels, codec2.inst.plfreq,
- nullptr, codec2.inst.plname));
+ // Register the same payload type with different codec.
+ EXPECT_EQ(true, receiver_->AddCodec(codec1.inst.pltype,
+ CodecInstToSdp(codec1.inst)));
+ EXPECT_EQ(true, receiver_->AddCodec(codec2.inst.pltype,
+ CodecInstToSdp(codec2.inst)));
// Make sure that the last codec is used.
EXPECT_EQ(0,
@@ -255,9 +250,8 @@ TEST_F(AcmReceiverTestOldApi, AddCodecChangeCodecId) {
TEST_F(AcmReceiverTestOldApi, MAYBE_AddCodecRemoveCodec) {
const CodecIdInst codec(RentACodec::CodecId::kPCMA);
const int payload_type = codec.inst.pltype;
- EXPECT_EQ(
- 0, receiver_->AddCodec(codec.id, codec.inst.pltype, codec.inst.channels,
- codec.inst.plfreq, nullptr, codec.inst.plname));
+ EXPECT_EQ(true,
+ receiver_->AddCodec(codec.inst.pltype, CodecInstToSdp(codec.inst)));
// Remove non-existing codec should not fail. ACM1 legacy.
EXPECT_EQ(0, receiver_->RemoveCodec(payload_type + 1));
@@ -386,9 +380,8 @@ TEST_F(AcmReceiverTestFaxModeOldApi, MAYBE_VerifyAudioFrameOpus) {
TEST_F(AcmReceiverTestOldApi, MAYBE_PostdecodingVad) {
EXPECT_TRUE(config_.neteq_config.enable_post_decode_vad);
const CodecIdInst codec(RentACodec::CodecId::kPCM16Bwb);
- ASSERT_EQ(
- 0, receiver_->AddCodec(codec.id, codec.inst.pltype, codec.inst.channels,
- codec.inst.plfreq, nullptr, ""));
+ ASSERT_EQ(true,
+ receiver_->AddCodec(codec.inst.pltype, CodecInstToSdp(codec.inst)));
const int kNumPackets = 5;
const int num_10ms_frames = codec.inst.pacsize / (codec.inst.plfreq / 100);
AudioFrame frame;
@@ -417,9 +410,8 @@ class AcmReceiverTestPostDecodeVadPassiveOldApi : public AcmReceiverTestOldApi {
TEST_F(AcmReceiverTestPostDecodeVadPassiveOldApi, MAYBE_PostdecodingVad) {
EXPECT_FALSE(config_.neteq_config.enable_post_decode_vad);
const CodecIdInst codec(RentACodec::CodecId::kPCM16Bwb);
- ASSERT_EQ(
- 0, receiver_->AddCodec(codec.id, codec.inst.pltype, codec.inst.channels,
- codec.inst.plfreq, nullptr, ""));
+ ASSERT_EQ(true,
+ receiver_->AddCodec(codec.inst.pltype, CodecInstToSdp(codec.inst)));
const int kNumPackets = 5;
const int num_10ms_frames = codec.inst.pacsize / (codec.inst.plfreq / 100);
AudioFrame frame;
« no previous file with comments | « webrtc/modules/audio_coding/acm2/acm_receiver.cc ('k') | webrtc/modules/audio_coding/acm2/audio_coding_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698