AudioDecoder: Replace Init() with Reset()
The Init() method was previously used to initialize and reset decoders, and returned an error code. The new Reset() method is used for reset only; the constructor is now responsible for fully initializing the AudioDecoder. Reset() doesn't return an error code; it turned out that none of the functions it ended up calling could actually fail, so this CL removes their error return codes as well. R=henrik.lundin@webrtc.org Review URL: https://codereview.webrtc.org/1319683002 . Cr-Commit-Position: refs/heads/master@{#9798}
This commit is contained in:
@ -64,8 +64,8 @@ class AudioDecoder {
|
||||
// one or several lost packets.
|
||||
virtual size_t DecodePlc(size_t num_frames, int16_t* decoded);
|
||||
|
||||
// Initializes the decoder.
|
||||
virtual int Init() = 0;
|
||||
// Resets the decoder state (empty buffers etc.).
|
||||
virtual void Reset() = 0;
|
||||
|
||||
// Notifies the decoder of an incoming packet to NetEQ.
|
||||
virtual int IncomingPacket(const uint8_t* payload,
|
||||
|
@ -194,7 +194,7 @@ TEST_F(CngTest, CngUpdateSid) {
|
||||
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
|
||||
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
|
||||
kCNGNumParamsNormal));
|
||||
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
|
||||
WebRtcCng_InitDec(cng_dec_inst_);
|
||||
|
||||
// Run normal Encode and UpdateSid.
|
||||
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
|
||||
@ -205,7 +205,7 @@ TEST_F(CngTest, CngUpdateSid) {
|
||||
// Reinit with new length.
|
||||
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
|
||||
kCNGNumParamsHigh));
|
||||
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
|
||||
WebRtcCng_InitDec(cng_dec_inst_);
|
||||
|
||||
// Expect 0 because of unstable parameters after switching length.
|
||||
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 160, sid_data,
|
||||
@ -242,7 +242,7 @@ TEST_F(CngTest, CngUpdateSidErroneous) {
|
||||
EXPECT_EQ(6220, WebRtcCng_GetErrorCodeDec(cng_dec_inst_));
|
||||
|
||||
// Initialize decoder.
|
||||
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
|
||||
WebRtcCng_InitDec(cng_dec_inst_);
|
||||
|
||||
// First run with valid parameters, then with too many CNG parameters.
|
||||
// The function will operate correctly by only reading the maximum number of
|
||||
@ -268,7 +268,7 @@ TEST_F(CngTest, CngGenerate) {
|
||||
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
|
||||
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
|
||||
kCNGNumParamsNormal));
|
||||
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
|
||||
WebRtcCng_InitDec(cng_dec_inst_);
|
||||
|
||||
// Normal Encode.
|
||||
EXPECT_EQ(kCNGNumParamsNormal + 1, WebRtcCng_Encode(
|
||||
@ -301,7 +301,7 @@ TEST_F(CngTest, CngAutoSid) {
|
||||
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
|
||||
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidNormalIntervalUpdate,
|
||||
kCNGNumParamsNormal));
|
||||
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
|
||||
WebRtcCng_InitDec(cng_dec_inst_);
|
||||
|
||||
// Normal Encode, 100 msec, where no SID data should be generated.
|
||||
for (int i = 0; i < 10; i++) {
|
||||
@ -328,7 +328,7 @@ TEST_F(CngTest, CngAutoSidShort) {
|
||||
EXPECT_EQ(0, WebRtcCng_CreateDec(&cng_dec_inst_));
|
||||
EXPECT_EQ(0, WebRtcCng_InitEnc(cng_enc_inst_, 16000, kSidShortIntervalUpdate,
|
||||
kCNGNumParamsNormal));
|
||||
EXPECT_EQ(0, WebRtcCng_InitDec(cng_dec_inst_));
|
||||
WebRtcCng_InitDec(cng_dec_inst_);
|
||||
|
||||
// First call will never generate SID, unless forced to.
|
||||
EXPECT_EQ(0, WebRtcCng_Encode(cng_enc_inst_, speech_data_, 160, sid_data,
|
||||
|
@ -70,7 +70,7 @@ int16_t WebRtcCng_CreateDec(CNG_dec_inst** cng_inst);
|
||||
|
||||
int WebRtcCng_InitEnc(CNG_enc_inst* cng_inst, int fs, int16_t interval,
|
||||
int16_t quality);
|
||||
int16_t WebRtcCng_InitDec(CNG_dec_inst* cng_inst);
|
||||
void WebRtcCng_InitDec(CNG_dec_inst* cng_inst);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcCng_FreeEnc/Dec(...)
|
||||
|
@ -169,7 +169,7 @@ int WebRtcCng_InitEnc(CNG_enc_inst* cng_inst, int fs, int16_t interval,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int16_t WebRtcCng_InitDec(CNG_dec_inst* cng_inst) {
|
||||
void WebRtcCng_InitDec(CNG_dec_inst* cng_inst) {
|
||||
int i;
|
||||
|
||||
WebRtcCngDecoder* inst = (WebRtcCngDecoder*) cng_inst;
|
||||
@ -188,8 +188,6 @@ int16_t WebRtcCng_InitDec(CNG_dec_inst* cng_inst) {
|
||||
inst->dec_used_reflCoefs[0] = 0;
|
||||
inst->dec_used_energy = 0;
|
||||
inst->initflag = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -157,11 +157,7 @@ static void block4(G722DecoderState *s, int band, int d)
|
||||
G722DecoderState* WebRtc_g722_decode_init(G722DecoderState* s,
|
||||
int rate,
|
||||
int options) {
|
||||
if (s == NULL)
|
||||
{
|
||||
if ((s = (G722DecoderState *) malloc(sizeof(*s))) == NULL)
|
||||
return NULL;
|
||||
}
|
||||
s = s ? s : malloc(sizeof(*s));
|
||||
memset(s, 0, sizeof(*s));
|
||||
if (rate == 48000)
|
||||
s->bits_per_sample = 6;
|
||||
|
@ -66,17 +66,10 @@ int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst)
|
||||
}
|
||||
}
|
||||
|
||||
int16_t WebRtcG722_DecoderInit(G722DecInst *G722dec_inst)
|
||||
{
|
||||
void WebRtcG722_DecoderInit(G722DecInst* inst) {
|
||||
// Create and/or reset the G.722 decoder
|
||||
// Bitrate 64 kbps and wideband mode (2)
|
||||
G722dec_inst = (G722DecInst *) WebRtc_g722_decode_init(
|
||||
(G722DecoderState*) G722dec_inst, 64000, 2);
|
||||
if (G722dec_inst == NULL) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
WebRtc_g722_decode_init((G722DecoderState*)inst, 64000, 2);
|
||||
}
|
||||
|
||||
int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst)
|
||||
|
@ -113,22 +113,16 @@ size_t WebRtcG722_Encode(G722EncInst* G722enc_inst,
|
||||
*/
|
||||
int16_t WebRtcG722_CreateDecoder(G722DecInst **G722dec_inst);
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcG722_DecoderInit(...)
|
||||
*
|
||||
* This function initializes a G729 instance
|
||||
* This function initializes a G722 instance
|
||||
*
|
||||
* Input:
|
||||
* - G729_decinst_t : G729 instance, i.e. the user that should receive
|
||||
* be initialized
|
||||
*
|
||||
* Return value : 0 - Ok
|
||||
* -1 - Error
|
||||
* - inst : G722 instance
|
||||
*/
|
||||
|
||||
int16_t WebRtcG722_DecoderInit(G722DecInst *G722dec_inst);
|
||||
|
||||
void WebRtcG722_DecoderInit(G722DecInst* inst);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcG722_FreeDecoder(...)
|
||||
|
@ -131,13 +131,11 @@ int16_t WebRtcIlbcfix_DecoderInit(IlbcDecoderInstance* iLBCdec_inst,
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
int16_t WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance *iLBCdec_inst) {
|
||||
void WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance* iLBCdec_inst) {
|
||||
WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 20, 1);
|
||||
return(0);
|
||||
}
|
||||
int16_t WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance *iLBCdec_inst) {
|
||||
void WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance* iLBCdec_inst) {
|
||||
WebRtcIlbcfix_InitDecode((IlbcDecoder*) iLBCdec_inst, 30, 1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -159,8 +159,8 @@ extern "C" {
|
||||
|
||||
int16_t WebRtcIlbcfix_DecoderInit(IlbcDecoderInstance *iLBCdec_inst,
|
||||
int16_t frameLen);
|
||||
int16_t WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance *iLBCdec_inst);
|
||||
int16_t WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance *iLBCdec_inst);
|
||||
void WebRtcIlbcfix_DecoderInit20Ms(IlbcDecoderInstance* iLBCdec_inst);
|
||||
void WebRtcIlbcfix_Decoderinit30Ms(IlbcDecoderInstance* iLBCdec_inst);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIlbcfix_Decode(...)
|
||||
|
@ -95,7 +95,7 @@ class AudioDecoderIsacT final : public AudioDecoder {
|
||||
|
||||
bool HasDecodePlc() const override;
|
||||
size_t DecodePlc(size_t num_frames, int16_t* decoded) override;
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
int IncomingPacket(const uint8_t* payload,
|
||||
size_t payload_len,
|
||||
uint16_t rtp_sequence_number,
|
||||
|
@ -185,7 +185,7 @@ template <typename T>
|
||||
AudioDecoderIsacT<T>::AudioDecoderIsacT(LockedIsacBandwidthInfo* bwinfo)
|
||||
: bwinfo_(bwinfo), decoder_sample_rate_hz_(-1) {
|
||||
CHECK_EQ(0, T::Create(&isac_state_));
|
||||
CHECK_EQ(0, T::DecoderInit(isac_state_));
|
||||
T::DecoderInit(isac_state_);
|
||||
if (bwinfo_) {
|
||||
IsacBandwidthInfo bwinfo;
|
||||
T::GetBandwidthInfo(isac_state_, &bwinfo);
|
||||
@ -232,8 +232,8 @@ size_t AudioDecoderIsacT<T>::DecodePlc(size_t num_frames, int16_t* decoded) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int AudioDecoderIsacT<T>::Init() {
|
||||
return T::DecoderInit(isac_state_);
|
||||
void AudioDecoderIsacT<T>::Reset() {
|
||||
T::DecoderInit(isac_state_);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -50,8 +50,8 @@ struct IsacFix {
|
||||
size_t num_lost_frames) {
|
||||
return WebRtcIsacfix_DecodePlc(inst, decoded, num_lost_frames);
|
||||
}
|
||||
static inline int16_t DecoderInit(instance_type* inst) {
|
||||
return WebRtcIsacfix_DecoderInit(inst);
|
||||
static inline void DecoderInit(instance_type* inst) {
|
||||
WebRtcIsacfix_DecoderInit(inst);
|
||||
}
|
||||
static inline int Encode(instance_type* inst,
|
||||
const int16_t* speech_in,
|
||||
|
@ -174,14 +174,9 @@ extern "C" {
|
||||
*
|
||||
* Input:
|
||||
* - ISAC_main_inst : ISAC instance.
|
||||
*
|
||||
* Return value
|
||||
* : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst);
|
||||
|
||||
void WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct* ISAC_main_inst);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcIsacfix_UpdateBwEstimate1(...)
|
||||
|
@ -568,13 +568,9 @@ int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
|
||||
*
|
||||
* Input:
|
||||
* - ISAC_main_inst : ISAC instance.
|
||||
*
|
||||
* Return value
|
||||
* : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst)
|
||||
void WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst)
|
||||
{
|
||||
ISACFIX_SubStruct *ISAC_inst;
|
||||
|
||||
@ -597,8 +593,6 @@ int16_t WebRtcIsacfix_DecoderInit(ISACFIX_MainStruct *ISAC_main_inst)
|
||||
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
|
||||
WebRtcIsacfix_InitPreFilterbank(&ISAC_inst->ISACdec_obj.decimatorstr_obj);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,7 +48,7 @@ void IsacSpeedTest::SetUp() {
|
||||
// Create encoder memory.
|
||||
EXPECT_EQ(0, WebRtcIsacfix_Create(&ISACFIX_main_inst_));
|
||||
EXPECT_EQ(0, WebRtcIsacfix_EncoderInit(ISACFIX_main_inst_, 1));
|
||||
EXPECT_EQ(0, WebRtcIsacfix_DecoderInit(ISACFIX_main_inst_));
|
||||
WebRtcIsacfix_DecoderInit(ISACFIX_main_inst_);
|
||||
// Set bitrate and block length.
|
||||
EXPECT_EQ(0, WebRtcIsacfix_Control(ISACFIX_main_inst_, bit_rate_,
|
||||
block_duration_ms_));
|
||||
|
@ -539,12 +539,7 @@ int main(int argc, char* argv[])
|
||||
printf("\n\n Error in encoderinit: %d.\n\n", errtype);
|
||||
}
|
||||
|
||||
err = WebRtcIsacfix_DecoderInit(ISAC_main_inst);
|
||||
/* Error check */
|
||||
if (err < 0) {
|
||||
errtype=WebRtcIsacfix_GetErrorCode(ISAC_main_inst);
|
||||
printf("\n\n Error in decoderinit: %d.\n\n", errtype);
|
||||
}
|
||||
WebRtcIsacfix_DecoderInit(ISAC_main_inst);
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,8 +50,8 @@ struct IsacFloat {
|
||||
return WebRtcIsac_DecodePlc(inst, decoded, num_lost_frames);
|
||||
}
|
||||
|
||||
static inline int16_t DecoderInit(instance_type* inst) {
|
||||
return WebRtcIsac_DecoderInit(inst);
|
||||
static inline void DecoderInit(instance_type* inst) {
|
||||
WebRtcIsac_DecoderInit(inst);
|
||||
}
|
||||
static inline int Encode(instance_type* inst,
|
||||
const int16_t* speech_in,
|
||||
|
@ -157,15 +157,9 @@ extern "C" {
|
||||
*
|
||||
* Input:
|
||||
* - ISAC_main_inst : ISAC instance.
|
||||
*
|
||||
* Return value
|
||||
* : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
|
||||
int16_t WebRtcIsac_DecoderInit(
|
||||
ISACStruct* ISAC_main_inst);
|
||||
|
||||
void WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst);
|
||||
|
||||
/******************************************************************************
|
||||
* WebRtcIsac_UpdateBwEstimate(...)
|
||||
|
@ -924,12 +924,8 @@ int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
|
||||
*
|
||||
* Input:
|
||||
* - ISAC_main_inst : ISAC instance.
|
||||
*
|
||||
* Return value
|
||||
* : 0 - Ok
|
||||
* -1 - Error
|
||||
*/
|
||||
static int16_t DecoderInitLb(ISACLBStruct* instISAC) {
|
||||
static void DecoderInitLb(ISACLBStruct* instISAC) {
|
||||
int i;
|
||||
/* Initialize stream vector to zero. */
|
||||
for (i = 0; i < STREAM_SIZE_MAX_60; i++) {
|
||||
@ -940,10 +936,9 @@ static int16_t DecoderInitLb(ISACLBStruct* instISAC) {
|
||||
WebRtcIsac_InitPostFilterbank(
|
||||
&instISAC->ISACdecLB_obj.postfiltbankstr_obj);
|
||||
WebRtcIsac_InitPitchFilter(&instISAC->ISACdecLB_obj.pitchfiltstr_obj);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int16_t DecoderInitUb(ISACUBStruct* instISAC) {
|
||||
static void DecoderInitUb(ISACUBStruct* instISAC) {
|
||||
int i;
|
||||
/* Init stream vector to zero */
|
||||
for (i = 0; i < STREAM_SIZE_MAX_60; i++) {
|
||||
@ -953,24 +948,18 @@ static int16_t DecoderInitUb(ISACUBStruct* instISAC) {
|
||||
WebRtcIsac_InitMasking(&instISAC->ISACdecUB_obj.maskfiltstr_obj);
|
||||
WebRtcIsac_InitPostFilterbank(
|
||||
&instISAC->ISACdecUB_obj.postfiltbankstr_obj);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int16_t WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst) {
|
||||
void WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst) {
|
||||
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
|
||||
|
||||
if (DecoderInitLb(&instISAC->instLB) < 0) {
|
||||
return -1;
|
||||
}
|
||||
DecoderInitLb(&instISAC->instLB);
|
||||
if (instISAC->decoderSamplingRateKHz == kIsacSuperWideband) {
|
||||
memset(instISAC->synthesisFBState1, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
memset(instISAC->synthesisFBState2, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
|
||||
if (DecoderInitUb(&(instISAC->instUB)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
DecoderInitUb(&(instISAC->instUB));
|
||||
}
|
||||
if ((instISAC->initFlag & BIT_MASK_ENC_INIT) != BIT_MASK_ENC_INIT) {
|
||||
WebRtcIsac_InitBandwidthEstimator(&instISAC->bwestimator_obj,
|
||||
@ -979,7 +968,6 @@ int16_t WebRtcIsac_DecoderInit(ISACStruct* ISAC_main_inst) {
|
||||
}
|
||||
instISAC->initFlag |= BIT_MASK_DEC_INIT;
|
||||
instISAC->resetFlag_8kHz = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -2353,9 +2341,7 @@ int16_t WebRtcIsac_SetDecSampRate(ISACStruct* ISAC_main_inst,
|
||||
memset(instISAC->synthesisFBState2, 0,
|
||||
FB_STATE_SIZE_WORD32 * sizeof(int32_t));
|
||||
|
||||
if (DecoderInitUb(&(instISAC->instUB)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
DecoderInitUb(&instISAC->instUB);
|
||||
}
|
||||
instISAC->decoderSamplingRateKHz = decoder_operational_rate;
|
||||
return 0;
|
||||
|
@ -499,13 +499,8 @@ int main(int argc, char* argv[]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (testNum != 2) {
|
||||
if (WebRtcIsac_DecoderInit(ISAC_main_inst) < 0) {
|
||||
printf("Error could not initialize the decoder \n");
|
||||
cout << flush;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (testNum != 2)
|
||||
WebRtcIsac_DecoderInit(ISAC_main_inst);
|
||||
if (CodingMode == 1) {
|
||||
err = WebRtcIsac_Control(ISAC_main_inst, bottleneck, framesize);
|
||||
if (err < 0) {
|
||||
@ -570,13 +565,7 @@ int main(int argc, char* argv[]) {
|
||||
cout << flush;
|
||||
}
|
||||
|
||||
err = WebRtcIsac_DecoderInit(ISAC_main_inst);
|
||||
/* Error check */
|
||||
if (err < 0) {
|
||||
errtype = WebRtcIsac_GetErrorCode(ISAC_main_inst);
|
||||
printf("\n\n Error in decoderinit: %d.\n\n", errtype);
|
||||
cout << flush;
|
||||
}
|
||||
WebRtcIsac_DecoderInit(ISAC_main_inst);
|
||||
}
|
||||
|
||||
cur_framesmpls = 0;
|
||||
|
@ -166,13 +166,7 @@ int main(int argc, char* argv[])
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Initialize Decoder
|
||||
if(WebRtcIsac_DecoderInit(codecInstance[clientCntr]) < 0)
|
||||
{
|
||||
printf("Could not initialize decoder of client %d\n",
|
||||
clientCntr + 1);
|
||||
return -1;
|
||||
}
|
||||
WebRtcIsac_DecoderInit(codecInstance[clientCntr]);
|
||||
|
||||
// setup Rate if in Instantaneous mode
|
||||
if(codingMode != 0)
|
||||
|
@ -253,10 +253,7 @@ int main(int argc, char* argv[]) {
|
||||
printf("cannot initialize encoder\n");
|
||||
return -1;
|
||||
}
|
||||
if (WebRtcIsac_DecoderInit(ISAC_main_inst) < 0) {
|
||||
printf("cannot initialize decoder\n");
|
||||
return -1;
|
||||
}
|
||||
WebRtcIsac_DecoderInit(ISAC_main_inst);
|
||||
|
||||
// {
|
||||
// int32_t b1, b2;
|
||||
|
@ -111,7 +111,7 @@ void TestGetSetBandwidthInfo(const int16_t* speech_data,
|
||||
typename T::instance_type* encdec;
|
||||
ASSERT_EQ(0, T::Create(&encdec));
|
||||
ASSERT_EQ(0, T::EncoderInit(encdec, adaptive ? 0 : 1));
|
||||
ASSERT_EQ(0, T::DecoderInit(encdec));
|
||||
T::DecoderInit(encdec);
|
||||
ASSERT_EQ(0, T::SetEncSampRate(encdec, sample_rate_hz));
|
||||
if (adaptive)
|
||||
ASSERT_EQ(0, T::ControlBwe(encdec, bit_rate, frame_size_ms, false));
|
||||
@ -129,7 +129,7 @@ void TestGetSetBandwidthInfo(const int16_t* speech_data,
|
||||
ASSERT_EQ(0, T::Control(enc, bit_rate, frame_size_ms));
|
||||
typename T::instance_type* dec;
|
||||
ASSERT_EQ(0, T::Create(&dec));
|
||||
ASSERT_EQ(0, T::DecoderInit(dec));
|
||||
T::DecoderInit(dec);
|
||||
T::SetInitialBweBottleneck(dec, bit_rate);
|
||||
T::SetEncSampRateInDecoder(dec, sample_rate_hz);
|
||||
|
||||
|
@ -212,11 +212,8 @@ int WebRtcOpus_DecoderChannels(OpusDecInst* inst);
|
||||
*
|
||||
* Input:
|
||||
* - inst : Decoder context
|
||||
*
|
||||
* Return value : 0 - Success
|
||||
* -1 - Error
|
||||
*/
|
||||
int16_t WebRtcOpus_DecoderInit(OpusDecInst* inst);
|
||||
void WebRtcOpus_DecoderInit(OpusDecInst* inst);
|
||||
|
||||
/****************************************************************************
|
||||
* WebRtcOpus_Decode(...)
|
||||
|
@ -250,13 +250,9 @@ int WebRtcOpus_DecoderChannels(OpusDecInst* inst) {
|
||||
return inst->channels;
|
||||
}
|
||||
|
||||
int16_t WebRtcOpus_DecoderInit(OpusDecInst* inst) {
|
||||
int error = opus_decoder_ctl(inst->decoder, OPUS_RESET_STATE);
|
||||
if (error == OPUS_OK) {
|
||||
void WebRtcOpus_DecoderInit(OpusDecInst* inst) {
|
||||
opus_decoder_ctl(inst->decoder, OPUS_RESET_STATE);
|
||||
inst->in_dtx_mode = 0;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* For decoder to determine if it is to output speech or comfort noise. */
|
||||
|
@ -376,7 +376,7 @@ TEST_P(OpusTest, OpusDecodeInit) {
|
||||
kOpus20msFrameSamples, opus_decoder_, output_data_decode,
|
||||
&audio_type)));
|
||||
|
||||
EXPECT_EQ(0, WebRtcOpus_DecoderInit(opus_decoder_));
|
||||
WebRtcOpus_DecoderInit(opus_decoder_);
|
||||
|
||||
EXPECT_EQ(kOpus20msFrameSamples,
|
||||
static_cast<size_t>(WebRtcOpus_Decode(
|
||||
|
@ -988,9 +988,6 @@ TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_48kHzOutputExternalDecoder) {
|
||||
MockAudioDecoder mock_decoder;
|
||||
// Set expectations on the mock decoder and also delegate the calls to the
|
||||
// real decoder.
|
||||
EXPECT_CALL(mock_decoder, Init())
|
||||
.Times(AtLeast(1))
|
||||
.WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::Init));
|
||||
EXPECT_CALL(mock_decoder, IncomingPacket(_, _, _, _, _))
|
||||
.Times(AtLeast(1))
|
||||
.WillRepeatedly(Invoke(&decoder, &AudioDecoderPcmU::IncomingPacket));
|
||||
|
@ -84,8 +84,8 @@ void OpusTest::Perform() {
|
||||
// Create Opus decoders for mono and stereo for stand-alone testing of Opus.
|
||||
ASSERT_GT(WebRtcOpus_DecoderCreate(&opus_mono_decoder_, 1), -1);
|
||||
ASSERT_GT(WebRtcOpus_DecoderCreate(&opus_stereo_decoder_, 2), -1);
|
||||
ASSERT_GT(WebRtcOpus_DecoderInit(opus_mono_decoder_), -1);
|
||||
ASSERT_GT(WebRtcOpus_DecoderInit(opus_stereo_decoder_), -1);
|
||||
WebRtcOpus_DecoderInit(opus_mono_decoder_);
|
||||
WebRtcOpus_DecoderInit(opus_stereo_decoder_);
|
||||
|
||||
ASSERT_TRUE(acm_receiver_.get() != NULL);
|
||||
EXPECT_EQ(0, acm_receiver_->InitializeReceiver());
|
||||
|
@ -39,8 +39,7 @@ namespace webrtc {
|
||||
|
||||
// PCMu
|
||||
|
||||
int AudioDecoderPcmU::Init() {
|
||||
return 0;
|
||||
void AudioDecoderPcmU::Reset() {
|
||||
}
|
||||
size_t AudioDecoderPcmU::Channels() const {
|
||||
return 1;
|
||||
@ -70,8 +69,7 @@ size_t AudioDecoderPcmUMultiCh::Channels() const {
|
||||
|
||||
// PCMa
|
||||
|
||||
int AudioDecoderPcmA::Init() {
|
||||
return 0;
|
||||
void AudioDecoderPcmA::Reset() {
|
||||
}
|
||||
size_t AudioDecoderPcmA::Channels() const {
|
||||
return 1;
|
||||
@ -103,8 +101,7 @@ size_t AudioDecoderPcmAMultiCh::Channels() const {
|
||||
#ifdef WEBRTC_CODEC_PCM16
|
||||
AudioDecoderPcm16B::AudioDecoderPcm16B() {}
|
||||
|
||||
int AudioDecoderPcm16B::Init() {
|
||||
return 0;
|
||||
void AudioDecoderPcm16B::Reset() {
|
||||
}
|
||||
size_t AudioDecoderPcm16B::Channels() const {
|
||||
return 1;
|
||||
@ -143,6 +140,7 @@ size_t AudioDecoderPcm16BMultiCh::Channels() const {
|
||||
#ifdef WEBRTC_CODEC_ILBC
|
||||
AudioDecoderIlbc::AudioDecoderIlbc() {
|
||||
WebRtcIlbcfix_DecoderCreate(&dec_state_);
|
||||
WebRtcIlbcfix_Decoderinit30Ms(dec_state_);
|
||||
}
|
||||
|
||||
AudioDecoderIlbc::~AudioDecoderIlbc() {
|
||||
@ -170,8 +168,8 @@ size_t AudioDecoderIlbc::DecodePlc(size_t num_frames, int16_t* decoded) {
|
||||
return WebRtcIlbcfix_NetEqPlc(dec_state_, decoded, num_frames);
|
||||
}
|
||||
|
||||
int AudioDecoderIlbc::Init() {
|
||||
return WebRtcIlbcfix_Decoderinit30Ms(dec_state_);
|
||||
void AudioDecoderIlbc::Reset() {
|
||||
WebRtcIlbcfix_Decoderinit30Ms(dec_state_);
|
||||
}
|
||||
|
||||
size_t AudioDecoderIlbc::Channels() const {
|
||||
@ -183,6 +181,7 @@ size_t AudioDecoderIlbc::Channels() const {
|
||||
#ifdef WEBRTC_CODEC_G722
|
||||
AudioDecoderG722::AudioDecoderG722() {
|
||||
WebRtcG722_CreateDecoder(&dec_state_);
|
||||
WebRtcG722_DecoderInit(dec_state_);
|
||||
}
|
||||
|
||||
AudioDecoderG722::~AudioDecoderG722() {
|
||||
@ -206,8 +205,8 @@ int AudioDecoderG722::DecodeInternal(const uint8_t* encoded,
|
||||
return static_cast<int>(ret);
|
||||
}
|
||||
|
||||
int AudioDecoderG722::Init() {
|
||||
return WebRtcG722_DecoderInit(dec_state_);
|
||||
void AudioDecoderG722::Reset() {
|
||||
WebRtcG722_DecoderInit(dec_state_);
|
||||
}
|
||||
|
||||
int AudioDecoderG722::PacketDuration(const uint8_t* encoded,
|
||||
@ -223,6 +222,8 @@ size_t AudioDecoderG722::Channels() const {
|
||||
AudioDecoderG722Stereo::AudioDecoderG722Stereo() {
|
||||
WebRtcG722_CreateDecoder(&dec_state_left_);
|
||||
WebRtcG722_CreateDecoder(&dec_state_right_);
|
||||
WebRtcG722_DecoderInit(dec_state_left_);
|
||||
WebRtcG722_DecoderInit(dec_state_right_);
|
||||
}
|
||||
|
||||
AudioDecoderG722Stereo::~AudioDecoderG722Stereo() {
|
||||
@ -265,11 +266,9 @@ size_t AudioDecoderG722Stereo::Channels() const {
|
||||
return 2;
|
||||
}
|
||||
|
||||
int AudioDecoderG722Stereo::Init() {
|
||||
int r = WebRtcG722_DecoderInit(dec_state_left_);
|
||||
if (r != 0)
|
||||
return r;
|
||||
return WebRtcG722_DecoderInit(dec_state_right_);
|
||||
void AudioDecoderG722Stereo::Reset() {
|
||||
WebRtcG722_DecoderInit(dec_state_left_);
|
||||
WebRtcG722_DecoderInit(dec_state_right_);
|
||||
}
|
||||
|
||||
// Split the stereo packet and place left and right channel after each other
|
||||
@ -306,6 +305,7 @@ AudioDecoderOpus::AudioDecoderOpus(size_t num_channels)
|
||||
: channels_(num_channels) {
|
||||
DCHECK(num_channels == 1 || num_channels == 2);
|
||||
WebRtcOpus_DecoderCreate(&dec_state_, static_cast<int>(channels_));
|
||||
WebRtcOpus_DecoderInit(dec_state_);
|
||||
}
|
||||
|
||||
AudioDecoderOpus::~AudioDecoderOpus() {
|
||||
@ -348,8 +348,8 @@ int AudioDecoderOpus::DecodeRedundantInternal(const uint8_t* encoded,
|
||||
return ret;
|
||||
}
|
||||
|
||||
int AudioDecoderOpus::Init() {
|
||||
return WebRtcOpus_DecoderInit(dec_state_);
|
||||
void AudioDecoderOpus::Reset() {
|
||||
WebRtcOpus_DecoderInit(dec_state_);
|
||||
}
|
||||
|
||||
int AudioDecoderOpus::PacketDuration(const uint8_t* encoded,
|
||||
@ -381,14 +381,15 @@ size_t AudioDecoderOpus::Channels() const {
|
||||
|
||||
AudioDecoderCng::AudioDecoderCng() {
|
||||
CHECK_EQ(0, WebRtcCng_CreateDec(&dec_state_));
|
||||
WebRtcCng_InitDec(dec_state_);
|
||||
}
|
||||
|
||||
AudioDecoderCng::~AudioDecoderCng() {
|
||||
WebRtcCng_FreeDec(dec_state_);
|
||||
}
|
||||
|
||||
int AudioDecoderCng::Init() {
|
||||
return WebRtcCng_InitDec(dec_state_);
|
||||
void AudioDecoderCng::Reset() {
|
||||
WebRtcCng_InitDec(dec_state_);
|
||||
}
|
||||
|
||||
int AudioDecoderCng::IncomingPacket(const uint8_t* payload,
|
||||
|
@ -37,7 +37,7 @@ namespace webrtc {
|
||||
class AudioDecoderPcmU : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderPcmU() {}
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
|
||||
size_t Channels() const override;
|
||||
|
||||
@ -55,7 +55,7 @@ class AudioDecoderPcmU : public AudioDecoder {
|
||||
class AudioDecoderPcmA : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderPcmA() {}
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
|
||||
size_t Channels() const override;
|
||||
|
||||
@ -102,7 +102,7 @@ class AudioDecoderPcmAMultiCh : public AudioDecoderPcmA {
|
||||
class AudioDecoderPcm16B : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderPcm16B();
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
|
||||
size_t Channels() const override;
|
||||
|
||||
@ -138,7 +138,7 @@ class AudioDecoderIlbc : public AudioDecoder {
|
||||
~AudioDecoderIlbc() override;
|
||||
bool HasDecodePlc() const override;
|
||||
size_t DecodePlc(size_t num_frames, int16_t* decoded) override;
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
size_t Channels() const override;
|
||||
|
||||
protected:
|
||||
@ -160,7 +160,7 @@ class AudioDecoderG722 : public AudioDecoder {
|
||||
AudioDecoderG722();
|
||||
~AudioDecoderG722() override;
|
||||
bool HasDecodePlc() const override;
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
|
||||
size_t Channels() const override;
|
||||
|
||||
@ -180,7 +180,7 @@ class AudioDecoderG722Stereo : public AudioDecoder {
|
||||
public:
|
||||
AudioDecoderG722Stereo();
|
||||
~AudioDecoderG722Stereo() override;
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
|
||||
protected:
|
||||
int DecodeInternal(const uint8_t* encoded,
|
||||
@ -212,7 +212,7 @@ class AudioDecoderOpus : public AudioDecoder {
|
||||
explicit AudioDecoderOpus(size_t num_channels);
|
||||
~AudioDecoderOpus() override;
|
||||
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
int PacketDuration(const uint8_t* encoded, size_t encoded_len) const override;
|
||||
int PacketDurationRedundant(const uint8_t* encoded,
|
||||
size_t encoded_len) const override;
|
||||
@ -248,7 +248,7 @@ class AudioDecoderCng : public AudioDecoder {
|
||||
public:
|
||||
explicit AudioDecoderCng();
|
||||
~AudioDecoderCng() override;
|
||||
int Init() override;
|
||||
void Reset() override;
|
||||
int IncomingPacket(const uint8_t* payload,
|
||||
size_t payload_len,
|
||||
uint16_t rtp_sequence_number,
|
||||
|
@ -171,7 +171,6 @@ class AudioDecoderTest : public ::testing::Test {
|
||||
size_t processed_samples = 0u;
|
||||
encoded_bytes_ = 0u;
|
||||
InitEncoder();
|
||||
EXPECT_EQ(0, decoder_->Init());
|
||||
std::vector<int16_t> input;
|
||||
std::vector<int16_t> decoded;
|
||||
while (processed_samples + frame_size_ <= data_length_) {
|
||||
@ -220,7 +219,7 @@ class AudioDecoderTest : public ::testing::Test {
|
||||
size_t enc_len = EncodeFrame(input.get(), frame_size_, encoded_);
|
||||
size_t dec_len;
|
||||
AudioDecoder::SpeechType speech_type1, speech_type2;
|
||||
EXPECT_EQ(0, decoder_->Init());
|
||||
decoder_->Reset();
|
||||
rtc::scoped_ptr<int16_t[]> output1(new int16_t[frame_size_ * channels_]);
|
||||
dec_len = decoder_->Decode(encoded_, enc_len, codec_input_rate_hz_,
|
||||
frame_size_ * channels_ * sizeof(int16_t),
|
||||
@ -228,7 +227,7 @@ class AudioDecoderTest : public ::testing::Test {
|
||||
ASSERT_LE(dec_len, frame_size_ * channels_);
|
||||
EXPECT_EQ(frame_size_ * channels_, dec_len);
|
||||
// Re-init decoder and decode again.
|
||||
EXPECT_EQ(0, decoder_->Init());
|
||||
decoder_->Reset();
|
||||
rtc::scoped_ptr<int16_t[]> output2(new int16_t[frame_size_ * channels_]);
|
||||
dec_len = decoder_->Decode(encoded_, enc_len, codec_input_rate_hz_,
|
||||
frame_size_ * channels_ * sizeof(int16_t),
|
||||
@ -249,7 +248,7 @@ class AudioDecoderTest : public ::testing::Test {
|
||||
input_audio_.Read(frame_size_, codec_input_rate_hz_, input.get()));
|
||||
size_t enc_len = EncodeFrame(input.get(), frame_size_, encoded_);
|
||||
AudioDecoder::SpeechType speech_type;
|
||||
EXPECT_EQ(0, decoder_->Init());
|
||||
decoder_->Reset();
|
||||
rtc::scoped_ptr<int16_t[]> output(new int16_t[frame_size_ * channels_]);
|
||||
size_t dec_len = decoder_->Decode(encoded_, enc_len, codec_input_rate_hz_,
|
||||
frame_size_ * channels_ * sizeof(int16_t),
|
||||
@ -341,7 +340,7 @@ class AudioDecoderIlbcTest : public AudioDecoderTest {
|
||||
input_audio_.Read(frame_size_, codec_input_rate_hz_, input.get()));
|
||||
size_t enc_len = EncodeFrame(input.get(), frame_size_, encoded_);
|
||||
AudioDecoder::SpeechType speech_type;
|
||||
EXPECT_EQ(0, decoder_->Init());
|
||||
decoder_->Reset();
|
||||
rtc::scoped_ptr<int16_t[]> output(new int16_t[frame_size_ * channels_]);
|
||||
size_t dec_len = decoder_->Decode(encoded_, enc_len, codec_input_rate_hz_,
|
||||
frame_size_ * channels_ * sizeof(int16_t),
|
||||
|
@ -72,7 +72,6 @@ int DecoderDatabase::InsertExternal(uint8_t rtp_payload_type,
|
||||
if (!decoder) {
|
||||
return kInvalidPointer;
|
||||
}
|
||||
decoder->Init();
|
||||
std::pair<DecoderMap::iterator, bool> ret;
|
||||
DecoderInfo info(codec_type, fs_hz, decoder, true);
|
||||
ret = decoders_.insert(std::make_pair(rtp_payload_type, info));
|
||||
@ -136,7 +135,6 @@ AudioDecoder* DecoderDatabase::GetDecoder(uint8_t rtp_payload_type) {
|
||||
AudioDecoder* decoder = CreateAudioDecoder(info->codec_type);
|
||||
assert(decoder); // Should not be able to have an unsupported codec here.
|
||||
info->decoder = decoder;
|
||||
info->decoder->Init();
|
||||
}
|
||||
return info->decoder;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class MockAudioDecoder : public AudioDecoder {
|
||||
int(const uint8_t*, size_t, int, size_t, int16_t*, SpeechType*));
|
||||
MOCK_CONST_METHOD0(HasDecodePlc, bool());
|
||||
MOCK_METHOD2(DecodePlc, size_t(size_t, int16_t*));
|
||||
MOCK_METHOD0(Init, int());
|
||||
MOCK_METHOD0(Reset, void());
|
||||
MOCK_METHOD5(IncomingPacket, int(const uint8_t*, size_t, uint16_t, uint32_t,
|
||||
uint32_t));
|
||||
MOCK_METHOD0(ErrorCode, int());
|
||||
|
@ -28,7 +28,7 @@ using ::testing::Invoke;
|
||||
class ExternalPcm16B : public AudioDecoder {
|
||||
public:
|
||||
ExternalPcm16B() {}
|
||||
virtual int Init() { return 0; }
|
||||
void Reset() override {}
|
||||
|
||||
protected:
|
||||
int DecodeInternal(const uint8_t* encoded,
|
||||
@ -58,8 +58,8 @@ class MockExternalPcm16B : public ExternalPcm16B {
|
||||
.WillByDefault(Invoke(&real_, &ExternalPcm16B::HasDecodePlc));
|
||||
ON_CALL(*this, DecodePlc(_, _))
|
||||
.WillByDefault(Invoke(&real_, &ExternalPcm16B::DecodePlc));
|
||||
ON_CALL(*this, Init())
|
||||
.WillByDefault(Invoke(&real_, &ExternalPcm16B::Init));
|
||||
ON_CALL(*this, Reset())
|
||||
.WillByDefault(Invoke(&real_, &ExternalPcm16B::Reset));
|
||||
ON_CALL(*this, IncomingPacket(_, _, _, _, _))
|
||||
.WillByDefault(Invoke(&real_, &ExternalPcm16B::IncomingPacket));
|
||||
ON_CALL(*this, ErrorCode())
|
||||
@ -79,8 +79,7 @@ class MockExternalPcm16B : public ExternalPcm16B {
|
||||
bool());
|
||||
MOCK_METHOD2(DecodePlc,
|
||||
size_t(size_t num_frames, int16_t* decoded));
|
||||
MOCK_METHOD0(Init,
|
||||
int());
|
||||
MOCK_METHOD0(Reset, void());
|
||||
MOCK_METHOD5(IncomingPacket,
|
||||
int(const uint8_t* payload, size_t payload_len,
|
||||
uint16_t rtp_sequence_number, uint32_t rtp_timestamp,
|
||||
|
@ -40,8 +40,6 @@ class NetEqExternalDecoderUnitTest : public test::NetEqExternalDecoderTest {
|
||||
payload_size_bytes_(0),
|
||||
last_send_time_(0),
|
||||
last_arrival_time_(0) {
|
||||
// Init() will trigger external_decoder_->Init().
|
||||
EXPECT_CALL(*external_decoder_, Init());
|
||||
// NetEq is not allowed to delete the external decoder (hence Times(0)).
|
||||
EXPECT_CALL(*external_decoder_, Die()).Times(0);
|
||||
Init();
|
||||
|
@ -1178,15 +1178,14 @@ int NetEqImpl::Decode(PacketList* packet_list, Operations* operation,
|
||||
|
||||
if (reset_decoder_) {
|
||||
// TODO(hlundin): Write test for this.
|
||||
// Reset decoder.
|
||||
if (decoder) {
|
||||
decoder->Init();
|
||||
}
|
||||
if (decoder)
|
||||
decoder->Reset();
|
||||
|
||||
// Reset comfort noise decoder.
|
||||
AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder();
|
||||
if (cng_decoder) {
|
||||
cng_decoder->Init();
|
||||
}
|
||||
if (cng_decoder)
|
||||
cng_decoder->Reset();
|
||||
|
||||
reset_decoder_ = false;
|
||||
}
|
||||
|
||||
@ -1896,11 +1895,9 @@ void NetEqImpl::SetSampleRateAndChannels(int fs_hz, size_t channels) {
|
||||
mute_factor_array_[i] = 16384; // 1.0 in Q14.
|
||||
}
|
||||
|
||||
// Reset comfort noise decoder, if there is one active.
|
||||
AudioDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder();
|
||||
if (cng_decoder) {
|
||||
cng_decoder->Init();
|
||||
}
|
||||
if (cng_decoder)
|
||||
cng_decoder->Reset();
|
||||
|
||||
// Reinit post-decode VAD with new sample rate.
|
||||
assert(vad_.get()); // Cannot be NULL here.
|
||||
|
@ -444,10 +444,7 @@ TEST_F(NetEqImplTest, VerifyTimestampPropagation) {
|
||||
return encoded_len;
|
||||
}
|
||||
|
||||
virtual int Init() {
|
||||
next_value_ = 1;
|
||||
return 0;
|
||||
}
|
||||
void Reset() override { next_value_ = 1; }
|
||||
|
||||
size_t Channels() const override { return 1; }
|
||||
|
||||
@ -524,7 +521,7 @@ TEST_F(NetEqImplTest, ReorderedPacket) {
|
||||
|
||||
// Create a mock decoder object.
|
||||
MockAudioDecoder mock_decoder;
|
||||
EXPECT_CALL(mock_decoder, Init()).WillRepeatedly(Return(0));
|
||||
EXPECT_CALL(mock_decoder, Reset()).WillRepeatedly(Return());
|
||||
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
|
||||
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
|
||||
.WillRepeatedly(Return(0));
|
||||
@ -690,7 +687,7 @@ TEST_F(NetEqImplTest, CodecInternalCng) {
|
||||
|
||||
// Create a mock decoder object.
|
||||
MockAudioDecoder mock_decoder;
|
||||
EXPECT_CALL(mock_decoder, Init()).WillRepeatedly(Return(0));
|
||||
EXPECT_CALL(mock_decoder, Reset()).WillRepeatedly(Return());
|
||||
EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1));
|
||||
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
|
||||
.WillRepeatedly(Return(0));
|
||||
@ -829,9 +826,7 @@ TEST_F(NetEqImplTest, UnsupportedDecoder) {
|
||||
|
||||
class MockAudioDecoder : public AudioDecoder {
|
||||
public:
|
||||
int Init() override {
|
||||
return 0;
|
||||
}
|
||||
void Reset() override {}
|
||||
MOCK_CONST_METHOD2(PacketDuration, int(const uint8_t*, size_t));
|
||||
MOCK_METHOD5(DecodeInternal, int(const uint8_t*, size_t, int, int16_t*,
|
||||
SpeechType*));
|
||||
|
@ -33,7 +33,7 @@ class MockAudioDecoderOpus : public AudioDecoderOpus {
|
||||
virtual ~MockAudioDecoderOpus() { Die(); }
|
||||
MOCK_METHOD0(Die, void());
|
||||
|
||||
MOCK_METHOD0(Init, int());
|
||||
MOCK_METHOD0(Reset, void());
|
||||
|
||||
int PacketDuration(const uint8_t* encoded,
|
||||
size_t encoded_len) const override {
|
||||
@ -271,7 +271,6 @@ struct NetEqNetworkStatsCheck {
|
||||
|
||||
TEST(NetEqNetworkStatsTest, OpusDecodeFec) {
|
||||
MockAudioDecoderOpus decoder(1);
|
||||
EXPECT_CALL(decoder, Init());
|
||||
NetEqNetworkStatsTest test(kDecoderOpus, &decoder);
|
||||
test.DecodeFecTest();
|
||||
EXPECT_CALL(decoder, Die()).Times(1);
|
||||
@ -279,7 +278,6 @@ TEST(NetEqNetworkStatsTest, OpusDecodeFec) {
|
||||
|
||||
TEST(NetEqNetworkStatsTest, StereoOpusDecodeFec) {
|
||||
MockAudioDecoderOpus decoder(2);
|
||||
EXPECT_CALL(decoder, Init());
|
||||
NetEqNetworkStatsTest test(kDecoderOpus, &decoder);
|
||||
test.DecodeFecTest();
|
||||
EXPECT_CALL(decoder, Die()).Times(1);
|
||||
@ -287,7 +285,6 @@ TEST(NetEqNetworkStatsTest, StereoOpusDecodeFec) {
|
||||
|
||||
TEST(NetEqNetworkStatsTest, NoiseExpansionTest) {
|
||||
MockAudioDecoderOpus decoder(1);
|
||||
EXPECT_CALL(decoder, Init());
|
||||
NetEqNetworkStatsTest test(kDecoderOpus, &decoder);
|
||||
test.NoiseExpansionTest();
|
||||
EXPECT_CALL(decoder, Die()).Times(1);
|
||||
|
Reference in New Issue
Block a user