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

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

View File

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

View File

@ -42,8 +42,7 @@ DecoderDatabase::DecoderInfo::DecoderInfo(const SdpAudioFormat& audio_format,
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 @@ int DecoderDatabase::RegisterPayload(uint8_t rtp_payload_type,
!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 @@ int DecoderDatabase::InsertExternal(uint8_t rtp_payload_type,
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;

View File

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

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/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 {