2013-01-29 12:09:21 +00:00
|
|
|
/*
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
|
|
|
|
|
2014-06-09 08:10:28 +00:00
|
|
|
#ifndef WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
|
|
|
|
|
#define WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
|
2013-01-29 12:09:21 +00:00
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
|
|
#include "webrtc/engine_configurations.h"
|
2014-05-21 21:18:46 +00:00
|
|
|
#include "webrtc/base/constructormagic.h"
|
2014-12-09 10:12:53 +00:00
|
|
|
#include "webrtc/modules/audio_coding/codecs/audio_decoder.h"
|
2014-11-06 07:54:31 +00:00
|
|
|
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
|
|
|
|
#ifdef WEBRTC_CODEC_G722
|
|
|
|
|
#include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h"
|
|
|
|
|
#endif
|
2015-10-29 06:20:28 -07:00
|
|
|
#include "webrtc/modules/audio_coding/main/acm2/rent_a_codec.h"
|
2013-01-29 12:09:21 +00:00
|
|
|
#include "webrtc/typedefs.h"
|
|
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
|
|
|
|
|
// 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:
|
2014-11-04 11:51:46 +00:00
|
|
|
explicit AudioDecoderCng();
|
2015-04-07 16:12:57 +02:00
|
|
|
~AudioDecoderCng() override;
|
2015-08-27 15:22:11 +02:00
|
|
|
void Reset() override;
|
2015-04-07 16:12:57 +02:00
|
|
|
int IncomingPacket(const uint8_t* payload,
|
|
|
|
|
size_t payload_len,
|
|
|
|
|
uint16_t rtp_sequence_number,
|
|
|
|
|
uint32_t rtp_timestamp,
|
|
|
|
|
uint32_t arrival_timestamp) override;
|
2013-01-29 12:09:21 +00:00
|
|
|
|
2015-04-07 16:12:57 +02:00
|
|
|
CNG_dec_inst* CngDecoderInstance() override;
|
|
|
|
|
size_t Channels() const override;
|
2014-11-06 07:54:31 +00:00
|
|
|
|
2015-03-16 12:30:37 +00:00
|
|
|
protected:
|
|
|
|
|
int DecodeInternal(const uint8_t* encoded,
|
|
|
|
|
size_t encoded_len,
|
|
|
|
|
int sample_rate_hz,
|
|
|
|
|
int16_t* decoded,
|
2015-04-07 16:12:57 +02:00
|
|
|
SpeechType* speech_type) override;
|
2015-03-16 12:30:37 +00:00
|
|
|
|
2013-01-29 12:09:21 +00:00
|
|
|
private:
|
2014-11-06 07:54:31 +00:00
|
|
|
CNG_dec_inst* dec_state_;
|
2015-09-16 05:37:44 -07:00
|
|
|
RTC_DISALLOW_COPY_AND_ASSIGN(AudioDecoderCng);
|
2013-01-29 12:09:21 +00:00
|
|
|
};
|
|
|
|
|
|
2015-10-29 06:20:28 -07:00
|
|
|
using NetEqDecoder = acm2::RentACodec::NetEqDecoder;
|
2014-12-09 10:12:53 +00:00
|
|
|
|
|
|
|
|
// 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);
|
|
|
|
|
|
2013-01-29 12:09:21 +00:00
|
|
|
} // namespace webrtc
|
2014-06-09 08:10:28 +00:00
|
|
|
#endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_AUDIO_DECODER_IMPL_H_
|