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}
This commit is contained in:
kwiberg
2017-03-03 06:16:28 -08:00
committed by Commit bot
parent 154a7bb877
commit 65cb70d939
22 changed files with 205 additions and 184 deletions

View File

@ -65,10 +65,6 @@ rtc_static_library("builtin_audio_decoder_factory_internal") {
} }
rtc_static_library("rent_a_codec") { 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 = [ sources = [
"acm2/acm_codec_database.cc", "acm2/acm_codec_database.cc",
"acm2/acm_codec_database.h", "acm2/acm_codec_database.h",
@ -79,6 +75,12 @@ rtc_static_library("rent_a_codec") {
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../..:webrtc_common", "../..:webrtc_common",
"../../base:rtc_base_approved", "../../base:rtc_base_approved",
"../../system_wrappers",
":audio_coding_module_typedefs",
":audio_encoder_interface",
":isac_common",
":isac_fix_c",
":neteq_decoder_enum",
] + audio_codec_deps ] + audio_codec_deps
defines = audio_codec_defines defines = audio_codec_defines
} }
@ -90,9 +92,17 @@ config("audio_coding_config") {
] ]
} }
rtc_source_set("audio_coding_module_typedefs") {
sources = [
"include/audio_coding_module_typedefs.h",
]
deps = [
"../..:webrtc_common",
]
}
rtc_static_library("audio_coding") { rtc_static_library("audio_coding") {
sources = [ sources = [
"acm2/acm_common_defs.h",
"acm2/acm_receiver.cc", "acm2/acm_receiver.cc",
"acm2/acm_receiver.h", "acm2/acm_receiver.h",
"acm2/acm_resampler.cc", "acm2/acm_resampler.cc",
@ -103,7 +113,6 @@ rtc_static_library("audio_coding") {
"acm2/codec_manager.cc", "acm2/codec_manager.cc",
"acm2/codec_manager.h", "acm2/codec_manager.h",
"include/audio_coding_module.h", "include/audio_coding_module.h",
"include/audio_coding_module_typedefs.h",
] ]
defines = [] defines = []
@ -126,6 +135,8 @@ rtc_static_library("audio_coding") {
deps = audio_coding_deps + [ deps = audio_coding_deps + [
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../api/audio_codecs:builtin_audio_decoder_factory", "../../api/audio_codecs:builtin_audio_decoder_factory",
":audio_coding_module_typedefs",
":audio_encoder_interface",
":neteq", ":neteq",
":rent_a_codec", ":rent_a_codec",
"../../base:rtc_base_approved", "../../base:rtc_base_approved",
@ -927,11 +938,18 @@ rtc_static_library("audio_network_adaptor") {
} }
} }
rtc_static_library("neteq") { rtc_source_set("neteq_decoder_enum") {
# TODO(kjellander): Remove (bugs.webrtc.org/6828) sources = [
# Cyclic dependency with :audio_coding if enabled. "neteq/neteq_decoder_enum.cc",
check_includes = false "neteq/neteq_decoder_enum.h",
]
deps = [
"../../api/audio_codecs:audio_codecs_api",
"../../base:rtc_base_approved",
]
}
rtc_static_library("neteq") {
sources = [ sources = [
"neteq/accelerate.cc", "neteq/accelerate.cc",
"neteq/accelerate.h", "neteq/accelerate.h",
@ -1007,11 +1025,12 @@ rtc_static_library("neteq") {
] ]
deps = [ deps = [
":audio_coding_module_typedefs",
":cng", ":cng",
":g711", ":g711",
":isac_fix", ":isac_fix",
":neteq_decoder_enum",
":pcm16b", ":pcm16b",
":rent_a_codec",
"../..:webrtc_common", "../..:webrtc_common",
"../../api/audio_codecs:audio_codecs_api", "../../api/audio_codecs:audio_codecs_api",
"../../base:gtest_prod", "../../base:gtest_prod",
@ -1133,6 +1152,7 @@ if (rtc_include_tests) {
] ]
deps = [ deps = [
":audio_coding", ":audio_coding",
":audio_coding_module_typedefs",
":audio_format_conversion", ":audio_format_conversion",
":pcm16b_c", ":pcm16b_c",
"../..:webrtc_common", "../..:webrtc_common",
@ -1228,6 +1248,7 @@ if (rtc_include_tests) {
deps = [ deps = [
":audio_coding", ":audio_coding",
":audio_coding_module_typedefs",
":audio_format_conversion", ":audio_format_conversion",
"../../:webrtc_common", "../../:webrtc_common",
"../../base:rtc_base_approved", "../../base:rtc_base_approved",
@ -2036,6 +2057,7 @@ if (rtc_include_tests) {
":acm_receive_test", ":acm_receive_test",
":acm_send_test", ":acm_send_test",
":audio_coding", ":audio_coding",
":audio_coding_module_typedefs",
":audio_encoder_interface", ":audio_encoder_interface",
":audio_format_conversion", ":audio_format_conversion",
":audio_network_adaptor", ":audio_network_adaptor",

View File

@ -20,9 +20,12 @@
#include <assert.h> #include <assert.h>
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/modules/audio_coding/acm2/acm_common_defs.h"
#include "webrtc/system_wrappers/include/trace.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 webrtc {
namespace acm2 { namespace acm2 {
@ -60,9 +63,9 @@ bool IsOpusRateValid(int rate) {
const CodecInst ACMCodecDB::database_[] = { const CodecInst ACMCodecDB::database_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) #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)) # if (defined(WEBRTC_CODEC_ISAC))
{104, "ISAC", 32000, kIsacPacSize960, 1, kIsacSwbDefaultRate}, {104, "ISAC", 32000, 960, 1, 56000},
# endif # endif
#endif #endif
// Mono // Mono
@ -118,9 +121,9 @@ const CodecInst ACMCodecDB::database_[] = {
// Basic block samples, max number of channels that are supported. // Basic block samples, max number of channels that are supported.
const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = { const ACMCodecDB::CodecSettings ACMCodecDB::codec_settings_[] = {
#if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX)) #if (defined(WEBRTC_CODEC_ISAC) || defined(WEBRTC_CODEC_ISACFX))
{2, {kIsacPacSize480, kIsacPacSize960}, 0, 1}, {2, {480, 960}, 0, 1},
# if (defined(WEBRTC_CODEC_ISAC)) # if (defined(WEBRTC_CODEC_ISAC))
{1, {kIsacPacSize960}, 0, 1}, {1, {960}, 0, 1},
# endif # endif
#endif #endif
// Mono // Mono

View File

@ -18,7 +18,6 @@
#include "webrtc/common_types.h" #include "webrtc/common_types.h"
#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h" #include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -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_

View File

@ -27,6 +27,7 @@
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/system_wrappers/include/clock.h" #include "webrtc/system_wrappers/include/clock.h"
#include "webrtc/system_wrappers/include/trace.h" #include "webrtc/system_wrappers/include/trace.h"
#include "webrtc/modules/audio_coding/acm2/rent_a_codec.h"
namespace webrtc { namespace webrtc {
@ -199,7 +200,7 @@ int32_t AcmReceiver::AddCodec(int acm_codec_id,
return *ned; return *ned;
}(); }();
const rtc::Optional<SdpAudioFormat> new_format = const rtc::Optional<SdpAudioFormat> new_format =
RentACodec::NetEqDecoderToSdpAudioFormat(neteq_decoder); NetEqDecoderToSdpAudioFormat(neteq_decoder);
rtc::CritScope lock(&crit_sect_); rtc::CritScope lock(&crit_sect_);

View File

@ -16,6 +16,7 @@
#include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h" #include "webrtc/api/audio_codecs/builtin_audio_decoder_factory.h"
#include "webrtc/base/checks.h" #include "webrtc/base/checks.h"
#include "webrtc/base/safe_conversions.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/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h" #include "webrtc/modules/audio_coding/neteq/tools/rtp_generator.h"
#include "webrtc/system_wrappers/include/clock.h" #include "webrtc/system_wrappers/include/clock.h"

View File

@ -23,12 +23,12 @@
#include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h" #include "webrtc/modules/audio_coding/codecs/ilbc/audio_encoder_ilbc.h"
#endif #endif
#ifdef WEBRTC_CODEC_ISACFX #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_decoder_isacfix.h" // nogncheck
#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h" #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h" // nogncheck
#endif #endif
#ifdef WEBRTC_CODEC_ISAC #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_decoder_isac.h" // nogncheck
#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h" #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h" // nogncheck
#endif #endif
#ifdef WEBRTC_CODEC_OPUS #ifdef WEBRTC_CODEC_OPUS
#include "webrtc/modules/audio_coding/codecs/opus/audio_encoder_opus.h" #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" #include "webrtc/modules/audio_coding/codecs/red/audio_encoder_copy_red.h"
#endif #endif
#include "webrtc/modules/audio_coding/acm2/acm_codec_database.h" #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) #if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
#include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h" #include "webrtc/modules/audio_coding/codecs/isac/locked_bandwidth_info.h"
@ -47,78 +46,6 @@
namespace webrtc { namespace webrtc {
namespace acm2 { 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( rtc::Optional<RentACodec::CodecId> RentACodec::CodecIdByParams(
const char* payload_name, const char* payload_name,
int sampling_freq_hz, int sampling_freq_hz,

View File

@ -16,13 +16,13 @@
#include <memory> #include <memory>
#include "webrtc/api/audio_codecs/audio_decoder.h" #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/array_view.h"
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/optional.h" #include "webrtc/base/optional.h"
#include "webrtc/base/scoped_ref_ptr.h" #include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/modules/audio_coding/codecs/audio_encoder.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/include/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/neteq/neteq_decoder_enum.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {
@ -109,42 +109,6 @@ class RentACodec {
kNone = -1 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() { static inline size_t NumberOfCodecs() {
return static_cast<size_t>(CodecId::kNumCodecs); return static_cast<size_t>(CodecId::kNumCodecs);
} }

View File

@ -14,8 +14,6 @@
namespace webrtc { namespace webrtc {
using NetEqDecoder = acm2::RentACodec::NetEqDecoder;
class SplitBySamplesTest : public ::testing::TestWithParam<NetEqDecoder> { class SplitBySamplesTest : public ::testing::TestWithParam<NetEqDecoder> {
protected: protected:
virtual void SetUp() { virtual void SetUp() {

View File

@ -20,6 +20,7 @@
#include "webrtc/base/function_view.h" #include "webrtc/base/function_view.h"
#include "webrtc/base/optional.h" #include "webrtc/base/optional.h"
#include "webrtc/common_types.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/include/audio_coding_module_typedefs.h"
#include "webrtc/modules/audio_coding/neteq/include/neteq.h" #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
#include "webrtc/modules/include/module.h" #include "webrtc/modules/include/module.h"

View File

@ -21,12 +21,12 @@
#include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h" #include "webrtc/modules/audio_coding/codecs/ilbc/audio_decoder_ilbc.h"
#endif #endif
#ifdef WEBRTC_CODEC_ISACFX #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_decoder_isacfix.h" // nogncheck
#include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h" #include "webrtc/modules/audio_coding/codecs/isac/fix/include/audio_encoder_isacfix.h" // nogncheck
#endif #endif
#ifdef WEBRTC_CODEC_ISAC #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_decoder_isac.h" // nogncheck
#include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h" #include "webrtc/modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h" // nogncheck
#endif #endif
#ifdef WEBRTC_CODEC_OPUS #ifdef WEBRTC_CODEC_OPUS
#include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h" #include "webrtc/modules/audio_coding/codecs/opus/audio_decoder_opus.h"

View File

@ -15,7 +15,7 @@
#include "webrtc/api/audio_codecs/audio_decoder.h" #include "webrtc/api/audio_codecs/audio_decoder.h"
#include "webrtc/base/constructormagic.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" #include "webrtc/typedefs.h"
#ifdef WEBRTC_CODEC_G722 #ifdef WEBRTC_CODEC_G722
@ -24,8 +24,6 @@
namespace webrtc { namespace webrtc {
using NetEqDecoder = acm2::RentACodec::NetEqDecoder;
// Returns true if |codec_type| is supported. // Returns true if |codec_type| is supported.
bool CodecSupported(NetEqDecoder codec_type); bool CodecSupported(NetEqDecoder codec_type);

View File

@ -42,8 +42,7 @@ DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format,
DecoderDatabase::DecoderInfo::DecoderInfo(NetEqDecoder ct, DecoderDatabase::DecoderInfo::DecoderInfo(NetEqDecoder ct,
AudioDecoderFactory* factory) AudioDecoderFactory* factory)
: DecoderInfo(*acm2::RentACodec::NetEqDecoderToSdpAudioFormat(ct), : DecoderInfo(*NetEqDecoderToSdpAudioFormat(ct), factory) {}
factory) {}
DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format, DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format,
AudioDecoder* ext_dec, AudioDecoder* ext_dec,
@ -135,8 +134,7 @@ int DecoderDatabase::RegisterPayload(uint8_t rtp_payload_type,
!CodecSupported(codec_type)) { !CodecSupported(codec_type)) {
return kCodecNotSupported; return kCodecNotSupported;
} }
const auto opt_format = const auto opt_format = NetEqDecoderToSdpAudioFormat(codec_type);
acm2::RentACodec::NetEqDecoderToSdpAudioFormat(codec_type);
if (!opt_format) { if (!opt_format) {
return kCodecNotSupported; return kCodecNotSupported;
} }
@ -175,8 +173,7 @@ int DecoderDatabase::InsertExternal(uint8_t rtp_payload_type,
return kInvalidPointer; return kInvalidPointer;
} }
const auto opt_db_format = const auto opt_db_format = NetEqDecoderToSdpAudioFormat(codec_type);
acm2::RentACodec::NetEqDecoderToSdpAudioFormat(codec_type);
const SdpAudioFormat format = opt_db_format.value_or({"arbitrary", 0, 0}); const SdpAudioFormat format = opt_db_format.value_or({"arbitrary", 0, 0});
std::pair<DecoderMap::iterator, bool> ret; std::pair<DecoderMap::iterator, bool> ret;

View File

@ -18,6 +18,7 @@
#include "webrtc/api/audio_codecs/audio_decoder_factory.h" #include "webrtc/api/audio_codecs/audio_decoder_factory.h"
#include "webrtc/api/audio_codecs/audio_format.h" #include "webrtc/api/audio_codecs/audio_format.h"
#include "webrtc/base/constructormagic.h" #include "webrtc/base/constructormagic.h"
#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/common_types.h" // NULL #include "webrtc/common_types.h" // NULL
#include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h" #include "webrtc/modules/audio_coding/codecs/cng/webrtc_cng.h"
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h" #include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"

View File

@ -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

View File

@ -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_

View File

@ -26,6 +26,7 @@
#include "webrtc/modules/audio_coding/neteq/rtcp.h" #include "webrtc/modules/audio_coding/neteq/rtcp.h"
#include "webrtc/modules/audio_coding/neteq/statistics_calculator.h" #include "webrtc/modules/audio_coding/neteq/statistics_calculator.h"
#include "webrtc/modules/audio_coding/neteq/tick_timer.h" #include "webrtc/modules/audio_coding/neteq/tick_timer.h"
#include "webrtc/modules/include/module_common_types.h"
#include "webrtc/typedefs.h" #include "webrtc/typedefs.h"
namespace webrtc { namespace webrtc {

View File

@ -22,7 +22,6 @@
#include "webrtc/base/platform_thread.h" #include "webrtc/base/platform_thread.h"
#include "webrtc/base/timeutils.h" #include "webrtc/base/timeutils.h"
#include "webrtc/common_types.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/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/test/utility.h" #include "webrtc/modules/audio_coding/test/utility.h"
#include "webrtc/system_wrappers/include/event_wrapper.h" #include "webrtc/system_wrappers/include/event_wrapper.h"

View File

@ -16,7 +16,6 @@
#include <stdlib.h> #include <stdlib.h>
#include "webrtc/common_types.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/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/test/utility.h" #include "webrtc/modules/audio_coding/test/utility.h"

View File

@ -16,7 +16,6 @@
#include "gflags/gflags.h" #include "gflags/gflags.h"
#include "webrtc/common_types.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/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module.h" #include "webrtc/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h" #include "webrtc/modules/audio_coding/include/audio_coding_module_typedefs.h"

View File

@ -23,7 +23,6 @@
#include <time.h> #include <time.h>
#endif #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/codecs/audio_format_conversion.h"
#include "webrtc/modules/audio_coding/test/utility.h" #include "webrtc/modules/audio_coding/test/utility.h"
#include "webrtc/system_wrappers/include/event_wrapper.h" #include "webrtc/system_wrappers/include/event_wrapper.h"

View File

@ -16,7 +16,6 @@
#include <string.h> #include <string.h>
#include "webrtc/common_types.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/modules/audio_coding/include/audio_coding_module.h"
#include "webrtc/test/gtest.h" #include "webrtc/test/gtest.h"