Make an AudioEncoder subclass for iLBC
BUG=3926 R=henrik.lundin@webrtc.org, kjellander@google.com TBR=kjellander@webrtc.org Review URL: https://webrtc-codereview.appspot.com/32649005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@7828 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_INTERFACE_AUDIO_ENCODER_ILBC_H_
|
||||
#define WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_INTERFACE_AUDIO_ENCODER_ILBC_H_
|
||||
|
||||
#include "webrtc/modules/audio_coding/codecs/audio_encoder.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h"
|
||||
#include "webrtc/system_wrappers/interface/scoped_ptr.h"
|
||||
|
||||
namespace webrtc {
|
||||
|
||||
class AudioEncoderIlbc : public AudioEncoder {
|
||||
public:
|
||||
struct Config {
|
||||
Config() : payload_type(102), frame_size_ms(30) {}
|
||||
|
||||
int payload_type;
|
||||
int frame_size_ms;
|
||||
};
|
||||
|
||||
explicit AudioEncoderIlbc(const Config& config);
|
||||
virtual ~AudioEncoderIlbc();
|
||||
|
||||
virtual int sample_rate_hz() const OVERRIDE;
|
||||
virtual int num_channels() const OVERRIDE;
|
||||
virtual int Num10MsFramesInNextPacket() const OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual bool EncodeInternal(uint32_t timestamp,
|
||||
const int16_t* audio,
|
||||
size_t max_encoded_bytes,
|
||||
uint8_t* encoded,
|
||||
size_t* encoded_bytes,
|
||||
EncodedInfo* info) OVERRIDE;
|
||||
|
||||
private:
|
||||
static const int kMaxSamplesPerPacket = 240;
|
||||
const int payload_type_;
|
||||
const int num_10ms_frames_per_packet_;
|
||||
int num_10ms_frames_buffered_;
|
||||
uint32_t first_timestamp_in_buffer_;
|
||||
int16_t input_buffer_[kMaxSamplesPerPacket];
|
||||
iLBC_encinst_t* encoder_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
#endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_ILBC_INTERFACE_AUDIO_ENCODER_ILBC_H_
|
||||
@ -138,7 +138,7 @@ extern "C" {
|
||||
int16_t WebRtcIlbcfix_Encode(iLBC_encinst_t *iLBCenc_inst,
|
||||
const int16_t *speechIn,
|
||||
int16_t len,
|
||||
int16_t *encoded);
|
||||
uint8_t* encoded);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_DecoderInit(...)
|
||||
|
||||
Reference in New Issue
Block a user