Fix cyclic deps: rent_a_codec<->audio_coding and rent_a_codec<->neteq
In short, what I did was to
* Remove acm_common_defs.h (the stuff in it was used only by
acm_codec_database.cc).
* Move audio_coding_module_typedefs.h to a new build target.
* Move the NetEqDecoder enum (and the associated
NetEqDecoderToSdpAudioFormat function) to a new file in a new
build target.
BUG=webrtc:7243, webrtc:7244
Review-Url: https://codereview.webrtc.org/2723253005
Cr-Original-Commit-Position: refs/heads/master@{#17005}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 65cb70d939af8f9b6b8b1af9109dd7385af79f0c
diff --git a/modules/audio_coding/BUILD.gn b/modules/audio_coding/BUILD.gn
index 6d1c2f9..3a2d20a 100644
--- a/modules/audio_coding/BUILD.gn
+++ b/modules/audio_coding/BUILD.gn
@@ -65,10 +65,6 @@
}
rtc_static_library("rent_a_codec") {
- # TODO(kjellander): Remove (bugs.webrtc.org/6828)
- # Gives cyclic dependency with :neteq and :audio_coding if enabled.
- check_includes = false
-
sources = [
"acm2/acm_codec_database.cc",
"acm2/acm_codec_database.h",
@@ -79,6 +75,12 @@
"../../api/audio_codecs:audio_codecs_api",
"../..:webrtc_common",
"../../base:rtc_base_approved",
+ "../../system_wrappers",
+ ":audio_coding_module_typedefs",
+ ":audio_encoder_interface",
+ ":isac_common",
+ ":isac_fix_c",
+ ":neteq_decoder_enum",
] + audio_codec_deps
defines = audio_codec_defines
}
@@ -90,9 +92,17 @@
]
}
+rtc_source_set("audio_coding_module_typedefs") {
+ sources = [
+ "include/audio_coding_module_typedefs.h",
+ ]
+ deps = [
+ "../..:webrtc_common",
+ ]
+}
+
rtc_static_library("audio_coding") {
sources = [
- "acm2/acm_common_defs.h",
"acm2/acm_receiver.cc",
"acm2/acm_receiver.h",
"acm2/acm_resampler.cc",
@@ -103,7 +113,6 @@
"acm2/codec_manager.cc",
"acm2/codec_manager.h",
"include/audio_coding_module.h",
- "include/audio_coding_module_typedefs.h",
]
defines = []
@@ -126,6 +135,8 @@
deps = audio_coding_deps + [
"../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs:builtin_audio_decoder_factory",
+ ":audio_coding_module_typedefs",
+ ":audio_encoder_interface",
":neteq",
":rent_a_codec",
"../../base:rtc_base_approved",
@@ -927,11 +938,18 @@
}
}
-rtc_static_library("neteq") {
- # TODO(kjellander): Remove (bugs.webrtc.org/6828)
- # Cyclic dependency with :audio_coding if enabled.
- check_includes = false
+rtc_source_set("neteq_decoder_enum") {
+ sources = [
+ "neteq/neteq_decoder_enum.cc",
+ "neteq/neteq_decoder_enum.h",
+ ]
+ deps = [
+ "../../api/audio_codecs:audio_codecs_api",
+ "../../base:rtc_base_approved",
+ ]
+}
+rtc_static_library("neteq") {
sources = [
"neteq/accelerate.cc",
"neteq/accelerate.h",
@@ -1007,11 +1025,12 @@
]
deps = [
+ ":audio_coding_module_typedefs",
":cng",
":g711",
":isac_fix",
+ ":neteq_decoder_enum",
":pcm16b",
- ":rent_a_codec",
"../..:webrtc_common",
"../../api/audio_codecs:audio_codecs_api",
"../../base:gtest_prod",
@@ -1133,6 +1152,7 @@
]
deps = [
":audio_coding",
+ ":audio_coding_module_typedefs",
":audio_format_conversion",
":pcm16b_c",
"../..:webrtc_common",
@@ -1228,6 +1248,7 @@
deps = [
":audio_coding",
+ ":audio_coding_module_typedefs",
":audio_format_conversion",
"../../:webrtc_common",
"../../base:rtc_base_approved",
@@ -2036,6 +2057,7 @@
":acm_receive_test",
":acm_send_test",
":audio_coding",
+ ":audio_coding_module_typedefs",
":audio_encoder_interface",
":audio_format_conversion",
":audio_network_adaptor",
diff --git a/modules/audio_coding/acm2/acm_codec_database.cc b/modules/audio_coding/acm2/acm_codec_database.cc
index 0fae75b..a1ff641 100644
--- a/modules/audio_coding/acm2/acm_codec_database.cc
+++ b/modules/audio_coding/acm2/acm_codec_database.cc
@@ -20,9 +20,12 @@
#include <assert.h>
#include "webrtc/base/checks.h"
-#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
#include "webrtc/system_wrappers/include/trace.h"
+#if ((defined WEBRTC_CODEC_ISAC) && (defined WEBRTC_CODEC_ISACFX))
+#error iSAC and iSACFX codecs cannot be enabled at the same time
+#endif
+
namespace webrtc {
namespace acm2 {
@@ -60,9 +63,9 @@
const CodecInst ACMCodecDB::database_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
- {103, "ISAC", 16000, kIsacPacSize480, 1, kIsacWbDefaultRate},
+ {103, "ISAC", 16000, 480, 1, 32000},
# if (defined(WEBRTC_CODEC_ISAC))
- {104, "ISAC", 32000, kIsacPacSize960, 1, kIsacSwbDefaultRate},
+ {104, "ISAC", 32000, 960, 1, 56000},
# endif
#endif
// Mono
@@ -118,9 +121,9 @@
// Basic block samples, max number of channels that are supported.
const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
- {2, {kIsacPacSize480, kIsacPacSize960}, 0, 1},
+ {2, {480, 960}, 0, 1},
# if (defined(WEBRTC_CODEC_ISAC))
- {1, {kIsacPacSize960}, 0, 1},
+ {1, {960}, 0, 1},
# endif
#endif
// Mono
diff --git a/modules/audio_coding/acm2/acm_codec_database.h b/modules/audio_coding/acm2/acm_codec_database.h
index 22c40db..d586cb9 100644
--- a/modules/audio_coding/acm2/acm_codec_database.h
+++ b/modules/audio_coding/acm2/acm_codec_database.h
@@ -18,7 +18,6 @@
#include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
-#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/typedefs.h"
namespace webrtc {
diff --git a/modules/audio_coding/acm2/acm_common_defs.h b/modules/audio_coding/acm2/acm_common_defs.h
deleted file mode 100644
index 0851932..0000000
--- a/modules/audio_coding/acm2/acm_common_defs.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
- *
- * Use of this source code is governed by a BSD-style license
- * that can be found in the LICENSE file in the root of the source
- * tree. An additional intellectual property rights grant can be found
- * in the file PATENTS. All contributing project authors may
- * be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_COMMON_DEFS_H_
-#define WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_COMMON_DEFS_H_
-
-#include "webrtc/typedefs.h"
-
-// Checks for enabled codecs, we prevent enabling codecs which are not
-// compatible.
-#if ((defined WEBRTC_CODEC_ISAC) && (defined WEBRTC_CODEC_ISACFX))
-#error iSAC and iSACFX codecs cannot be enabled at the same time
-#endif
-
-namespace webrtc {
-
-// General codec specific defines
-const int kIsacWbDefaultRate = 32000;
-const int kIsacSwbDefaultRate = 56000;
-const int kIsacPacSize480 = 480;
-const int kIsacPacSize960 = 960;
-
-} // namespace webrtc
-
-#endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_ACM_COMMON_DEFS_H_
diff --git a/modules/audio_coding/acm2/acm_receiver.cc b/modules/audio_coding/acm2/acm_receiver.cc
index 1577d2d..21dbc74 100644
--- a/modules/audio_coding/acm2/acm_receiver.cc
+++ b/modules/audio_coding/acm2/acm_receiver.cc
@@ -27,6 +27,7 @@
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/trace.h"
+#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
namespace webrtc {
@@ -199,7 +200,7 @@
return *ned;
}();
const rtc::Optional<SdpAudioFormat> new_format =
- RentACodec::NetEqDecoderToSdpAudioFormat(neteq_decoder);
+ NetEqDecoderToSdpAudioFormat(neteq_decoder);
rtc::CritScope lock(&crit_sect_);
diff --git a/modules/audio_coding/acm2/acm_receiver_unittest.cc b/modules/audio_coding/acm2/acm_receiver_unittest.cc
index d5a63cc..05f4e11 100644
--- a/modules/audio_coding/acm2/acm_receiver_unittest.cc
+++ b/modules/audio_coding/acm2/acm_receiver_unittest.cc
@@ -16,6 +16,7 @@
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/base/checks.h"
#include "webrtc/base/safe_conversions.h"
+#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
#include "webrtc/system_wrappers/include/clock.h"
diff --git a/modules/audio_coding/acm2/rent_a_codec.cc b/modules/audio_coding/acm2/rent_a_codec.cc
index f0ed301..b353b38 100644
--- a/modules/audio_coding/acm2/rent_a_codec.cc
+++ b/modules/audio_coding/acm2/rent_a_codec.cc
@@ -23,12 +23,12 @@
#include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
#endif
#ifdef WEBRTC_CODEC_ISACFX
-#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isacfix.h"
-#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isacfix.h" // nogncheck
+#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h" // nogncheck
#endif
#ifdef WEBRTC_CODEC_ISAC
-#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isac.h"
-#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h"
+#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isac.h" // nogncheck
+#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h" // nogncheck
#endif
#ifdef WEBRTC_CODEC_OPUS
#include "webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h"
@@ -38,7 +38,6 @@
#include "webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h"
#endif
#include "webrtc/modules/audio_coding/acm2/acm_codec_database.h"
-#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
#if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
#include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
@@ -47,78 +46,6 @@
namespace webrtc {
namespace acm2 {
-rtc::Optional<SdpAudioFormat> RentACodec::NetEqDecoderToSdpAudioFormat(
- NetEqDecoder nd) {
- switch (nd) {
- case NetEqDecoder::kDecoderPCMu:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcmu", 8000, 1));
- case NetEqDecoder::kDecoderPCMa:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcma", 8000, 1));
- case NetEqDecoder::kDecoderPCMu_2ch:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcmu", 8000, 2));
- case NetEqDecoder::kDecoderPCMa_2ch:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcma", 8000, 2));
- case NetEqDecoder::kDecoderILBC:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("ilbc", 8000, 1));
- case NetEqDecoder::kDecoderISAC:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("isac", 16000, 1));
- case NetEqDecoder::kDecoderISACswb:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("isac", 32000, 1));
- case NetEqDecoder::kDecoderPCM16B:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 1));
- case NetEqDecoder::kDecoderPCM16Bwb:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 16000, 1));
- case NetEqDecoder::kDecoderPCM16Bswb32kHz:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 32000, 1));
- case NetEqDecoder::kDecoderPCM16Bswb48kHz:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 48000, 1));
- case NetEqDecoder::kDecoderPCM16B_2ch:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 2));
- case NetEqDecoder::kDecoderPCM16Bwb_2ch:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 16000, 2));
- case NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 32000, 2));
- case NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 48000, 2));
- case NetEqDecoder::kDecoderPCM16B_5ch:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 5));
- case NetEqDecoder::kDecoderG722:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("g722", 8000, 1));
- case NetEqDecoder::kDecoderG722_2ch:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("g722", 8000, 2));
- case NetEqDecoder::kDecoderOpus:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("opus", 48000, 2));
- case NetEqDecoder::kDecoderOpus_2ch:
- return rtc::Optional<SdpAudioFormat>(
- SdpAudioFormat("opus", 48000, 2,
- std::map<std::string, std::string>{{"stereo", "1"}}));
- case NetEqDecoder::kDecoderRED:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("red", 8000, 1));
- case NetEqDecoder::kDecoderAVT:
- return rtc::Optional<SdpAudioFormat>(
- SdpAudioFormat("telephone-event", 8000, 1));
- case NetEqDecoder::kDecoderAVT16kHz:
- return rtc::Optional<SdpAudioFormat>(
- SdpAudioFormat("telephone-event", 16000, 1));
- case NetEqDecoder::kDecoderAVT32kHz:
- return rtc::Optional<SdpAudioFormat>(
- SdpAudioFormat("telephone-event", 32000, 1));
- case NetEqDecoder::kDecoderAVT48kHz:
- return rtc::Optional<SdpAudioFormat>(
- SdpAudioFormat("telephone-event", 48000, 1));
- case NetEqDecoder::kDecoderCNGnb:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("cn", 8000, 1));
- case NetEqDecoder::kDecoderCNGwb:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("cn", 16000, 1));
- case NetEqDecoder::kDecoderCNGswb32kHz:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("cn", 32000, 1));
- case NetEqDecoder::kDecoderCNGswb48kHz:
- return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("cn", 48000, 1));
- default:
- return rtc::Optional<SdpAudioFormat>();
- }
-}
-
rtc::Optional<RentACodec::CodecId> RentACodec::CodecIdByParams(
const char* payload_name,
int sampling_freq_hz,
diff --git a/modules/audio_coding/acm2/rent_a_codec.h b/modules/audio_coding/acm2/rent_a_codec.h
index 069e1d5..0a52f56 100644
--- a/modules/audio_coding/acm2/rent_a_codec.h
+++ b/modules/audio_coding/acm2/rent_a_codec.h
@@ -16,13 +16,13 @@
#include <memory>
#include "webrtc/api/audio_codecs/audio_decoder.h"
-#include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/base/array_view.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/optional.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
+#include "webrtc/modules/audio_coding/neteq/neteq_decoder_enum.h"
#include "webrtc/typedefs.h"
namespace webrtc {
@@ -109,42 +109,6 @@
kNone = -1
};
- enum class NetEqDecoder {
- kDecoderPCMu,
- kDecoderPCMa,
- kDecoderPCMu_2ch,
- kDecoderPCMa_2ch,
- kDecoderILBC,
- kDecoderISAC,
- kDecoderISACswb,
- kDecoderPCM16B,
- kDecoderPCM16Bwb,
- kDecoderPCM16Bswb32kHz,
- kDecoderPCM16Bswb48kHz,
- kDecoderPCM16B_2ch,
- kDecoderPCM16Bwb_2ch,
- kDecoderPCM16Bswb32kHz_2ch,
- kDecoderPCM16Bswb48kHz_2ch,
- kDecoderPCM16B_5ch,
- kDecoderG722,
- kDecoderG722_2ch,
- kDecoderRED,
- kDecoderAVT,
- kDecoderAVT16kHz,
- kDecoderAVT32kHz,
- kDecoderAVT48kHz,
- kDecoderCNGnb,
- kDecoderCNGwb,
- kDecoderCNGswb32kHz,
- kDecoderCNGswb48kHz,
- kDecoderArbitrary,
- kDecoderOpus,
- kDecoderOpus_2ch,
- };
-
- static rtc::Optional<SdpAudioFormat> NetEqDecoderToSdpAudioFormat(
- NetEqDecoder nd);
-
static inline size_t NumberOfCodecs() {
return static_cast<size_t>(CodecId::kNumCodecs);
}
diff --git a/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc b/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc
index a9d20e1..fe049ab 100644
--- a/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc
+++ b/modules/audio_coding/codecs/legacy_encoded_audio_frame_unittest.cc
@@ -14,8 +14,6 @@
namespace webrtc {
-using NetEqDecoder = acm2::RentACodec::NetEqDecoder;
-
class SplitBySamplesTest : public ::testing::TestWithParam<NetEqDecoder> {
protected:
virtual void SetUp() {
diff --git a/modules/audio_coding/include/audio_coding_module.h b/modules/audio_coding/include/audio_coding_module.h
index 7843fb8..1893b62 100644
--- a/modules/audio_coding/include/audio_coding_module.h
+++ b/modules/audio_coding/include/audio_coding_module.h
@@ -20,6 +20,7 @@
#include "webrtc/base/function_view.h"
#include "webrtc/base/optional.h"
#include "webrtc/common_types.h"
+#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/include/module.h"
diff --git a/modules/audio_coding/neteq/audio_decoder_impl.cc b/modules/audio_coding/neteq/audio_decoder_impl.cc
index be35e5f..4087973 100644
--- a/modules/audio_coding/neteq/audio_decoder_impl.cc
+++ b/modules/audio_coding/neteq/audio_decoder_impl.cc
@@ -21,12 +21,12 @@
#include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
#endif
#ifdef WEBRTC_CODEC_ISACFX
-#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isacfix.h"
-#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h"
+#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_decoder_isacfix.h" // nogncheck
+#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h" // nogncheck
#endif
#ifdef WEBRTC_CODEC_ISAC
-#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isac.h"
-#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h"
+#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_decoder_isac.h" // nogncheck
+#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h" // nogncheck
#endif
#ifdef WEBRTC_CODEC_OPUS
#include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h"
diff --git a/modules/audio_coding/neteq/audio_decoder_impl.h b/modules/audio_coding/neteq/audio_decoder_impl.h
index a876f17..325674f 100644
--- a/modules/audio_coding/neteq/audio_decoder_impl.h
+++ b/modules/audio_coding/neteq/audio_decoder_impl.h
@@ -15,7 +15,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/base/constructormagic.h"
-#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
+#include "webrtc/modules/audio_coding/neteq/neteq_decoder_enum.h"
#include "webrtc/typedefs.h"
#ifdef WEBRTC_CODEC_G722
@@ -24,8 +24,6 @@
namespace webrtc {
-using NetEqDecoder = acm2::RentACodec::NetEqDecoder;
-
// Returns true if |codec_type| is supported.
bool CodecSupported(NetEqDecoder codec_type);
diff --git a/modules/audio_coding/neteq/decoder_database.cc b/modules/audio_coding/neteq/decoder_database.cc
index 16bec04..d147d67 100644
--- a/modules/audio_coding/neteq/decoder_database.cc
+++ b/modules/audio_coding/neteq/decoder_database.cc
@@ -42,8 +42,7 @@
DecoderDatabase::DecoderInfo::DecoderInfo(NetEqDecoder ct,
AudioDecoderFactory* factory)
- : DecoderInfo(*acm2::RentACodec::NetEqDecoderToSdpAudioFormat(ct),
- factory) {}
+ : DecoderInfo(*NetEqDecoderToSdpAudioFormat(ct), factory) {}
DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format,
AudioDecoder* ext_dec,
@@ -135,8 +134,7 @@
!CodecSupported(codec_type)) {
return kCodecNotSupported;
}
- const auto opt_format =
- acm2::RentACodec::NetEqDecoderToSdpAudioFormat(codec_type);
+ const auto opt_format = NetEqDecoderToSdpAudioFormat(codec_type);
if (!opt_format) {
return kCodecNotSupported;
}
@@ -175,8 +173,7 @@
return kInvalidPointer;
}
- const auto opt_db_format =
- acm2::RentACodec::NetEqDecoderToSdpAudioFormat(codec_type);
+ const auto opt_db_format = NetEqDecoderToSdpAudioFormat(codec_type);
const SdpAudioFormat format = opt_db_format.value_or({"arbitrary", 0, 0});
std::pair<DecoderMap::iterator, bool> ret;
diff --git a/modules/audio_coding/neteq/decoder_database.h b/modules/audio_coding/neteq/decoder_database.h
index 114cca3..ec470f8 100644
--- a/modules/audio_coding/neteq/decoder_database.h
+++ b/modules/audio_coding/neteq/decoder_database.h
@@ -18,6 +18,7 @@
#include "webrtc/api/audio_codecs/audio_decoder_factory.h"
#include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/base/constructormagic.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/common_types.h" // NULL
#include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h"
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
diff --git a/modules/audio_coding/neteq/neteq_decoder_enum.cc b/modules/audio_coding/neteq/neteq_decoder_enum.cc
new file mode 100644
index 0000000..e9abf20
--- /dev/null
+++ b/modules/audio_coding/neteq/neteq_decoder_enum.cc
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#include <map>
+#include <string>
+
+#include "webrtc/modules/audio_coding/neteq/neteq_decoder_enum.h"
+
+namespace webrtc {
+
+rtc::Optional<SdpAudioFormat> NetEqDecoderToSdpAudioFormat(NetEqDecoder nd) {
+ switch (nd) {
+ case NetEqDecoder::kDecoderPCMu:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcmu", 8000, 1));
+ case NetEqDecoder::kDecoderPCMa:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcma", 8000, 1));
+ case NetEqDecoder::kDecoderPCMu_2ch:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcmu", 8000, 2));
+ case NetEqDecoder::kDecoderPCMa_2ch:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("pcma", 8000, 2));
+ case NetEqDecoder::kDecoderILBC:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("ilbc", 8000, 1));
+ case NetEqDecoder::kDecoderISAC:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("isac", 16000, 1));
+ case NetEqDecoder::kDecoderISACswb:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("isac", 32000, 1));
+ case NetEqDecoder::kDecoderPCM16B:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 1));
+ case NetEqDecoder::kDecoderPCM16Bwb:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 16000, 1));
+ case NetEqDecoder::kDecoderPCM16Bswb32kHz:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 32000, 1));
+ case NetEqDecoder::kDecoderPCM16Bswb48kHz:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 48000, 1));
+ case NetEqDecoder::kDecoderPCM16B_2ch:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 2));
+ case NetEqDecoder::kDecoderPCM16Bwb_2ch:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 16000, 2));
+ case NetEqDecoder::kDecoderPCM16Bswb32kHz_2ch:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 32000, 2));
+ case NetEqDecoder::kDecoderPCM16Bswb48kHz_2ch:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 48000, 2));
+ case NetEqDecoder::kDecoderPCM16B_5ch:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("l16", 8000, 5));
+ case NetEqDecoder::kDecoderG722:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("g722", 8000, 1));
+ case NetEqDecoder::kDecoderG722_2ch:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("g722", 8000, 2));
+ case NetEqDecoder::kDecoderOpus:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("opus", 48000, 2));
+ case NetEqDecoder::kDecoderOpus_2ch:
+ return rtc::Optional<SdpAudioFormat>(
+ SdpAudioFormat("opus", 48000, 2,
+ std::map<std::string, std::string>{{"stereo", "1"}}));
+ case NetEqDecoder::kDecoderRED:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("red", 8000, 1));
+ case NetEqDecoder::kDecoderAVT:
+ return rtc::Optional<SdpAudioFormat>(
+ SdpAudioFormat("telephone-event", 8000, 1));
+ case NetEqDecoder::kDecoderAVT16kHz:
+ return rtc::Optional<SdpAudioFormat>(
+ SdpAudioFormat("telephone-event", 16000, 1));
+ case NetEqDecoder::kDecoderAVT32kHz:
+ return rtc::Optional<SdpAudioFormat>(
+ SdpAudioFormat("telephone-event", 32000, 1));
+ case NetEqDecoder::kDecoderAVT48kHz:
+ return rtc::Optional<SdpAudioFormat>(
+ SdpAudioFormat("telephone-event", 48000, 1));
+ case NetEqDecoder::kDecoderCNGnb:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("cn", 8000, 1));
+ case NetEqDecoder::kDecoderCNGwb:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("cn", 16000, 1));
+ case NetEqDecoder::kDecoderCNGswb32kHz:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("cn", 32000, 1));
+ case NetEqDecoder::kDecoderCNGswb48kHz:
+ return rtc::Optional<SdpAudioFormat>(SdpAudioFormat("cn", 48000, 1));
+ default:
+ return rtc::Optional<SdpAudioFormat>();
+ }
+}
+
+} // namespace webrtc
diff --git a/modules/audio_coding/neteq/neteq_decoder_enum.h b/modules/audio_coding/neteq/neteq_decoder_enum.h
new file mode 100644
index 0000000..6eb9300
--- /dev/null
+++ b/modules/audio_coding/neteq/neteq_decoder_enum.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_DECODER_ENUM_H_
+#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_DECODER_ENUM_H_
+
+#include "webrtc/api/audio_codecs/audio_format.h"
+#include "webrtc/base/optional.h"
+
+namespace webrtc {
+
+enum class NetEqDecoder {
+ kDecoderPCMu,
+ kDecoderPCMa,
+ kDecoderPCMu_2ch,
+ kDecoderPCMa_2ch,
+ kDecoderILBC,
+ kDecoderISAC,
+ kDecoderISACswb,
+ kDecoderPCM16B,
+ kDecoderPCM16Bwb,
+ kDecoderPCM16Bswb32kHz,
+ kDecoderPCM16Bswb48kHz,
+ kDecoderPCM16B_2ch,
+ kDecoderPCM16Bwb_2ch,
+ kDecoderPCM16Bswb32kHz_2ch,
+ kDecoderPCM16Bswb48kHz_2ch,
+ kDecoderPCM16B_5ch,
+ kDecoderG722,
+ kDecoderG722_2ch,
+ kDecoderRED,
+ kDecoderAVT,
+ kDecoderAVT16kHz,
+ kDecoderAVT32kHz,
+ kDecoderAVT48kHz,
+ kDecoderCNGnb,
+ kDecoderCNGwb,
+ kDecoderCNGswb32kHz,
+ kDecoderCNGswb48kHz,
+ kDecoderArbitrary,
+ kDecoderOpus,
+ kDecoderOpus_2ch,
+};
+
+rtc::Optional<SdpAudioFormat> NetEqDecoderToSdpAudioFormat(NetEqDecoder nd);
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_DECODER_ENUM_H_
diff --git a/modules/audio_coding/neteq/neteq_impl.h b/modules/audio_coding/neteq/neteq_impl.h
index 505f0f2..a8c3462 100644
--- a/modules/audio_coding/neteq/neteq_impl.h
+++ b/modules/audio_coding/neteq/neteq_impl.h
@@ -26,6 +26,7 @@
#include "webrtc/modules/audio_coding/neteq/rtcp.h"
#include "webrtc/modules/audio_coding/neteq/statistics_calculator.h"
#include "webrtc/modules/audio_coding/neteq/tick_timer.h"
+#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/typedefs.h"
namespace webrtc {
diff --git a/modules/audio_coding/test/APITest.cc b/modules/audio_coding/test/APITest.cc
index a4fc986..6a45833 100644
--- a/modules/audio_coding/test/APITest.cc
+++ b/modules/audio_coding/test/APITest.cc
@@ -22,7 +22,6 @@
#include "webrtc/base/platform_thread.h"
#include "webrtc/base/timeutils.h"
#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/test/utility.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
diff --git a/modules/audio_coding/test/EncodeDecodeTest.cc b/modules/audio_coding/test/EncodeDecodeTest.cc
index 3eada25..87cd61c 100644
--- a/modules/audio_coding/test/EncodeDecodeTest.cc
+++ b/modules/audio_coding/test/EncodeDecodeTest.cc
@@ -16,7 +16,6 @@
#include <stdlib.h>
#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/test/utility.h"
diff --git a/modules/audio_coding/test/delay_test.cc b/modules/audio_coding/test/delay_test.cc
index d39daf2..846ac29 100644
--- a/modules/audio_coding/test/delay_test.cc
+++ b/modules/audio_coding/test/delay_test.cc
@@ -16,7 +16,6 @@
#include "gflags/gflags.h"
#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"
diff --git a/modules/audio_coding/test/iSACTest.cc b/modules/audio_coding/test/iSACTest.cc
index 6ccdf3c..f8e8c85 100644
--- a/modules/audio_coding/test/iSACTest.cc
+++ b/modules/audio_coding/test/iSACTest.cc
@@ -23,7 +23,6 @@
#include <time.h>
#endif
-#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/test/utility.h"
#include "webrtc/system_wrappers/include/event_wrapper.h"
diff --git a/modules/audio_coding/test/utility.cc b/modules/audio_coding/test/utility.cc
index 30bafd4..043e6b9 100644
--- a/modules/audio_coding/test/utility.cc
+++ b/modules/audio_coding/test/utility.cc
@@ -16,7 +16,6 @@
#include <string.h>
#include "webrtc/common_types.h"
-#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/test/gtest.h"