Initial upload of NetEq4
This is the first public upload of the new NetEq, version 4. It has been through extensive internal review during the course of the project. TEST=trybots Review URL: https://webrtc-codereview.appspot.com/1073005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3425 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
223
webrtc/modules/audio_coding/neteq4/audio_decoder_impl.h
Normal file
223
webrtc/modules/audio_coding/neteq4/audio_decoder_impl.h
Normal file
@ -0,0 +1,223 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ4_AUDIO_DECODER_IMPL_H_
|
||||
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ4_AUDIO_DECODER_IMPL_H_
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef AUDIO_DECODER_UNITTEST
|
||||
// If this is compiled as a part of the audio_deoder_unittest, the codec
|
||||
// selection is made in the gypi file instead of in engine_configurations.h.
|
||||
#include "webrtc/engine_configurations.h"
|
||||
#endif
|
||||
#include "webrtc/modules/audio_coding/neteq4/interface/audio_decoder.h"
|
||||
#include "webrtc/system_wrappers/interface/constructor_magic.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class AudioDecoderPcmU : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderPcmU() : AudioDecoder(kDecoderPCMu) {}
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Init() { return 0; }
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmU);
|
||||
};
|
||||
|
||||
class AudioDecoderPcmA : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderPcmA() : AudioDecoder(kDecoderPCMa) {}
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Init() { return 0; }
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmA);
|
||||
};
|
||||
|
||||
class AudioDecoderPcmUMultiCh : public AudioDecoderPcmU {
|
||||
public:
|
||||
explicit AudioDecoderPcmUMultiCh(size_t channels) : AudioDecoderPcmU() {
|
||||
assert(channels > 0);
|
||||
channels_ = channels;
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmUMultiCh);
|
||||
};
|
||||
|
||||
class AudioDecoderPcmAMultiCh : public AudioDecoderPcmA {
|
||||
public:
|
||||
explicit AudioDecoderPcmAMultiCh(size_t channels) : AudioDecoderPcmA() {
|
||||
assert(channels > 0);
|
||||
channels_ = channels;
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcmAMultiCh);
|
||||
};
|
||||
|
||||
#ifdef WEBRTC_CODEC_PCM16
|
||||
// This class handles all four types (i.e., sample rates) of PCM16B codecs.
|
||||
// The type is specified in the constructor parameter |type|.
|
||||
class AudioDecoderPcm16B : public AudioDecoder {
|
||||
public:
|
||||
explicit AudioDecoderPcm16B(enum NetEqDecoder type);
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Init() { return 0; }
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcm16B);
|
||||
};
|
||||
|
||||
// This class handles all four types (i.e., sample rates) of PCM16B codecs.
|
||||
// The type is specified in the constructor parameter |type|, and the number
|
||||
// of channels is derived from the type.
|
||||
class AudioDecoderPcm16BMultiCh : public AudioDecoderPcm16B {
|
||||
public:
|
||||
explicit AudioDecoderPcm16BMultiCh(enum NetEqDecoder type);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderPcm16BMultiCh);
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
class AudioDecoderIlbc : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderIlbc();
|
||||
virtual ~AudioDecoderIlbc();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual bool HasDecodePlc() const { return true; }
|
||||
virtual int DecodePlc(int num_frames, int16_t* decoded);
|
||||
virtual int Init();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderIlbc);
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef WEBRTC_CODEC_ISAC
|
||||
class AudioDecoderIsac : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderIsac();
|
||||
virtual ~AudioDecoderIsac();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int DecodeRedundant(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual bool HasDecodePlc() const { return true; }
|
||||
virtual int DecodePlc(int num_frames, int16_t* decoded);
|
||||
virtual int Init();
|
||||
virtual int IncomingPacket(const uint8_t* payload,
|
||||
size_t payload_len,
|
||||
uint16_t rtp_sequence_number,
|
||||
uint32_t rtp_timestamp,
|
||||
uint32_t arrival_timestamp);
|
||||
virtual int ErrorCode();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsac);
|
||||
};
|
||||
|
||||
class AudioDecoderIsacSwb : public AudioDecoderIsac {
|
||||
public:
|
||||
AudioDecoderIsacSwb();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacSwb);
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef WEBRTC_CODEC_ISACFX
|
||||
class AudioDecoderIsacFix : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderIsacFix();
|
||||
virtual ~AudioDecoderIsacFix();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Init();
|
||||
virtual int IncomingPacket(const uint8_t* payload,
|
||||
size_t payload_len,
|
||||
uint16_t rtp_sequence_number,
|
||||
uint32_t rtp_timestamp,
|
||||
uint32_t arrival_timestamp);
|
||||
virtual int ErrorCode();
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacFix);
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
class AudioDecoderG722 : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderG722();
|
||||
virtual ~AudioDecoderG722();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual bool HasDecodePlc() const { return false; }
|
||||
virtual int Init();
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722);
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef WEBRTC_CODEC_OPUS
|
||||
class AudioDecoderOpus : public AudioDecoder {
|
||||
public:
|
||||
explicit AudioDecoderOpus(enum NetEqDecoder type);
|
||||
virtual ~AudioDecoderOpus();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type);
|
||||
virtual int Init();
|
||||
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len);
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderOpus);
|
||||
};
|
||||
#endif
|
||||
|
||||
// AudioDecoderCng is a special type of AudioDecoder. It inherits from
|
||||
// AudioDecoder just to fit in the DecoderDatabase. None of the class methods
|
||||
// should be used, except constructor, destructor, and accessors.
|
||||
// TODO(hlundin): Consider the possibility to create a super-class to
|
||||
// AudioDecoder that is stored in DecoderDatabase. Then AudioDecoder and a
|
||||
// specific CngDecoder class could both inherit from that class.
|
||||
class AudioDecoderCng : public AudioDecoder {
|
||||
public:
|
||||
explicit AudioDecoderCng(enum NetEqDecoder type);
|
||||
virtual ~AudioDecoderCng();
|
||||
virtual int Decode(const uint8_t* encoded, size_t encoded_len,
|
||||
int16_t* decoded, SpeechType* speech_type) { return -1; }
|
||||
virtual int Init();
|
||||
virtual int IncomingPacket(const uint8_t* payload,
|
||||
size_t payload_len,
|
||||
uint16_t rtp_sequence_number,
|
||||
uint32_t rtp_timestamp,
|
||||
uint32_t arrival_timestamp) { return -1; }
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoderCng);
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ4_AUDIO_DECODER_IMPL_H_
|
Reference in New Issue
Block a user