Delete method DecoderDatabase::RegisterPayload(...NetEqDecoder...)

Bug: webrtc:10185
Change-Id: I69ce40b1c7267b039cd1d2237c5d5bbae3a81875
Reviewed-on: https://webrtc-review.googlesource.com/c/116683
Commit-Queue: Niels Moller <nisse@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26208}
diff --git a/modules/audio_coding/neteq/decoder_database_unittest.cc b/modules/audio_coding/neteq/decoder_database_unittest.cc
index a87def4..0d7e57a 100644
--- a/modules/audio_coding/neteq/decoder_database_unittest.cc
+++ b/modules/audio_coding/neteq/decoder_database_unittest.cc
@@ -36,17 +36,12 @@
 TEST(DecoderDatabase, InsertAndRemove) {
   rtc::scoped_refptr<MockAudioDecoderFactory> factory(
       new rtc::RefCountedObject<MockAudioDecoderFactory>);
-  EXPECT_CALL(*factory, IsSupportedDecoder(_))
-      .WillOnce(Invoke([](const SdpAudioFormat& format) {
-        EXPECT_EQ("pcmu", format.name);
-        return true;
-      }));
   DecoderDatabase db(factory, absl::nullopt);
   const uint8_t kPayloadType = 0;
   const std::string kCodecName = "Robert\'); DROP TABLE Students;";
   EXPECT_EQ(
       DecoderDatabase::kOK,
-      db.RegisterPayload(kPayloadType, NetEqDecoder::kDecoderPCMu, kCodecName));
+      db.RegisterPayload(kPayloadType, SdpAudioFormat(kCodecName, 8000, 1)));
   EXPECT_EQ(1, db.Size());
   EXPECT_FALSE(db.Empty());
   EXPECT_EQ(DecoderDatabase::kOK, db.Remove(kPayloadType));
@@ -57,22 +52,13 @@
 TEST(DecoderDatabase, InsertAndRemoveAll) {
   rtc::scoped_refptr<MockAudioDecoderFactory> factory(
       new rtc::RefCountedObject<MockAudioDecoderFactory>);
-  EXPECT_CALL(*factory, IsSupportedDecoder(_))
-      .WillOnce(Invoke([](const SdpAudioFormat& format) {
-        EXPECT_EQ("pcmu", format.name);
-        return true;
-      }))
-      .WillOnce(Invoke([](const SdpAudioFormat& format) {
-        EXPECT_EQ("pcma", format.name);
-        return true;
-      }));
   DecoderDatabase db(factory, absl::nullopt);
   const std::string kCodecName1 = "Robert\'); DROP TABLE Students;";
   const std::string kCodecName2 = "https://xkcd.com/327/";
   EXPECT_EQ(DecoderDatabase::kOK,
-            db.RegisterPayload(0, NetEqDecoder::kDecoderPCMu, kCodecName1));
+            db.RegisterPayload(0, SdpAudioFormat(kCodecName1, 8000, 1)));
   EXPECT_EQ(DecoderDatabase::kOK,
-            db.RegisterPayload(1, NetEqDecoder::kDecoderPCMa, kCodecName2));
+            db.RegisterPayload(1, SdpAudioFormat(kCodecName2, 8000, 1)));
   EXPECT_EQ(2, db.Size());
   EXPECT_FALSE(db.Empty());
   db.RemoveAll();
@@ -83,11 +69,6 @@
 TEST(DecoderDatabase, GetDecoderInfo) {
   rtc::scoped_refptr<MockAudioDecoderFactory> factory(
       new rtc::RefCountedObject<MockAudioDecoderFactory>);
-  EXPECT_CALL(*factory, IsSupportedDecoder(_))
-      .WillOnce(Invoke([](const SdpAudioFormat& format) {
-        EXPECT_EQ("pcmu", format.name);
-        return true;
-      }));
   auto* decoder = new MockAudioDecoder;
   EXPECT_CALL(*factory, MakeAudioDecoderMock(_, _, _))
       .WillOnce(Invoke([decoder](const SdpAudioFormat& format,
@@ -98,10 +79,10 @@
       }));
   DecoderDatabase db(factory, absl::nullopt);
   const uint8_t kPayloadType = 0;
-  const std::string kCodecName = "Robert\'); DROP TABLE Students;";
+  const std::string kCodecName = "pcmu";
   EXPECT_EQ(
       DecoderDatabase::kOK,
-      db.RegisterPayload(kPayloadType, NetEqDecoder::kDecoderPCMu, kCodecName));
+      db.RegisterPayload(kPayloadType, SdpAudioFormat(kCodecName, 8000, 1)));
   const DecoderDatabase::DecoderInfo* info;
   info = db.GetDecoderInfo(kPayloadType);
   ASSERT_TRUE(info != NULL);
@@ -115,10 +96,8 @@
 TEST(DecoderDatabase, GetDecoder) {
   DecoderDatabase db(CreateBuiltinAudioDecoderFactory(), absl::nullopt);
   const uint8_t kPayloadType = 0;
-  const std::string kCodecName = "Robert\'); DROP TABLE Students;";
   EXPECT_EQ(DecoderDatabase::kOK,
-            db.RegisterPayload(kPayloadType, NetEqDecoder::kDecoderPCM16B,
-                               kCodecName));
+            db.RegisterPayload(kPayloadType, SdpAudioFormat("l16", 8000, 1)));
   AudioDecoder* dec = db.GetDecoder(kPayloadType);
   ASSERT_TRUE(dec != NULL);
 }
@@ -126,11 +105,6 @@
 TEST(DecoderDatabase, TypeTests) {
   rtc::scoped_refptr<MockAudioDecoderFactory> factory(
       new rtc::RefCountedObject<MockAudioDecoderFactory>);
-  EXPECT_CALL(*factory, IsSupportedDecoder(_))
-      .WillOnce(Invoke([](const SdpAudioFormat& format) {
-        EXPECT_EQ("pcmu", format.name);
-        return true;
-      }));
   DecoderDatabase db(factory, absl::nullopt);
   const uint8_t kPayloadTypePcmU = 0;
   const uint8_t kPayloadTypeCng = 13;
@@ -140,16 +114,15 @@
   // Load into database.
   EXPECT_EQ(
       DecoderDatabase::kOK,
-      db.RegisterPayload(kPayloadTypePcmU, NetEqDecoder::kDecoderPCMu, "pcmu"));
+      db.RegisterPayload(kPayloadTypePcmU, SdpAudioFormat("pcmu", 8000, 1)));
   EXPECT_EQ(DecoderDatabase::kOK,
-            db.RegisterPayload(kPayloadTypeCng, NetEqDecoder::kDecoderCNGnb,
-                               "cng-nb"));
+            db.RegisterPayload(kPayloadTypeCng, SdpAudioFormat("cn", 8000, 1)));
+  EXPECT_EQ(DecoderDatabase::kOK,
+            db.RegisterPayload(kPayloadTypeDtmf,
+                               SdpAudioFormat("telephone-event", 8000, 1)));
   EXPECT_EQ(
       DecoderDatabase::kOK,
-      db.RegisterPayload(kPayloadTypeDtmf, NetEqDecoder::kDecoderAVT, "avt"));
-  EXPECT_EQ(
-      DecoderDatabase::kOK,
-      db.RegisterPayload(kPayloadTypeRed, NetEqDecoder::kDecoderRED, "red"));
+      db.RegisterPayload(kPayloadTypeRed, SdpAudioFormat("red", 8000, 1)));
   EXPECT_EQ(4, db.Size());
   // Test.
   EXPECT_FALSE(db.IsComfortNoise(kPayloadNotUsed));
@@ -169,19 +142,14 @@
   constexpr int kNumPayloads = 10;
   rtc::scoped_refptr<MockAudioDecoderFactory> factory(
       new rtc::RefCountedObject<MockAudioDecoderFactory>);
-  EXPECT_CALL(*factory, IsSupportedDecoder(_))
-      .Times(kNumPayloads)
-      .WillRepeatedly(Invoke([](const SdpAudioFormat& format) {
-        EXPECT_EQ("pcmu", format.name);
-        return true;
-      }));
   DecoderDatabase db(factory, absl::nullopt);
   // Load a number of payloads into the database. Payload types are 0, 1, ...,
   // while the decoder type is the same for all payload types (this does not
   // matter for the test).
   for (uint8_t payload_type = 0; payload_type < kNumPayloads; ++payload_type) {
-    EXPECT_EQ(DecoderDatabase::kOK,
-              db.RegisterPayload(payload_type, NetEqDecoder::kDecoderPCMu, ""));
+    EXPECT_EQ(
+        DecoderDatabase::kOK,
+        db.RegisterPayload(payload_type, SdpAudioFormat("pcmu", 8000, 1)));
   }
   PacketList packet_list;
   for (int i = 0; i < kNumPayloads + 1; ++i) {
@@ -218,11 +186,11 @@
   DecoderDatabase db(CreateBuiltinAudioDecoderFactory(), absl::nullopt);
   // Load payload types.
   ASSERT_EQ(DecoderDatabase::kOK,
-            db.RegisterPayload(0, NetEqDecoder::kDecoderPCMu, "pcmu"));
+            db.RegisterPayload(0, SdpAudioFormat("pcmu", 8000, 1)));
   ASSERT_EQ(DecoderDatabase::kOK,
-            db.RegisterPayload(103, NetEqDecoder::kDecoderISAC, "isac"));
+            db.RegisterPayload(103, SdpAudioFormat("isac", 16000, 1)));
   ASSERT_EQ(DecoderDatabase::kOK,
-            db.RegisterPayload(13, NetEqDecoder::kDecoderCNGnb, "cng-nb"));
+            db.RegisterPayload(13, SdpAudioFormat("cn", 8000, 1)));
   // Verify that no decoders are active from the start.
   EXPECT_EQ(NULL, db.GetActiveDecoder());
   EXPECT_EQ(NULL, db.GetActiveCngDecoder());