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:
kwiberg@webrtc.org
2014-12-08 17:11:44 +00:00
parent ee43263a50
commit cb858ba397
10 changed files with 171 additions and 29 deletions

View File

@ -23,7 +23,7 @@
#include "webrtc/modules/audio_coding/codecs/g711/include/g711_interface.h"
#include "webrtc/modules/audio_coding/codecs/g711/include/audio_encoder_pcm.h"
#include "webrtc/modules/audio_coding/codecs/g722/include/audio_encoder_g722.h"
#include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h"
#include "webrtc/modules/audio_coding/codecs/ilbc/interface/audio_encoder_ilbc.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h"
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h"
#include "webrtc/modules/audio_coding/codecs/opus/interface/audio_encoder_opus.h"
@ -324,25 +324,10 @@ class AudioDecoderIlbcTest : public AudioDecoderTest {
data_length_ = 10 * frame_size_;
decoder_ = new AudioDecoderIlbc;
assert(decoder_);
WebRtcIlbcfix_EncoderCreate(&encoder_);
}
~AudioDecoderIlbcTest() {
WebRtcIlbcfix_EncoderFree(encoder_);
}
virtual void InitEncoder() {
ASSERT_EQ(0, WebRtcIlbcfix_EncoderInit(encoder_, 30)); // 30 ms.
}
virtual int EncodeFrame(const int16_t* input, size_t input_len_samples,
uint8_t* output) {
int enc_len_bytes =
WebRtcIlbcfix_Encode(encoder_, input,
static_cast<int>(input_len_samples),
reinterpret_cast<int16_t*>(output));
EXPECT_EQ(50, enc_len_bytes);
return enc_len_bytes;
AudioEncoderIlbc::Config config;
config.frame_size_ms = 30;
config.payload_type = payload_type_;
audio_encoder_.reset(new AudioEncoderIlbc(config));
}
// Overload the default test since iLBC's function WebRtcIlbcfix_NetEqPlc does
@ -362,8 +347,6 @@ class AudioDecoderIlbcTest : public AudioDecoderTest {
// Simply call DecodePlc and verify that we get 0 as return value.
EXPECT_EQ(0, decoder_->DecodePlc(1, output.get()));
}
iLBC_encinst_t* encoder_;
};
class AudioDecoderIsacFloatTest : public AudioDecoderTest {

View File

@ -1621,7 +1621,8 @@ int NetEQTest_encode(int coder, int16_t *indata, int frameLen, unsigned char * e
#endif
#ifdef CODEC_ILBC
else if (coder==webrtc::kDecoderILBC) { /*iLBC */
cdlen=WebRtcIlbcfix_Encode(iLBCenc_inst[k], indata,frameLen,(int16_t*)encoded);
cdlen = WebRtcIlbcfix_Encode(iLBCenc_inst[k], indata,
frameLen, encoded);
}
#endif
#if (defined(CODEC_ISAC) || defined(NETEQ_ISACFIX_CODEC)) // TODO(hlundin): remove all NETEQ_ISACFIX_CODEC