Chromium Code Reviews

Unified Diff: webrtc/modules/audio_coding/neteq/neteq_unittest.cc

Issue 2365653004: AudioCodingModule: Specify decoders using SdpAudioFormat (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: webrtc/modules/audio_coding/neteq/neteq_unittest.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
index 4b6e5d7ac8ca257b6e45aa4823564b317c43772e..d6c2327572a9a3e5aa68646b9d0288699b3cdf2e 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_unittest.cc
@@ -42,6 +42,8 @@
DEFINE_bool(gen_ref, false, "Generate reference files.");
+namespace webrtc {
+
namespace {
const std::string& PlatformChecksum(const std::string& checksum_general,
@@ -107,52 +109,42 @@ void AddMessage(FILE* file, rtc::MessageDigest* digest,
#endif // WEBRTC_NETEQ_UNITTEST_BITEXACT
void LoadDecoders(webrtc::NetEq* neteq) {
- // Load PCMu.
- ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderPCMu,
- "pcmu", 0));
- // Load PCMa.
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(0, SdpAudioFormat("pcmu", 8000, 1)));
+ // Use non-SdpAudioFormat argument when registering PCMa, so that we get test
+ // coverage for that as well.
ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderPCMa,
"pcma", 8));
#ifdef WEBRTC_CODEC_ILBC
- // Load iLBC.
- ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderILBC,
- "ilbc", 102));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(102, SdpAudioFormat("ilbc", 8000, 1)));
#endif
#if defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)
- // Load iSAC.
- ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderISAC,
- "isac", 103));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(103, SdpAudioFormat("isac", 16000, 1)));
#endif
#ifdef WEBRTC_CODEC_ISAC
- // Load iSAC SWB.
- ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderISACswb,
- "isac-swb", 104));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(104, SdpAudioFormat("isac", 32000, 1)));
#endif
#ifdef WEBRTC_CODEC_OPUS
- ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderOpus,
- "opus", 111));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(
+ 111, SdpAudioFormat("opus", 48000, 2, {{"stereo", "0"}})));
#endif
- // Load PCM16B nb.
- ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderPCM16B,
- "pcm16-nb", 93));
- // Load PCM16B wb.
- ASSERT_EQ(0, neteq->RegisterPayloadType(
- webrtc::NetEqDecoder::kDecoderPCM16Bwb, "pcm16-wb", 94));
- // Load PCM16B swb32.
- ASSERT_EQ(
- 0, neteq->RegisterPayloadType(
- webrtc::NetEqDecoder::kDecoderPCM16Bswb32kHz, "pcm16-swb32", 95));
- // Load CNG 8 kHz.
- ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderCNGnb,
- "cng-nb", 13));
- // Load CNG 16 kHz.
- ASSERT_EQ(0, neteq->RegisterPayloadType(webrtc::NetEqDecoder::kDecoderCNGwb,
- "cng-wb", 98));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(93, SdpAudioFormat("L16", 8000, 1)));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(94, SdpAudioFormat("L16", 16000, 1)));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(95, SdpAudioFormat("L16", 32000, 1)));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(13, SdpAudioFormat("cn", 8000, 1)));
+ ASSERT_EQ(true,
+ neteq->RegisterPayloadType(98, SdpAudioFormat("cn", 16000, 1)));
}
} // namespace
-namespace webrtc {
-
class ResultSink {
public:
explicit ResultSink(const std::string& output_file);

Powered by Google App Engine