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-Commit-Position: refs/heads/master@{#17005}
diff --git a/webrtc/modules/audio_coding/acm2/acm_codec_database.cc b/webrtc/modules/audio_coding/acm2/acm_codec_database.cc
index 0fae75b..a1ff641 100644
--- a/webrtc/modules/audio_coding/acm2/acm_codec_database.cc
+++ b/webrtc/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/webrtc/modules/audio_coding/acm2/acm_codec_database.h b/webrtc/modules/audio_coding/acm2/acm_codec_database.h
index 22c40db..d586cb9 100644
--- a/webrtc/modules/audio_coding/acm2/acm_codec_database.h
+++ b/webrtc/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/webrtc/modules/audio_coding/acm2/acm_common_defs.h b/webrtc/modules/audio_coding/acm2/acm_common_defs.h
deleted file mode 100644
index 0851932..0000000
--- a/webrtc/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/webrtc/modules/audio_coding/acm2/acm_receiver.cc b/webrtc/modules/audio_coding/acm2/acm_receiver.cc
index 1577d2d..21dbc74 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver.cc
+++ b/webrtc/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/webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc b/webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc
index d5a63cc..05f4e11 100644
--- a/webrtc/modules/audio_coding/acm2/acm_receiver_unittest.cc
+++ b/webrtc/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/webrtc/modules/audio_coding/acm2/rent_a_codec.cc b/webrtc/modules/audio_coding/acm2/rent_a_codec.cc
index f0ed301..b353b38 100644
--- a/webrtc/modules/audio_coding/acm2/rent_a_codec.cc
+++ b/webrtc/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/webrtc/modules/audio_coding/acm2/rent_a_codec.h b/webrtc/modules/audio_coding/acm2/rent_a_codec.h
index 069e1d5..0a52f56 100644
--- a/webrtc/modules/audio_coding/acm2/rent_a_codec.h
+++ b/webrtc/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);
}