Revert "Remove CodecInst pt.1"
This reverts commit 056f9738bf7a3d16da45398239656e165c4e0851.
Reason for revert: breaks downstream
Original change's description:
> Remove CodecInst pt.1
>
> Update audio_coding tests to not use CodecInst.
>
> Bug: webrtc:7626
> Change-Id: I880fb8d72d7d0a915d274e67feb6106f023697c2
> Reviewed-on: https://webrtc-review.googlesource.com/c/112594
> Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#25879}
TBR=solenberg@webrtc.org,kwiberg@webrtc.org
Change-Id: I51d666969bcd63e2b7cb7d669ec2f59b5f8f9dde
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: webrtc:7626
Reviewed-on: https://webrtc-review.googlesource.com/c/112906
Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org>
Commit-Queue: Fredrik Solenberg <solenberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#25881}
diff --git a/modules/audio_coding/test/TestRedFec.cc b/modules/audio_coding/test/TestRedFec.cc
index ac51666..8bb3971 100644
--- a/modules/audio_coding/test/TestRedFec.cc
+++ b/modules/audio_coding/test/TestRedFec.cc
@@ -10,9 +10,8 @@
#include "modules/audio_coding/test/TestRedFec.h"
-#include <utility>
+#include <assert.h>
-#include "absl/strings/match.h"
#include "api/audio_codecs/L16/audio_decoder_L16.h"
#include "api/audio_codecs/L16/audio_encoder_L16.h"
#include "api/audio_codecs/audio_decoder_factory_template.h"
@@ -25,11 +24,12 @@
#include "api/audio_codecs/isac/audio_encoder_isac_float.h"
#include "api/audio_codecs/opus/audio_decoder_opus.h"
#include "api/audio_codecs/opus/audio_encoder_opus.h"
+#include "common_types.h" // NOLINT(build/include)
#include "modules/audio_coding/codecs/cng/audio_encoder_cng.h"
#include "modules/audio_coding/codecs/red/audio_encoder_copy_red.h"
#include "modules/audio_coding/include/audio_coding_module_typedefs.h"
+#include "modules/audio_coding/test/utility.h"
#include "rtc_base/strings/string_builder.h"
-#include "test/gtest.h"
#include "test/testsupport/fileutils.h"
namespace webrtc {
@@ -173,7 +173,6 @@
auto encoder = encoder_factory_->MakeAudioEncoder(payload_type, codec_format,
absl::nullopt);
EXPECT_NE(encoder, nullptr);
- std::map<int, SdpAudioFormat> receive_codecs = {{payload_type, codec_format}};
if (!absl::EqualsIgnoreCase(codec_format.name, "opus")) {
if (vad_mode.has_value()) {
AudioEncoderCngConfig config;
@@ -182,22 +181,22 @@
config.payload_type = cn_payload_type;
config.vad_mode = vad_mode.value();
encoder = CreateComfortNoiseEncoder(std::move(config));
- receive_codecs.emplace(
- std::make_pair(cn_payload_type,
- SdpAudioFormat("CN", codec_format.clockrate_hz, 1)));
+ EXPECT_EQ(true,
+ other_acm->RegisterReceiveCodec(
+ cn_payload_type, {"CN", codec_format.clockrate_hz, 1}));
}
if (use_red) {
AudioEncoderCopyRed::Config config;
config.payload_type = red_payload_type;
config.speech_encoder = std::move(encoder);
encoder = absl::make_unique<AudioEncoderCopyRed>(std::move(config));
- receive_codecs.emplace(
- std::make_pair(red_payload_type,
- SdpAudioFormat("red", codec_format.clockrate_hz, 1)));
+ EXPECT_EQ(true,
+ other_acm->RegisterReceiveCodec(
+ red_payload_type, {"red", codec_format.clockrate_hz, 1}));
}
}
acm->SetEncoder(std::move(encoder));
- other_acm->SetReceiveCodecs(receive_codecs);
+ EXPECT_EQ(true, other_acm->RegisterReceiveCodec(payload_type, codec_format));
}
void TestRedFec::Run() {