Revert "[ACM] iSAC audio codec removed"
This reverts commit b46c4bf27ba5c417fcba7f200d80fa4634e7e1a1.
Reason for revert: breaks a downstream project
Original change's description:
> [ACM] iSAC audio codec removed
>
> Note: this CL has to leave behind one part of iSAC, which is its VAD
> currently used by AGC1 in APM. The target visibility has been
> restricted and the VAD will be removed together with AGC1 when the
> time comes.
>
> Tested: see https://chromium-review.googlesource.com/c/chromium/src/+/4013319
>
> Bug: webrtc:14450
> Change-Id: I69cc518b16280eae62a1f1977cdbfa24c08cf5f9
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/282421
> Reviewed-by: Henrik Lundin <henrik.lundin@webrtc.org>
> Reviewed-by: Sam Zackrisson <saza@webrtc.org>
> Reviewed-by: Henrik Boström <hbos@webrtc.org>
> Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
> Cr-Commit-Position: refs/heads/main@{#38652}
Bug: webrtc:14450
Change-Id: Ice138004e84e8c5f896684e8d01133d4b2a77bb7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/283800
Reviewed-by: Alessio Bazzica <alessiob@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Auto-Submit: Alessio Bazzica <alessiob@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Owners-Override: Mirko Bonadei <mbonadei@webrtc.org>
Bot-Commit: rubber-stamper@appspot.gserviceaccount.com <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#38655}
diff --git a/modules/audio_coding/acm2/acm_receiver_unittest.cc b/modules/audio_coding/acm2/acm_receiver_unittest.cc
index 6dd44b6..e73acc2 100644
--- a/modules/audio_coding/acm2/acm_receiver_unittest.cc
+++ b/modules/audio_coding/acm2/acm_receiver_unittest.cc
@@ -13,7 +13,6 @@
#include <algorithm> // std::min
#include <memory>
-#include "absl/types/optional.h"
#include "api/audio_codecs/builtin_audio_decoder_factory.h"
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
#include "modules/audio_coding/codecs/cng/audio_encoder_cng.h"
@@ -65,14 +64,12 @@
const SdpAudioFormat& format,
const std::map<int, int> cng_payload_types = {}) {
// Create the speech encoder.
- absl::optional<AudioCodecInfo> info =
- encoder_factory_->QueryAudioEncoder(format);
- RTC_CHECK(info.has_value());
+ AudioCodecInfo info = encoder_factory_->QueryAudioEncoder(format).value();
std::unique_ptr<AudioEncoder> enc =
encoder_factory_->MakeAudioEncoder(payload_type, format, absl::nullopt);
// If we have a compatible CN specification, stack a CNG on top.
- auto it = cng_payload_types.find(info->sample_rate_hz);
+ auto it = cng_payload_types.find(info.sample_rate_hz);
if (it != cng_payload_types.end()) {
AudioEncoderCngConfig config;
config.speech_encoder = std::move(enc);
@@ -84,7 +81,7 @@
// Actually start using the new encoder.
acm_->SetEncoder(std::move(enc));
- return *info;
+ return info;
}
int InsertOnePacketOfSilence(const AudioCodecInfo& info) {
@@ -151,7 +148,8 @@
#define MAYBE_SampleRate SampleRate
#endif
TEST_F(AcmReceiverTestOldApi, MAYBE_SampleRate) {
- const std::map<int, SdpAudioFormat> codecs = {{0, {"OPUS", 48000, 2}}};
+ const std::map<int, SdpAudioFormat> codecs = {{0, {"ISAC", 16000, 1}},
+ {1, {"ISAC", 32000, 1}}};
receiver_->SetCodecs(codecs);
constexpr int kOutSampleRateHz = 8000; // Different than codec sample rate.
@@ -235,6 +233,15 @@
}
#if defined(WEBRTC_ANDROID)
+#define MAYBE_VerifyAudioFrameISAC DISABLED_VerifyAudioFrameISAC
+#else
+#define MAYBE_VerifyAudioFrameISAC VerifyAudioFrameISAC
+#endif
+TEST_F(AcmReceiverTestFaxModeOldApi, MAYBE_VerifyAudioFrameISAC) {
+ RunVerifyAudioFrame({"ISAC", 16000, 1});
+}
+
+#if defined(WEBRTC_ANDROID)
#define MAYBE_VerifyAudioFrameOpus DISABLED_VerifyAudioFrameOpus
#else
#define MAYBE_VerifyAudioFrameOpus VerifyAudioFrameOpus
@@ -303,10 +310,12 @@
#else
#define MAYBE_LastAudioCodec LastAudioCodec
#endif
-#if defined(WEBRTC_CODEC_OPUS)
+#if defined(WEBRTC_CODEC_ISAC)
TEST_F(AcmReceiverTestOldApi, MAYBE_LastAudioCodec) {
- const std::map<int, SdpAudioFormat> codecs = {
- {0, {"PCMU", 8000, 1}}, {1, {"PCMA", 8000, 1}}, {2, {"L16", 32000, 1}}};
+ const std::map<int, SdpAudioFormat> codecs = {{0, {"ISAC", 16000, 1}},
+ {1, {"PCMA", 8000, 1}},
+ {2, {"ISAC", 32000, 1}},
+ {3, {"L16", 32000, 1}}};
const std::map<int, int> cng_payload_types = {
{8000, 100}, {16000, 101}, {32000, 102}};
{