Move the AudioDecoder interface out of NetEq
It belongs with the codecs, next to the AudioEncoder interface. R=andrew@webrtc.org, henrik.lundin@webrtc.org, kjellander@webrtc.org Previously committed here: https://code.google.com/p/webrtc/source/detail?r=7798 and reverted here: https://code.google.com/p/webrtc/source/detail?r=7799 Review URL: https://webrtc-codereview.appspot.com/27309004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7839 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
97d0489058
commit
e04a93bcf5
@ -113,6 +113,15 @@ source_set("audio_coding") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
source_set("audio_decoder_interface") {
|
||||||
|
sources = [
|
||||||
|
"codecs/audio_decoder.cc",
|
||||||
|
"codecs/audio_decoder.h",
|
||||||
|
]
|
||||||
|
configs += [ "../..:common_config" ]
|
||||||
|
public_configs = [ "../..:common_inherited_config" ]
|
||||||
|
}
|
||||||
|
|
||||||
config("cng_config") {
|
config("cng_config") {
|
||||||
include_dirs = [
|
include_dirs = [
|
||||||
"../../..",
|
"../../..",
|
||||||
@ -636,7 +645,6 @@ config("neteq_config") {
|
|||||||
|
|
||||||
source_set("neteq") {
|
source_set("neteq") {
|
||||||
sources = [
|
sources = [
|
||||||
"neteq/interface/audio_decoder.h",
|
|
||||||
"neteq/interface/neteq.h",
|
"neteq/interface/neteq.h",
|
||||||
"neteq/accelerate.cc",
|
"neteq/accelerate.cc",
|
||||||
"neteq/accelerate.h",
|
"neteq/accelerate.h",
|
||||||
@ -644,7 +652,6 @@ source_set("neteq") {
|
|||||||
"neteq/audio_classifier.h",
|
"neteq/audio_classifier.h",
|
||||||
"neteq/audio_decoder_impl.cc",
|
"neteq/audio_decoder_impl.cc",
|
||||||
"neteq/audio_decoder_impl.h",
|
"neteq/audio_decoder_impl.h",
|
||||||
"neteq/audio_decoder.cc",
|
|
||||||
"neteq/audio_multi_vector.cc",
|
"neteq/audio_multi_vector.cc",
|
||||||
"neteq/audio_multi_vector.h",
|
"neteq/audio_multi_vector.h",
|
||||||
"neteq/audio_vector.cc",
|
"neteq/audio_vector.cc",
|
||||||
@ -721,6 +728,7 @@ source_set("neteq") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
|
":audio_decoder_interface",
|
||||||
":cng",
|
":cng",
|
||||||
":g711",
|
":g711",
|
||||||
":g722",
|
":g722",
|
||||||
|
72
webrtc/modules/audio_coding/codecs/audio_decoder.cc
Normal file
72
webrtc/modules/audio_coding/codecs/audio_decoder.cc
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2012 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 "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "webrtc/base/checks.h"
|
||||||
|
|
||||||
|
namespace webrtc {
|
||||||
|
|
||||||
|
int AudioDecoder::DecodeRedundant(const uint8_t* encoded,
|
||||||
|
size_t encoded_len,
|
||||||
|
int16_t* decoded,
|
||||||
|
SpeechType* speech_type) {
|
||||||
|
return Decode(encoded, encoded_len, decoded, speech_type);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AudioDecoder::HasDecodePlc() const { return false; }
|
||||||
|
|
||||||
|
int AudioDecoder::DecodePlc(int num_frames, int16_t* decoded) { return -1; }
|
||||||
|
|
||||||
|
int AudioDecoder::IncomingPacket(const uint8_t* payload,
|
||||||
|
size_t payload_len,
|
||||||
|
uint16_t rtp_sequence_number,
|
||||||
|
uint32_t rtp_timestamp,
|
||||||
|
uint32_t arrival_timestamp) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AudioDecoder::ErrorCode() { return 0; }
|
||||||
|
|
||||||
|
int AudioDecoder::PacketDuration(const uint8_t* encoded, size_t encoded_len) {
|
||||||
|
return kNotImplemented;
|
||||||
|
}
|
||||||
|
|
||||||
|
int AudioDecoder::PacketDurationRedundant(const uint8_t* encoded,
|
||||||
|
size_t encoded_len) const {
|
||||||
|
return kNotImplemented;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AudioDecoder::PacketHasFec(const uint8_t* encoded,
|
||||||
|
size_t encoded_len) const {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CNG_dec_inst* AudioDecoder::CngDecoderInstance() {
|
||||||
|
FATAL() << "Not a CNG decoder";
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioDecoder::SpeechType AudioDecoder::ConvertSpeechType(int16_t type) {
|
||||||
|
switch (type) {
|
||||||
|
case 0: // TODO(hlundin): Both iSAC and Opus return 0 for speech.
|
||||||
|
case 1:
|
||||||
|
return kSpeech;
|
||||||
|
case 2:
|
||||||
|
return kComfortNoise;
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
return kSpeech;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace webrtc
|
@ -19,39 +19,6 @@
|
|||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
enum NetEqDecoder {
|
|
||||||
kDecoderPCMu,
|
|
||||||
kDecoderPCMa,
|
|
||||||
kDecoderPCMu_2ch,
|
|
||||||
kDecoderPCMa_2ch,
|
|
||||||
kDecoderILBC,
|
|
||||||
kDecoderISAC,
|
|
||||||
kDecoderISACswb,
|
|
||||||
kDecoderISACfb,
|
|
||||||
kDecoderPCM16B,
|
|
||||||
kDecoderPCM16Bwb,
|
|
||||||
kDecoderPCM16Bswb32kHz,
|
|
||||||
kDecoderPCM16Bswb48kHz,
|
|
||||||
kDecoderPCM16B_2ch,
|
|
||||||
kDecoderPCM16Bwb_2ch,
|
|
||||||
kDecoderPCM16Bswb32kHz_2ch,
|
|
||||||
kDecoderPCM16Bswb48kHz_2ch,
|
|
||||||
kDecoderPCM16B_5ch,
|
|
||||||
kDecoderG722,
|
|
||||||
kDecoderG722_2ch,
|
|
||||||
kDecoderRED,
|
|
||||||
kDecoderAVT,
|
|
||||||
kDecoderCNGnb,
|
|
||||||
kDecoderCNGwb,
|
|
||||||
kDecoderCNGswb32kHz,
|
|
||||||
kDecoderCNGswb48kHz,
|
|
||||||
kDecoderArbitrary,
|
|
||||||
kDecoderOpus,
|
|
||||||
kDecoderOpus_2ch,
|
|
||||||
kDecoderCELT_32,
|
|
||||||
kDecoderCELT_32_2ch,
|
|
||||||
};
|
|
||||||
|
|
||||||
// This is the interface class for decoders in NetEQ. Each codec type will have
|
// This is the interface class for decoders in NetEQ. Each codec type will have
|
||||||
// and implementation of this class.
|
// and implementation of this class.
|
||||||
class AudioDecoder {
|
class AudioDecoder {
|
||||||
@ -119,17 +86,6 @@ class AudioDecoder {
|
|||||||
// isn't a CNG decoder, don't call this method.
|
// isn't a CNG decoder, don't call this method.
|
||||||
virtual CNG_dec_inst* CngDecoderInstance();
|
virtual CNG_dec_inst* CngDecoderInstance();
|
||||||
|
|
||||||
// Returns true if |codec_type| is supported.
|
|
||||||
static bool CodecSupported(NetEqDecoder codec_type);
|
|
||||||
|
|
||||||
// Returns the sample rate for |codec_type|.
|
|
||||||
static int CodecSampleRateHz(NetEqDecoder codec_type);
|
|
||||||
|
|
||||||
// Creates an AudioDecoder object of type |codec_type|. Returns NULL for
|
|
||||||
// for unsupported codecs, and when creating an AudioDecoder is not
|
|
||||||
// applicable (e.g., for RED and DTMF/AVT types).
|
|
||||||
static AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type);
|
|
||||||
|
|
||||||
size_t channels() const { return channels_; }
|
size_t channels() const { return channels_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
20
webrtc/modules/audio_coding/codecs/interfaces.gypi
Normal file
20
webrtc/modules/audio_coding/codecs/interfaces.gypi
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Copyright (c) 2014 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.
|
||||||
|
|
||||||
|
{
|
||||||
|
'targets': [
|
||||||
|
{
|
||||||
|
'target_name': 'audio_decoder_interface',
|
||||||
|
'type': 'static_library',
|
||||||
|
'sources': [
|
||||||
|
'audio_decoder.cc',
|
||||||
|
'audio_decoder.h',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
@ -20,7 +20,6 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
// Includes needed to create the codecs.
|
// Includes needed to create the codecs.
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
|
|
||||||
#include "webrtc/base/thread_annotations.h"
|
#include "webrtc/base/thread_annotations.h"
|
||||||
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
|
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
|
#include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
|
#include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
|
#include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedefs.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/acm_codec_database.h"
|
#include "webrtc/modules/audio_coding/main/acm2/acm_codec_database.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
#include "webrtc/system_wrappers/interface/trace.h"
|
#include "webrtc/system_wrappers/interface/trace.h"
|
||||||
|
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
#define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_ISAC_H_
|
#define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_ACM_ISAC_H_
|
||||||
|
|
||||||
#include "webrtc/base/thread_annotations.h"
|
#include "webrtc/base/thread_annotations.h"
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/acm_generic_codec.h"
|
#include "webrtc/modules/audio_coding/main/acm2/acm_generic_codec.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
|
|
||||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||||
#include "webrtc/common_types.h"
|
#include "webrtc/common_types.h"
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
#include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/acm_resampler.h"
|
#include "webrtc/modules/audio_coding/main/acm2/acm_resampler.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/call_statistics.h"
|
#include "webrtc/modules/audio_coding/main/acm2/call_statistics.h"
|
||||||
#include "webrtc/modules/audio_coding/main/acm2/nack.h"
|
#include "webrtc/modules/audio_coding/main/acm2/nack.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
|
#include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
|
||||||
#include "webrtc/system_wrappers/interface/clock.h"
|
#include "webrtc/system_wrappers/interface/clock.h"
|
||||||
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
#include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
|
||||||
|
@ -1,268 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2012 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 "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "webrtc/base/checks.h"
|
|
||||||
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
|
||||||
|
|
||||||
int AudioDecoder::DecodeRedundant(const uint8_t* encoded,
|
|
||||||
size_t encoded_len,
|
|
||||||
int16_t* decoded,
|
|
||||||
SpeechType* speech_type) {
|
|
||||||
return Decode(encoded, encoded_len, decoded, speech_type);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AudioDecoder::HasDecodePlc() const { return false; }
|
|
||||||
|
|
||||||
int AudioDecoder::DecodePlc(int num_frames, int16_t* decoded) { return -1; }
|
|
||||||
|
|
||||||
int AudioDecoder::IncomingPacket(const uint8_t* payload,
|
|
||||||
size_t payload_len,
|
|
||||||
uint16_t rtp_sequence_number,
|
|
||||||
uint32_t rtp_timestamp,
|
|
||||||
uint32_t arrival_timestamp) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AudioDecoder::ErrorCode() { return 0; }
|
|
||||||
|
|
||||||
int AudioDecoder::PacketDuration(const uint8_t* encoded, size_t encoded_len) {
|
|
||||||
return kNotImplemented;
|
|
||||||
}
|
|
||||||
|
|
||||||
int AudioDecoder::PacketDurationRedundant(const uint8_t* encoded,
|
|
||||||
size_t encoded_len) const {
|
|
||||||
return kNotImplemented;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AudioDecoder::PacketHasFec(const uint8_t* encoded,
|
|
||||||
size_t encoded_len) const {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
CNG_dec_inst* AudioDecoder::CngDecoderInstance() {
|
|
||||||
FATAL() << "Not a CNG decoder";
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool AudioDecoder::CodecSupported(NetEqDecoder codec_type) {
|
|
||||||
switch (codec_type) {
|
|
||||||
case kDecoderPCMu:
|
|
||||||
case kDecoderPCMa:
|
|
||||||
case kDecoderPCMu_2ch:
|
|
||||||
case kDecoderPCMa_2ch:
|
|
||||||
#ifdef WEBRTC_CODEC_ILBC
|
|
||||||
case kDecoderILBC:
|
|
||||||
#endif
|
|
||||||
#if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
|
|
||||||
case kDecoderISAC:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_ISAC
|
|
||||||
case kDecoderISACswb:
|
|
||||||
case kDecoderISACfb:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_PCM16
|
|
||||||
case kDecoderPCM16B:
|
|
||||||
case kDecoderPCM16Bwb:
|
|
||||||
case kDecoderPCM16Bswb32kHz:
|
|
||||||
case kDecoderPCM16Bswb48kHz:
|
|
||||||
case kDecoderPCM16B_2ch:
|
|
||||||
case kDecoderPCM16Bwb_2ch:
|
|
||||||
case kDecoderPCM16Bswb32kHz_2ch:
|
|
||||||
case kDecoderPCM16Bswb48kHz_2ch:
|
|
||||||
case kDecoderPCM16B_5ch:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_G722
|
|
||||||
case kDecoderG722:
|
|
||||||
case kDecoderG722_2ch:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_CELT
|
|
||||||
case kDecoderCELT_32:
|
|
||||||
case kDecoderCELT_32_2ch:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_OPUS
|
|
||||||
case kDecoderOpus:
|
|
||||||
case kDecoderOpus_2ch:
|
|
||||||
#endif
|
|
||||||
case kDecoderRED:
|
|
||||||
case kDecoderAVT:
|
|
||||||
case kDecoderCNGnb:
|
|
||||||
case kDecoderCNGwb:
|
|
||||||
case kDecoderCNGswb32kHz:
|
|
||||||
case kDecoderCNGswb48kHz:
|
|
||||||
case kDecoderArbitrary: {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int AudioDecoder::CodecSampleRateHz(NetEqDecoder codec_type) {
|
|
||||||
switch (codec_type) {
|
|
||||||
case kDecoderPCMu:
|
|
||||||
case kDecoderPCMa:
|
|
||||||
case kDecoderPCMu_2ch:
|
|
||||||
case kDecoderPCMa_2ch:
|
|
||||||
#ifdef WEBRTC_CODEC_ILBC
|
|
||||||
case kDecoderILBC:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_PCM16
|
|
||||||
case kDecoderPCM16B:
|
|
||||||
case kDecoderPCM16B_2ch:
|
|
||||||
case kDecoderPCM16B_5ch:
|
|
||||||
#endif
|
|
||||||
case kDecoderCNGnb: {
|
|
||||||
return 8000;
|
|
||||||
}
|
|
||||||
#if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
|
|
||||||
case kDecoderISAC:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_PCM16
|
|
||||||
case kDecoderPCM16Bwb:
|
|
||||||
case kDecoderPCM16Bwb_2ch:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_G722
|
|
||||||
case kDecoderG722:
|
|
||||||
case kDecoderG722_2ch:
|
|
||||||
#endif
|
|
||||||
case kDecoderCNGwb: {
|
|
||||||
return 16000;
|
|
||||||
}
|
|
||||||
#ifdef WEBRTC_CODEC_ISAC
|
|
||||||
case kDecoderISACswb:
|
|
||||||
case kDecoderISACfb:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_PCM16
|
|
||||||
case kDecoderPCM16Bswb32kHz:
|
|
||||||
case kDecoderPCM16Bswb32kHz_2ch:
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_CELT
|
|
||||||
case kDecoderCELT_32:
|
|
||||||
case kDecoderCELT_32_2ch:
|
|
||||||
#endif
|
|
||||||
case kDecoderCNGswb32kHz: {
|
|
||||||
return 32000;
|
|
||||||
}
|
|
||||||
#ifdef WEBRTC_CODEC_PCM16
|
|
||||||
case kDecoderPCM16Bswb48kHz:
|
|
||||||
case kDecoderPCM16Bswb48kHz_2ch: {
|
|
||||||
return 48000;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_OPUS
|
|
||||||
case kDecoderOpus:
|
|
||||||
case kDecoderOpus_2ch: {
|
|
||||||
return 48000;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
case kDecoderCNGswb48kHz: {
|
|
||||||
// TODO(tlegrand): Remove limitation once ACM has full 48 kHz support.
|
|
||||||
return 32000;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
return -1; // Undefined sample rate.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioDecoder* AudioDecoder::CreateAudioDecoder(NetEqDecoder codec_type) {
|
|
||||||
if (!CodecSupported(codec_type)) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
switch (codec_type) {
|
|
||||||
case kDecoderPCMu:
|
|
||||||
return new AudioDecoderPcmU;
|
|
||||||
case kDecoderPCMa:
|
|
||||||
return new AudioDecoderPcmA;
|
|
||||||
case kDecoderPCMu_2ch:
|
|
||||||
return new AudioDecoderPcmUMultiCh(2);
|
|
||||||
case kDecoderPCMa_2ch:
|
|
||||||
return new AudioDecoderPcmAMultiCh(2);
|
|
||||||
#ifdef WEBRTC_CODEC_ILBC
|
|
||||||
case kDecoderILBC:
|
|
||||||
return new AudioDecoderIlbc;
|
|
||||||
#endif
|
|
||||||
#if defined(WEBRTC_CODEC_ISACFX)
|
|
||||||
case kDecoderISAC:
|
|
||||||
return new AudioDecoderIsacFix;
|
|
||||||
#elif defined(WEBRTC_CODEC_ISAC)
|
|
||||||
case kDecoderISAC:
|
|
||||||
return new AudioDecoderIsac(16000);
|
|
||||||
case kDecoderISACswb:
|
|
||||||
case kDecoderISACfb:
|
|
||||||
return new AudioDecoderIsac(32000);
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_PCM16
|
|
||||||
case kDecoderPCM16B:
|
|
||||||
case kDecoderPCM16Bwb:
|
|
||||||
case kDecoderPCM16Bswb32kHz:
|
|
||||||
case kDecoderPCM16Bswb48kHz:
|
|
||||||
return new AudioDecoderPcm16B;
|
|
||||||
case kDecoderPCM16B_2ch:
|
|
||||||
case kDecoderPCM16Bwb_2ch:
|
|
||||||
case kDecoderPCM16Bswb32kHz_2ch:
|
|
||||||
case kDecoderPCM16Bswb48kHz_2ch:
|
|
||||||
return new AudioDecoderPcm16BMultiCh(2);
|
|
||||||
case kDecoderPCM16B_5ch:
|
|
||||||
return new AudioDecoderPcm16BMultiCh(5);
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_G722
|
|
||||||
case kDecoderG722:
|
|
||||||
return new AudioDecoderG722;
|
|
||||||
case kDecoderG722_2ch:
|
|
||||||
return new AudioDecoderG722Stereo;
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_CELT
|
|
||||||
case kDecoderCELT_32:
|
|
||||||
return new AudioDecoderCelt(1);
|
|
||||||
case kDecoderCELT_32_2ch:
|
|
||||||
return new AudioDecoderCelt(2);
|
|
||||||
#endif
|
|
||||||
#ifdef WEBRTC_CODEC_OPUS
|
|
||||||
case kDecoderOpus:
|
|
||||||
return new AudioDecoderOpus(1);
|
|
||||||
case kDecoderOpus_2ch:
|
|
||||||
return new AudioDecoderOpus(2);
|
|
||||||
#endif
|
|
||||||
case kDecoderCNGnb:
|
|
||||||
case kDecoderCNGwb:
|
|
||||||
case kDecoderCNGswb32kHz:
|
|
||||||
case kDecoderCNGswb48kHz:
|
|
||||||
return new AudioDecoderCng;
|
|
||||||
case kDecoderRED:
|
|
||||||
case kDecoderAVT:
|
|
||||||
case kDecoderArbitrary:
|
|
||||||
default: {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
AudioDecoder::SpeechType AudioDecoder::ConvertSpeechType(int16_t type) {
|
|
||||||
switch (type) {
|
|
||||||
case 0: // TODO(hlundin): Both iSAC and Opus return 0 for speech.
|
|
||||||
case 1:
|
|
||||||
return kSpeech;
|
|
||||||
case 2:
|
|
||||||
return kComfortNoise;
|
|
||||||
default:
|
|
||||||
assert(false);
|
|
||||||
return kSpeech;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace webrtc
|
|
@ -461,4 +461,199 @@ int AudioDecoderCng::Init() {
|
|||||||
return WebRtcCng_InitDec(dec_state_);
|
return WebRtcCng_InitDec(dec_state_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CodecSupported(NetEqDecoder codec_type) {
|
||||||
|
switch (codec_type) {
|
||||||
|
case kDecoderPCMu:
|
||||||
|
case kDecoderPCMa:
|
||||||
|
case kDecoderPCMu_2ch:
|
||||||
|
case kDecoderPCMa_2ch:
|
||||||
|
#ifdef WEBRTC_CODEC_ILBC
|
||||||
|
case kDecoderILBC:
|
||||||
|
#endif
|
||||||
|
#if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
|
||||||
|
case kDecoderISAC:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_ISAC
|
||||||
|
case kDecoderISACswb:
|
||||||
|
case kDecoderISACfb:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_PCM16
|
||||||
|
case kDecoderPCM16B:
|
||||||
|
case kDecoderPCM16Bwb:
|
||||||
|
case kDecoderPCM16Bswb32kHz:
|
||||||
|
case kDecoderPCM16Bswb48kHz:
|
||||||
|
case kDecoderPCM16B_2ch:
|
||||||
|
case kDecoderPCM16Bwb_2ch:
|
||||||
|
case kDecoderPCM16Bswb32kHz_2ch:
|
||||||
|
case kDecoderPCM16Bswb48kHz_2ch:
|
||||||
|
case kDecoderPCM16B_5ch:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_G722
|
||||||
|
case kDecoderG722:
|
||||||
|
case kDecoderG722_2ch:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_CELT
|
||||||
|
case kDecoderCELT_32:
|
||||||
|
case kDecoderCELT_32_2ch:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_OPUS
|
||||||
|
case kDecoderOpus:
|
||||||
|
case kDecoderOpus_2ch:
|
||||||
|
#endif
|
||||||
|
case kDecoderRED:
|
||||||
|
case kDecoderAVT:
|
||||||
|
case kDecoderCNGnb:
|
||||||
|
case kDecoderCNGwb:
|
||||||
|
case kDecoderCNGswb32kHz:
|
||||||
|
case kDecoderCNGswb48kHz:
|
||||||
|
case kDecoderArbitrary: {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int CodecSampleRateHz(NetEqDecoder codec_type) {
|
||||||
|
switch (codec_type) {
|
||||||
|
case kDecoderPCMu:
|
||||||
|
case kDecoderPCMa:
|
||||||
|
case kDecoderPCMu_2ch:
|
||||||
|
case kDecoderPCMa_2ch:
|
||||||
|
#ifdef WEBRTC_CODEC_ILBC
|
||||||
|
case kDecoderILBC:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_PCM16
|
||||||
|
case kDecoderPCM16B:
|
||||||
|
case kDecoderPCM16B_2ch:
|
||||||
|
case kDecoderPCM16B_5ch:
|
||||||
|
#endif
|
||||||
|
case kDecoderCNGnb: {
|
||||||
|
return 8000;
|
||||||
|
}
|
||||||
|
#if defined(WEBRTC_CODEC_ISACFX) || defined(WEBRTC_CODEC_ISAC)
|
||||||
|
case kDecoderISAC:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_PCM16
|
||||||
|
case kDecoderPCM16Bwb:
|
||||||
|
case kDecoderPCM16Bwb_2ch:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_G722
|
||||||
|
case kDecoderG722:
|
||||||
|
case kDecoderG722_2ch:
|
||||||
|
#endif
|
||||||
|
case kDecoderCNGwb: {
|
||||||
|
return 16000;
|
||||||
|
}
|
||||||
|
#ifdef WEBRTC_CODEC_ISAC
|
||||||
|
case kDecoderISACswb:
|
||||||
|
case kDecoderISACfb:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_PCM16
|
||||||
|
case kDecoderPCM16Bswb32kHz:
|
||||||
|
case kDecoderPCM16Bswb32kHz_2ch:
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_CELT
|
||||||
|
case kDecoderCELT_32:
|
||||||
|
case kDecoderCELT_32_2ch:
|
||||||
|
#endif
|
||||||
|
case kDecoderCNGswb32kHz: {
|
||||||
|
return 32000;
|
||||||
|
}
|
||||||
|
#ifdef WEBRTC_CODEC_PCM16
|
||||||
|
case kDecoderPCM16Bswb48kHz:
|
||||||
|
case kDecoderPCM16Bswb48kHz_2ch: {
|
||||||
|
return 48000;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_OPUS
|
||||||
|
case kDecoderOpus:
|
||||||
|
case kDecoderOpus_2ch: {
|
||||||
|
return 48000;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
case kDecoderCNGswb48kHz: {
|
||||||
|
// TODO(tlegrand): Remove limitation once ACM has full 48 kHz support.
|
||||||
|
return 32000;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
return -1; // Undefined sample rate.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type) {
|
||||||
|
if (!CodecSupported(codec_type)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
switch (codec_type) {
|
||||||
|
case kDecoderPCMu:
|
||||||
|
return new AudioDecoderPcmU;
|
||||||
|
case kDecoderPCMa:
|
||||||
|
return new AudioDecoderPcmA;
|
||||||
|
case kDecoderPCMu_2ch:
|
||||||
|
return new AudioDecoderPcmUMultiCh(2);
|
||||||
|
case kDecoderPCMa_2ch:
|
||||||
|
return new AudioDecoderPcmAMultiCh(2);
|
||||||
|
#ifdef WEBRTC_CODEC_ILBC
|
||||||
|
case kDecoderILBC:
|
||||||
|
return new AudioDecoderIlbc;
|
||||||
|
#endif
|
||||||
|
#if defined(WEBRTC_CODEC_ISACFX)
|
||||||
|
case kDecoderISAC:
|
||||||
|
return new AudioDecoderIsacFix;
|
||||||
|
#elif defined(WEBRTC_CODEC_ISAC)
|
||||||
|
case kDecoderISAC:
|
||||||
|
return new AudioDecoderIsac(16000);
|
||||||
|
case kDecoderISACswb:
|
||||||
|
case kDecoderISACfb:
|
||||||
|
return new AudioDecoderIsac(32000);
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_PCM16
|
||||||
|
case kDecoderPCM16B:
|
||||||
|
case kDecoderPCM16Bwb:
|
||||||
|
case kDecoderPCM16Bswb32kHz:
|
||||||
|
case kDecoderPCM16Bswb48kHz:
|
||||||
|
return new AudioDecoderPcm16B;
|
||||||
|
case kDecoderPCM16B_2ch:
|
||||||
|
case kDecoderPCM16Bwb_2ch:
|
||||||
|
case kDecoderPCM16Bswb32kHz_2ch:
|
||||||
|
case kDecoderPCM16Bswb48kHz_2ch:
|
||||||
|
return new AudioDecoderPcm16BMultiCh(2);
|
||||||
|
case kDecoderPCM16B_5ch:
|
||||||
|
return new AudioDecoderPcm16BMultiCh(5);
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_G722
|
||||||
|
case kDecoderG722:
|
||||||
|
return new AudioDecoderG722;
|
||||||
|
case kDecoderG722_2ch:
|
||||||
|
return new AudioDecoderG722Stereo;
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_CELT
|
||||||
|
case kDecoderCELT_32:
|
||||||
|
return new AudioDecoderCelt(1);
|
||||||
|
case kDecoderCELT_32_2ch:
|
||||||
|
return new AudioDecoderCelt(2);
|
||||||
|
#endif
|
||||||
|
#ifdef WEBRTC_CODEC_OPUS
|
||||||
|
case kDecoderOpus:
|
||||||
|
return new AudioDecoderOpus(1);
|
||||||
|
case kDecoderOpus_2ch:
|
||||||
|
return new AudioDecoderOpus(2);
|
||||||
|
#endif
|
||||||
|
case kDecoderCNGnb:
|
||||||
|
case kDecoderCNGwb:
|
||||||
|
case kDecoderCNGswb32kHz:
|
||||||
|
case kDecoderCNGswb48kHz:
|
||||||
|
return new AudioDecoderCng;
|
||||||
|
case kDecoderRED:
|
||||||
|
case kDecoderAVT:
|
||||||
|
case kDecoderArbitrary:
|
||||||
|
default: {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "webrtc/engine_configurations.h"
|
#include "webrtc/engine_configurations.h"
|
||||||
#endif
|
#endif
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
||||||
#ifdef WEBRTC_CODEC_G722
|
#ifdef WEBRTC_CODEC_G722
|
||||||
#include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h"
|
#include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h"
|
||||||
@ -35,7 +36,6 @@
|
|||||||
#ifdef WEBRTC_CODEC_OPUS
|
#ifdef WEBRTC_CODEC_OPUS
|
||||||
#include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h"
|
#include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h"
|
||||||
#endif
|
#endif
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
@ -280,5 +280,49 @@ class AudioDecoderCng : public AudioDecoder {
|
|||||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderCng);
|
DISALLOW_COPY_AND_ASSIGN(AudioDecoderCng);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum NetEqDecoder {
|
||||||
|
kDecoderPCMu,
|
||||||
|
kDecoderPCMa,
|
||||||
|
kDecoderPCMu_2ch,
|
||||||
|
kDecoderPCMa_2ch,
|
||||||
|
kDecoderILBC,
|
||||||
|
kDecoderISAC,
|
||||||
|
kDecoderISACswb,
|
||||||
|
kDecoderISACfb,
|
||||||
|
kDecoderPCM16B,
|
||||||
|
kDecoderPCM16Bwb,
|
||||||
|
kDecoderPCM16Bswb32kHz,
|
||||||
|
kDecoderPCM16Bswb48kHz,
|
||||||
|
kDecoderPCM16B_2ch,
|
||||||
|
kDecoderPCM16Bwb_2ch,
|
||||||
|
kDecoderPCM16Bswb32kHz_2ch,
|
||||||
|
kDecoderPCM16Bswb48kHz_2ch,
|
||||||
|
kDecoderPCM16B_5ch,
|
||||||
|
kDecoderG722,
|
||||||
|
kDecoderG722_2ch,
|
||||||
|
kDecoderRED,
|
||||||
|
kDecoderAVT,
|
||||||
|
kDecoderCNGnb,
|
||||||
|
kDecoderCNGwb,
|
||||||
|
kDecoderCNGswb32kHz,
|
||||||
|
kDecoderCNGswb48kHz,
|
||||||
|
kDecoderArbitrary,
|
||||||
|
kDecoderOpus,
|
||||||
|
kDecoderOpus_2ch,
|
||||||
|
kDecoderCELT_32,
|
||||||
|
kDecoderCELT_32_2ch,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Returns true if |codec_type| is supported.
|
||||||
|
bool CodecSupported(NetEqDecoder codec_type);
|
||||||
|
|
||||||
|
// Returns the sample rate for |codec_type|.
|
||||||
|
int CodecSampleRateHz(NetEqDecoder codec_type);
|
||||||
|
|
||||||
|
// Creates an AudioDecoder object of type |codec_type|. Returns NULL for for
|
||||||
|
// unsupported codecs, and when creating an AudioDecoder is not applicable
|
||||||
|
// (e.g., for RED and DTMF/AVT types).
|
||||||
|
AudioDecoder* CreateAudioDecoder(NetEqDecoder codec_type);
|
||||||
|
|
||||||
} // namespace webrtc
|
} // namespace webrtc
|
||||||
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
|
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
|
||||||
|
@ -602,7 +602,7 @@ class AudioDecoderOpusStereoTest : public AudioDecoderOpusTest {
|
|||||||
TEST_F(AudioDecoderPcmUTest, EncodeDecode) {
|
TEST_F(AudioDecoderPcmUTest, EncodeDecode) {
|
||||||
int tolerance = 251;
|
int tolerance = 251;
|
||||||
double mse = 1734.0;
|
double mse = 1734.0;
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCMu));
|
EXPECT_TRUE(CodecSupported(kDecoderPCMu));
|
||||||
EncodeDecodeTest(data_length_, tolerance, mse);
|
EncodeDecodeTest(data_length_, tolerance, mse);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||||
@ -611,7 +611,7 @@ TEST_F(AudioDecoderPcmUTest, EncodeDecode) {
|
|||||||
TEST_F(AudioDecoderPcmATest, EncodeDecode) {
|
TEST_F(AudioDecoderPcmATest, EncodeDecode) {
|
||||||
int tolerance = 308;
|
int tolerance = 308;
|
||||||
double mse = 1931.0;
|
double mse = 1931.0;
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCMa));
|
EXPECT_TRUE(CodecSupported(kDecoderPCMa));
|
||||||
EncodeDecodeTest(data_length_, tolerance, mse);
|
EncodeDecodeTest(data_length_, tolerance, mse);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||||
@ -620,10 +620,10 @@ TEST_F(AudioDecoderPcmATest, EncodeDecode) {
|
|||||||
TEST_F(AudioDecoderPcm16BTest, EncodeDecode) {
|
TEST_F(AudioDecoderPcm16BTest, EncodeDecode) {
|
||||||
int tolerance = 0;
|
int tolerance = 0;
|
||||||
double mse = 0.0;
|
double mse = 0.0;
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16B));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16B));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bwb));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bwb));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bswb32kHz));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb32kHz));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bswb48kHz));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb48kHz));
|
||||||
EncodeDecodeTest(2 * data_length_, tolerance, mse);
|
EncodeDecodeTest(2 * data_length_, tolerance, mse);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||||
@ -633,7 +633,7 @@ TEST_F(AudioDecoderIlbcTest, EncodeDecode) {
|
|||||||
int tolerance = 6808;
|
int tolerance = 6808;
|
||||||
double mse = 2.13e6;
|
double mse = 2.13e6;
|
||||||
int delay = 80; // Delay from input to output.
|
int delay = 80; // Delay from input to output.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderILBC));
|
EXPECT_TRUE(CodecSupported(kDecoderILBC));
|
||||||
EncodeDecodeTest(500, tolerance, mse, delay);
|
EncodeDecodeTest(500, tolerance, mse, delay);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_TRUE(decoder_->HasDecodePlc());
|
EXPECT_TRUE(decoder_->HasDecodePlc());
|
||||||
@ -644,7 +644,7 @@ TEST_F(AudioDecoderIsacFloatTest, EncodeDecode) {
|
|||||||
int tolerance = 3399;
|
int tolerance = 3399;
|
||||||
double mse = 434951.0;
|
double mse = 434951.0;
|
||||||
int delay = 48; // Delay from input to output.
|
int delay = 48; // Delay from input to output.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderISAC));
|
EXPECT_TRUE(CodecSupported(kDecoderISAC));
|
||||||
EncodeDecodeTest(0, tolerance, mse, delay);
|
EncodeDecodeTest(0, tolerance, mse, delay);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_TRUE(decoder_->HasDecodePlc());
|
EXPECT_TRUE(decoder_->HasDecodePlc());
|
||||||
@ -655,7 +655,7 @@ TEST_F(AudioDecoderIsacSwbTest, EncodeDecode) {
|
|||||||
int tolerance = 19757;
|
int tolerance = 19757;
|
||||||
double mse = 8.18e6;
|
double mse = 8.18e6;
|
||||||
int delay = 160; // Delay from input to output.
|
int delay = 160; // Delay from input to output.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderISACswb));
|
EXPECT_TRUE(CodecSupported(kDecoderISACswb));
|
||||||
EncodeDecodeTest(0, tolerance, mse, delay);
|
EncodeDecodeTest(0, tolerance, mse, delay);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_TRUE(decoder_->HasDecodePlc());
|
EXPECT_TRUE(decoder_->HasDecodePlc());
|
||||||
@ -666,7 +666,7 @@ TEST_F(AudioDecoderIsacFixTest, DISABLED_EncodeDecode) {
|
|||||||
int tolerance = 11034;
|
int tolerance = 11034;
|
||||||
double mse = 3.46e6;
|
double mse = 3.46e6;
|
||||||
int delay = 54; // Delay from input to output.
|
int delay = 54; // Delay from input to output.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderISAC));
|
EXPECT_TRUE(CodecSupported(kDecoderISAC));
|
||||||
EncodeDecodeTest(735, tolerance, mse, delay);
|
EncodeDecodeTest(735, tolerance, mse, delay);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||||
@ -676,14 +676,14 @@ TEST_F(AudioDecoderG722Test, EncodeDecode) {
|
|||||||
int tolerance = 6176;
|
int tolerance = 6176;
|
||||||
double mse = 238630.0;
|
double mse = 238630.0;
|
||||||
int delay = 22; // Delay from input to output.
|
int delay = 22; // Delay from input to output.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderG722));
|
EXPECT_TRUE(CodecSupported(kDecoderG722));
|
||||||
EncodeDecodeTest(data_length_ / 2, tolerance, mse, delay);
|
EncodeDecodeTest(data_length_ / 2, tolerance, mse, delay);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AudioDecoderG722StereoTest, CreateAndDestroy) {
|
TEST_F(AudioDecoderG722StereoTest, CreateAndDestroy) {
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderG722_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderG722_2ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(AudioDecoderG722StereoTest, EncodeDecode) {
|
TEST_F(AudioDecoderG722StereoTest, EncodeDecode) {
|
||||||
@ -691,7 +691,7 @@ TEST_F(AudioDecoderG722StereoTest, EncodeDecode) {
|
|||||||
int channel_diff_tolerance = 0;
|
int channel_diff_tolerance = 0;
|
||||||
double mse = 238630.0;
|
double mse = 238630.0;
|
||||||
int delay = 22; // Delay from input to output.
|
int delay = 22; // Delay from input to output.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderG722_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderG722_2ch));
|
||||||
EncodeDecodeTest(data_length_, tolerance, mse, delay, channel_diff_tolerance);
|
EncodeDecodeTest(data_length_, tolerance, mse, delay, channel_diff_tolerance);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||||
@ -701,7 +701,7 @@ TEST_F(AudioDecoderOpusTest, EncodeDecode) {
|
|||||||
int tolerance = 6176;
|
int tolerance = 6176;
|
||||||
double mse = 238630.0;
|
double mse = 238630.0;
|
||||||
int delay = 22; // Delay from input to output.
|
int delay = 22; // Delay from input to output.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderOpus));
|
EXPECT_TRUE(CodecSupported(kDecoderOpus));
|
||||||
EncodeDecodeTest(0, tolerance, mse, delay);
|
EncodeDecodeTest(0, tolerance, mse, delay);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||||
@ -712,7 +712,7 @@ TEST_F(AudioDecoderOpusStereoTest, EncodeDecode) {
|
|||||||
int channel_diff_tolerance = 0;
|
int channel_diff_tolerance = 0;
|
||||||
double mse = 238630.0;
|
double mse = 238630.0;
|
||||||
int delay = 22; // Delay from input to output.
|
int delay = 22; // Delay from input to output.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderOpus_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderOpus_2ch));
|
||||||
EncodeDecodeTest(0, tolerance, mse, delay, channel_diff_tolerance);
|
EncodeDecodeTest(0, tolerance, mse, delay, channel_diff_tolerance);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_FALSE(decoder_->HasDecodePlc());
|
EXPECT_FALSE(decoder_->HasDecodePlc());
|
||||||
@ -727,7 +727,7 @@ TEST_F(AudioDecoderCeltTest, EncodeDecode) {
|
|||||||
int tolerance = 20;
|
int tolerance = 20;
|
||||||
double mse = 17.0;
|
double mse = 17.0;
|
||||||
int delay = 80; // Delay from input to output in samples.
|
int delay = 80; // Delay from input to output in samples.
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderCELT_32));
|
EXPECT_TRUE(CodecSupported(kDecoderCELT_32));
|
||||||
EncodeDecodeTest(1600, tolerance, mse, delay);
|
EncodeDecodeTest(1600, tolerance, mse, delay);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_TRUE(decoder_->HasDecodePlc());
|
EXPECT_TRUE(decoder_->HasDecodePlc());
|
||||||
@ -742,7 +742,7 @@ TEST_F(AudioDecoderCeltStereoTest, EncodeDecode) {
|
|||||||
double mse = 20.0;
|
double mse = 20.0;
|
||||||
// Delay from input to output in samples, accounting for stereo.
|
// Delay from input to output in samples, accounting for stereo.
|
||||||
int delay = 160;
|
int delay = 160;
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderCELT_32_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderCELT_32_2ch));
|
||||||
EncodeDecodeTest(1600, tolerance, mse, delay, channel_diff_tolerance);
|
EncodeDecodeTest(1600, tolerance, mse, delay, channel_diff_tolerance);
|
||||||
ReInitTest();
|
ReInitTest();
|
||||||
EXPECT_TRUE(decoder_->HasDecodePlc());
|
EXPECT_TRUE(decoder_->HasDecodePlc());
|
||||||
@ -751,79 +751,79 @@ TEST_F(AudioDecoderCeltStereoTest, EncodeDecode) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TEST(AudioDecoder, CodecSampleRateHz) {
|
TEST(AudioDecoder, CodecSampleRateHz) {
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderPCMu));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMu));
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderPCMa));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMa));
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderPCMu_2ch));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMu_2ch));
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderPCMa_2ch));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCMa_2ch));
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderILBC));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderILBC));
|
||||||
EXPECT_EQ(16000, AudioDecoder::CodecSampleRateHz(kDecoderISAC));
|
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderISAC));
|
||||||
EXPECT_EQ(32000, AudioDecoder::CodecSampleRateHz(kDecoderISACswb));
|
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderISACswb));
|
||||||
EXPECT_EQ(32000, AudioDecoder::CodecSampleRateHz(kDecoderISACfb));
|
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderISACfb));
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16B));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCM16B));
|
||||||
EXPECT_EQ(16000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16Bwb));
|
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderPCM16Bwb));
|
||||||
EXPECT_EQ(32000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16Bswb32kHz));
|
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderPCM16Bswb32kHz));
|
||||||
EXPECT_EQ(48000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16Bswb48kHz));
|
EXPECT_EQ(48000, CodecSampleRateHz(kDecoderPCM16Bswb48kHz));
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16B_2ch));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCM16B_2ch));
|
||||||
EXPECT_EQ(16000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16Bwb_2ch));
|
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderPCM16Bwb_2ch));
|
||||||
EXPECT_EQ(32000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16Bswb32kHz_2ch));
|
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderPCM16Bswb32kHz_2ch));
|
||||||
EXPECT_EQ(48000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16Bswb48kHz_2ch));
|
EXPECT_EQ(48000, CodecSampleRateHz(kDecoderPCM16Bswb48kHz_2ch));
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderPCM16B_5ch));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderPCM16B_5ch));
|
||||||
EXPECT_EQ(16000, AudioDecoder::CodecSampleRateHz(kDecoderG722));
|
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderG722));
|
||||||
EXPECT_EQ(16000, AudioDecoder::CodecSampleRateHz(kDecoderG722_2ch));
|
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderG722_2ch));
|
||||||
EXPECT_EQ(-1, AudioDecoder::CodecSampleRateHz(kDecoderRED));
|
EXPECT_EQ(-1, CodecSampleRateHz(kDecoderRED));
|
||||||
EXPECT_EQ(-1, AudioDecoder::CodecSampleRateHz(kDecoderAVT));
|
EXPECT_EQ(-1, CodecSampleRateHz(kDecoderAVT));
|
||||||
EXPECT_EQ(8000, AudioDecoder::CodecSampleRateHz(kDecoderCNGnb));
|
EXPECT_EQ(8000, CodecSampleRateHz(kDecoderCNGnb));
|
||||||
EXPECT_EQ(16000, AudioDecoder::CodecSampleRateHz(kDecoderCNGwb));
|
EXPECT_EQ(16000, CodecSampleRateHz(kDecoderCNGwb));
|
||||||
EXPECT_EQ(32000, AudioDecoder::CodecSampleRateHz(kDecoderCNGswb32kHz));
|
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderCNGswb32kHz));
|
||||||
EXPECT_EQ(48000, AudioDecoder::CodecSampleRateHz(kDecoderOpus));
|
EXPECT_EQ(48000, CodecSampleRateHz(kDecoderOpus));
|
||||||
EXPECT_EQ(48000, AudioDecoder::CodecSampleRateHz(kDecoderOpus_2ch));
|
EXPECT_EQ(48000, CodecSampleRateHz(kDecoderOpus_2ch));
|
||||||
// TODO(tlegrand): Change 32000 to 48000 below once ACM has 48 kHz support.
|
// TODO(tlegrand): Change 32000 to 48000 below once ACM has 48 kHz support.
|
||||||
EXPECT_EQ(32000, AudioDecoder::CodecSampleRateHz(kDecoderCNGswb48kHz));
|
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderCNGswb48kHz));
|
||||||
EXPECT_EQ(-1, AudioDecoder::CodecSampleRateHz(kDecoderArbitrary));
|
EXPECT_EQ(-1, CodecSampleRateHz(kDecoderArbitrary));
|
||||||
#ifdef WEBRTC_CODEC_CELT
|
#ifdef WEBRTC_CODEC_CELT
|
||||||
EXPECT_EQ(32000, AudioDecoder::CodecSampleRateHz(kDecoderCELT_32));
|
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderCELT_32));
|
||||||
EXPECT_EQ(32000, AudioDecoder::CodecSampleRateHz(kDecoderCELT_32_2ch));
|
EXPECT_EQ(32000, CodecSampleRateHz(kDecoderCELT_32_2ch));
|
||||||
#else
|
#else
|
||||||
EXPECT_EQ(-1, AudioDecoder::CodecSampleRateHz(kDecoderCELT_32));
|
EXPECT_EQ(-1, CodecSampleRateHz(kDecoderCELT_32));
|
||||||
EXPECT_EQ(-1, AudioDecoder::CodecSampleRateHz(kDecoderCELT_32_2ch));
|
EXPECT_EQ(-1, CodecSampleRateHz(kDecoderCELT_32_2ch));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(AudioDecoder, CodecSupported) {
|
TEST(AudioDecoder, CodecSupported) {
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCMu));
|
EXPECT_TRUE(CodecSupported(kDecoderPCMu));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCMa));
|
EXPECT_TRUE(CodecSupported(kDecoderPCMa));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCMu_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderPCMu_2ch));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCMa_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderPCMa_2ch));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderILBC));
|
EXPECT_TRUE(CodecSupported(kDecoderILBC));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderISAC));
|
EXPECT_TRUE(CodecSupported(kDecoderISAC));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderISACswb));
|
EXPECT_TRUE(CodecSupported(kDecoderISACswb));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderISACfb));
|
EXPECT_TRUE(CodecSupported(kDecoderISACfb));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16B));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16B));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bwb));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bwb));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bswb32kHz));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb32kHz));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bswb48kHz));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb48kHz));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16B_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16B_2ch));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bwb_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bwb_2ch));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bswb32kHz_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb32kHz_2ch));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16Bswb48kHz_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16Bswb48kHz_2ch));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderPCM16B_5ch));
|
EXPECT_TRUE(CodecSupported(kDecoderPCM16B_5ch));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderG722));
|
EXPECT_TRUE(CodecSupported(kDecoderG722));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderG722_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderG722_2ch));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderRED));
|
EXPECT_TRUE(CodecSupported(kDecoderRED));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderAVT));
|
EXPECT_TRUE(CodecSupported(kDecoderAVT));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderCNGnb));
|
EXPECT_TRUE(CodecSupported(kDecoderCNGnb));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderCNGwb));
|
EXPECT_TRUE(CodecSupported(kDecoderCNGwb));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderCNGswb32kHz));
|
EXPECT_TRUE(CodecSupported(kDecoderCNGswb32kHz));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderCNGswb48kHz));
|
EXPECT_TRUE(CodecSupported(kDecoderCNGswb48kHz));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderArbitrary));
|
EXPECT_TRUE(CodecSupported(kDecoderArbitrary));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderOpus));
|
EXPECT_TRUE(CodecSupported(kDecoderOpus));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderOpus_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderOpus_2ch));
|
||||||
#ifdef WEBRTC_CODEC_CELT
|
#ifdef WEBRTC_CODEC_CELT
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderCELT_32));
|
EXPECT_TRUE(CodecSupported(kDecoderCELT_32));
|
||||||
EXPECT_TRUE(AudioDecoder::CodecSupported(kDecoderCELT_32_2ch));
|
EXPECT_TRUE(CodecSupported(kDecoderCELT_32_2ch));
|
||||||
#else
|
#else
|
||||||
EXPECT_FALSE(AudioDecoder::CodecSupported(kDecoderCELT_32));
|
EXPECT_FALSE(CodecSupported(kDecoderCELT_32));
|
||||||
EXPECT_FALSE(AudioDecoder::CodecSupported(kDecoderCELT_32_2ch));
|
EXPECT_FALSE(CodecSupported(kDecoderCELT_32_2ch));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/dsp_helper.h"
|
#include "webrtc/modules/audio_coding/neteq/dsp_helper.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/modules/audio_coding/neteq/sync_buffer.h"
|
#include "webrtc/modules/audio_coding/neteq/sync_buffer.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <utility> // pair
|
#include <utility> // pair
|
||||||
|
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
@ -41,10 +41,10 @@ int DecoderDatabase::RegisterPayload(uint8_t rtp_payload_type,
|
|||||||
if (rtp_payload_type > kMaxRtpPayloadType) {
|
if (rtp_payload_type > kMaxRtpPayloadType) {
|
||||||
return kInvalidRtpPayloadType;
|
return kInvalidRtpPayloadType;
|
||||||
}
|
}
|
||||||
if (!AudioDecoder::CodecSupported(codec_type)) {
|
if (!CodecSupported(codec_type)) {
|
||||||
return kCodecNotSupported;
|
return kCodecNotSupported;
|
||||||
}
|
}
|
||||||
int fs_hz = AudioDecoder::CodecSampleRateHz(codec_type);
|
int fs_hz = CodecSampleRateHz(codec_type);
|
||||||
std::pair<DecoderMap::iterator, bool> ret;
|
std::pair<DecoderMap::iterator, bool> ret;
|
||||||
DecoderInfo info(codec_type, fs_hz, NULL, false);
|
DecoderInfo info(codec_type, fs_hz, NULL, false);
|
||||||
ret = decoders_.insert(std::make_pair(rtp_payload_type, info));
|
ret = decoders_.insert(std::make_pair(rtp_payload_type, info));
|
||||||
@ -62,7 +62,7 @@ int DecoderDatabase::InsertExternal(uint8_t rtp_payload_type,
|
|||||||
if (rtp_payload_type > 0x7F) {
|
if (rtp_payload_type > 0x7F) {
|
||||||
return kInvalidRtpPayloadType;
|
return kInvalidRtpPayloadType;
|
||||||
}
|
}
|
||||||
if (!AudioDecoder::CodecSupported(codec_type)) {
|
if (!CodecSupported(codec_type)) {
|
||||||
return kCodecNotSupported;
|
return kCodecNotSupported;
|
||||||
}
|
}
|
||||||
if (fs_hz != 8000 && fs_hz != 16000 && fs_hz != 32000 && fs_hz != 48000) {
|
if (fs_hz != 8000 && fs_hz != 16000 && fs_hz != 32000 && fs_hz != 48000) {
|
||||||
@ -133,7 +133,7 @@ AudioDecoder* DecoderDatabase::GetDecoder(uint8_t rtp_payload_type) {
|
|||||||
DecoderInfo* info = &(*it).second;
|
DecoderInfo* info = &(*it).second;
|
||||||
if (!info->decoder) {
|
if (!info->decoder) {
|
||||||
// Create the decoder object.
|
// Create the decoder object.
|
||||||
AudioDecoder* decoder = AudioDecoder::CreateAudioDecoder(info->codec_type);
|
AudioDecoder* decoder = CreateAudioDecoder(info->codec_type);
|
||||||
assert(decoder); // Should not be able to have an unsupported codec here.
|
assert(decoder); // Should not be able to have an unsupported codec here.
|
||||||
info->decoder = decoder;
|
info->decoder = decoder;
|
||||||
info->decoder->Init();
|
info->decoder->Init();
|
||||||
|
@ -15,15 +15,12 @@
|
|||||||
|
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
#include "webrtc/common_types.h" // NULL
|
#include "webrtc/common_types.h" // NULL
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/packet.h"
|
#include "webrtc/modules/audio_coding/neteq/packet.h"
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
// Forward declaration.
|
|
||||||
class AudioDecoder;
|
|
||||||
|
|
||||||
class DecoderDatabase {
|
class DecoderDatabase {
|
||||||
public:
|
public:
|
||||||
enum DatabaseReturnCodes {
|
enum DatabaseReturnCodes {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
#include "webrtc/common_types.h"
|
#include "webrtc/common_types.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_
|
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_
|
||||||
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_
|
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_AUDIO_DECODER_H_
|
||||||
|
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
|
|
||||||
#include "testing/gmock/include/gmock/gmock.h"
|
#include "testing/gmock/include/gmock/gmock.h"
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_EXTERNAL_DECODER_PCM16B_H_
|
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_EXTERNAL_DECODER_PCM16B_H_
|
||||||
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_EXTERNAL_DECODER_PCM16B_H_
|
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_MOCK_MOCK_EXTERNAL_DECODER_PCM16B_H_
|
||||||
|
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
|
|
||||||
#include "testing/gmock/include/gmock/gmock.h"
|
#include "testing/gmock/include/gmock/gmock.h"
|
||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
'<(DEPTH)/third_party/opus/opus.gyp:opus',
|
'<(DEPTH)/third_party/opus/opus.gyp:opus',
|
||||||
'<(webrtc_root)/common_audio/common_audio.gyp:common_audio',
|
'<(webrtc_root)/common_audio/common_audio.gyp:common_audio',
|
||||||
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
'<(webrtc_root)/system_wrappers/source/system_wrappers.gyp:system_wrappers',
|
||||||
|
'audio_decoder_interface',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
'targets': [
|
'targets': [
|
||||||
@ -57,7 +58,6 @@
|
|||||||
'<(DEPTH)/third_party/opus/opus.gyp:opus',
|
'<(DEPTH)/third_party/opus/opus.gyp:opus',
|
||||||
],
|
],
|
||||||
'sources': [
|
'sources': [
|
||||||
'interface/audio_decoder.h',
|
|
||||||
'interface/neteq.h',
|
'interface/neteq.h',
|
||||||
'accelerate.cc',
|
'accelerate.cc',
|
||||||
'accelerate.h',
|
'accelerate.h',
|
||||||
@ -65,7 +65,6 @@
|
|||||||
'audio_classifier.h',
|
'audio_classifier.h',
|
||||||
'audio_decoder_impl.cc',
|
'audio_decoder_impl.cc',
|
||||||
'audio_decoder_impl.h',
|
'audio_decoder_impl.h',
|
||||||
'audio_decoder.cc',
|
|
||||||
'audio_multi_vector.cc',
|
'audio_multi_vector.cc',
|
||||||
'audio_multi_vector.h',
|
'audio_multi_vector.h',
|
||||||
'audio_vector.cc',
|
'audio_vector.cc',
|
||||||
@ -136,6 +135,7 @@
|
|||||||
'type': '<(gtest_target_type)',
|
'type': '<(gtest_target_type)',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'<@(codecs)',
|
'<@(codecs)',
|
||||||
|
'audio_decoder_interface',
|
||||||
'neteq_unittest_tools',
|
'neteq_unittest_tools',
|
||||||
'<(DEPTH)/testing/gtest.gyp:gtest',
|
'<(DEPTH)/testing/gtest.gyp:gtest',
|
||||||
'<(webrtc_root)/common_audio/common_audio.gyp:common_audio',
|
'<(webrtc_root)/common_audio/common_audio.gyp:common_audio',
|
||||||
@ -154,8 +154,6 @@
|
|||||||
'audio_decoder_impl.cc',
|
'audio_decoder_impl.cc',
|
||||||
'audio_decoder_impl.h',
|
'audio_decoder_impl.h',
|
||||||
'audio_decoder_unittest.cc',
|
'audio_decoder_unittest.cc',
|
||||||
'audio_decoder.cc',
|
|
||||||
'interface/audio_decoder.h',
|
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['OS=="android"', {
|
['OS=="android"', {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/accelerate.h"
|
#include "webrtc/modules/audio_coding/neteq/accelerate.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/background_noise.h"
|
#include "webrtc/modules/audio_coding/neteq/background_noise.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
|
#include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
|
||||||
@ -28,7 +29,6 @@
|
|||||||
#include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h"
|
#include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h"
|
#include "webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/expand.h"
|
#include "webrtc/modules/audio_coding/neteq/expand.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/modules/audio_coding/neteq/merge.h"
|
#include "webrtc/modules/audio_coding/neteq/merge.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/normal.h"
|
#include "webrtc/modules/audio_coding/neteq/normal.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
|
#include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
|
||||||
@ -211,7 +211,7 @@ int NetEqImpl::RegisterExternalDecoder(AudioDecoder* decoder,
|
|||||||
assert(false);
|
assert(false);
|
||||||
return kFail;
|
return kFail;
|
||||||
}
|
}
|
||||||
const int sample_rate_hz = AudioDecoder::CodecSampleRateHz(codec);
|
const int sample_rate_hz = CodecSampleRateHz(codec);
|
||||||
int ret = decoder_database_->InsertExternal(rtp_payload_type, codec,
|
int ret = decoder_database_->InsertExternal(rtp_payload_type, codec,
|
||||||
sample_rate_hz, decoder);
|
sample_rate_hz, decoder);
|
||||||
if (ret != DecoderDatabase::kOK) {
|
if (ret != DecoderDatabase::kOK) {
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
#include <algorithm> // min
|
#include <algorithm> // min
|
||||||
|
|
||||||
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
|
#include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/background_noise.h"
|
#include "webrtc/modules/audio_coding/neteq/background_noise.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/expand.h"
|
#include "webrtc/modules/audio_coding/neteq/expand.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
#include <algorithm> // find_if()
|
#include <algorithm> // find_if()
|
||||||
|
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
#include "webrtc/base/constructormagic.h"
|
#include "webrtc/base/constructormagic.h"
|
||||||
#include "webrtc/common_audio/vad/include/webrtc_vad.h"
|
#include "webrtc/common_audio/vad/include/webrtc_vad.h"
|
||||||
#include "webrtc/common_types.h" // NULL
|
#include "webrtc/common_types.h" // NULL
|
||||||
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/defines.h"
|
#include "webrtc/modules/audio_coding/neteq/defines.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
|
||||||
#include "webrtc/modules/audio_coding/neteq/packet.h"
|
#include "webrtc/modules/audio_coding/neteq/packet.h"
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "webrtc/typedefs.h"
|
#include "webrtc/typedefs.h"
|
||||||
// needed for NetEqDecoder
|
// needed for NetEqDecoder
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
|
#include "webrtc/modules/audio_coding/neteq/audio_decoder_impl.h"
|
||||||
#include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
|
#include "webrtc/modules/audio_coding/neteq/interface/neteq.h"
|
||||||
|
|
||||||
/************************/
|
/************************/
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
{
|
{
|
||||||
'includes': [
|
'includes': [
|
||||||
'../build/common.gypi',
|
'../build/common.gypi',
|
||||||
|
'audio_coding/codecs/interfaces.gypi',
|
||||||
'audio_coding/codecs/cng/cng.gypi',
|
'audio_coding/codecs/cng/cng.gypi',
|
||||||
'audio_coding/codecs/g711/g711.gypi',
|
'audio_coding/codecs/g711/g711.gypi',
|
||||||
'audio_coding/codecs/g722/g722.gypi',
|
'audio_coding/codecs/g722/g722.gypi',
|
||||||
|
Loading…
Reference in New Issue
Block a user