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}
diff --git a/webrtc/modules/audio_coding/codecs/audio_decoder.h b/webrtc/modules/audio_coding/codecs/audio_decoder.h
index 480b1aa..5e9e33d 100644
--- a/webrtc/modules/audio_coding/codecs/audio_decoder.h
+++ b/webrtc/modules/audio_coding/codecs/audio_decoder.h
@@ -64,8 +64,8 @@
// 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,
diff --git a/webrtc/modules/audio_coding/codecs/cng/cng_unittest.cc b/webrtc/modules/audio_coding/codecs/cng/cng_unittest.cc
index 2409540..1061dca 100644
--- a/webrtc/modules/audio_coding/codecs/cng/cng_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/cng/cng_unittest.cc
@@ -194,7 +194,7 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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,
diff --git a/webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h b/webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h
index 6c7e50b..fe87fc9 100644
--- a/webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h
+++ b/webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h
@@ -70,7 +70,7 @@
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(...)
diff --git a/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c b/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c
index a0c166a..8dddc5c 100644
--- a/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c
+++ b/webrtc/modules/audio_coding/codecs/cng/webrtc_cng.c
@@ -169,7 +169,7 @@
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 @@
inst->dec_used_reflCoefs[0] = 0;
inst->dec_used_energy = 0;
inst->initflag = 1;
-
- return 0;
}
/****************************************************************************
diff --git a/webrtc/modules/audio_coding/codecs/g722/g722_decode.c b/webrtc/modules/audio_coding/codecs/g722/g722_decode.c
index 8fdeec1..952a7d0 100644
--- a/webrtc/modules/audio_coding/codecs/g722/g722_decode.c
+++ b/webrtc/modules/audio_coding/codecs/g722/g722_decode.c
@@ -157,11 +157,7 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/g722/g722_interface.c b/webrtc/modules/audio_coding/codecs/g722/g722_interface.c
index f6b9842..4244d5c 100644
--- a/webrtc/modules/audio_coding/codecs/g722/g722_interface.c
+++ b/webrtc/modules/audio_coding/codecs/g722/g722_interface.c
@@ -66,17 +66,10 @@
}
}
-int16_t WebRtcG722_DecoderInit(G722DecInst *G722dec_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;
- }
+void WebRtcG722_DecoderInit(G722DecInst* inst) {
+ // Create and/or reset the G.722 decoder
+ // Bitrate 64 kbps and wideband mode (2)
+ WebRtc_g722_decode_init((G722DecoderState*)inst, 64000, 2);
}
int WebRtcG722_FreeDecoder(G722DecInst *G722dec_inst)
diff --git a/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h b/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h
index fa4a48c..e3133d6 100644
--- a/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h
+++ b/webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h
@@ -113,22 +113,16 @@
*/
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(...)
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/ilbc.c b/webrtc/modules/audio_coding/codecs/ilbc/ilbc.c
index c565a24..6cd9a72 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/ilbc.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/ilbc.c
@@ -131,13 +131,11 @@
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);
}
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h b/webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h
index be0b121..ba31f18 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h
+++ b/webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h
@@ -159,8 +159,8 @@
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(...)
diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
index a2c43a6..a8498fa 100644
--- a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
+++ b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
@@ -95,7 +95,7 @@
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,
diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
index 93fbde9..98f3ed9 100644
--- a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
+++ b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h
@@ -185,7 +185,7 @@
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 @@
}
template <typename T>
-int AudioDecoderIsacT<T>::Init() {
- return T::DecoderInit(isac_state_);
+void AudioDecoderIsacT<T>::Reset() {
+ T::DecoderInit(isac_state_);
}
template <typename T>
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h b/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h
index 6c61915..0fd05da 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h
@@ -50,8 +50,8 @@
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,
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h b/webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h
index eec4a39..013ab7f 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h
@@ -174,14 +174,9 @@
*
* 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(...)
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c
index 4a663d1..21911dd 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c
@@ -568,13 +568,9 @@
*
* 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 @@
#ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED
WebRtcIsacfix_InitPreFilterbank(&ISAC_inst->ISACdec_obj.decimatorstr_obj);
#endif
-
- return 0;
}
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc b/webrtc/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc
index fc7588d..adee337 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc
@@ -48,7 +48,7 @@
// 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_));
diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc b/webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc
index 6a947c8..d0f508f 100644
--- a/webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc
@@ -539,12 +539,7 @@
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);
}
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h b/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h
index 1bfd149..58abbdf 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h
+++ b/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h
@@ -50,8 +50,8 @@
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,
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h b/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h
index 0597de8..1f5aeb3 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h
+++ b/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h
@@ -157,15 +157,9 @@
*
* 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(...)
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c
index 190277e..0a5f75a 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c
+++ b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c
@@ -924,12 +924,8 @@
*
* 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 @@
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 @@
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 @@
}
instISAC->initFlag |= BIT_MASK_DEC_INIT;
instISAC->resetFlag_8kHz = 0;
- return 0;
}
@@ -2353,9 +2341,7 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc b/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc
index d385ff4..2e5badd 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc
@@ -499,13 +499,8 @@
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 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc b/webrtc/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc
index 08061ac..a53e7bd 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc
@@ -166,13 +166,7 @@
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)
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c b/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c
index 2f44ca8..e8116ff 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c
+++ b/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c
@@ -253,10 +253,7 @@
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;
diff --git a/webrtc/modules/audio_coding/codecs/isac/unittest.cc b/webrtc/modules/audio_coding/codecs/isac/unittest.cc
index d05ffa6..673d290 100644
--- a/webrtc/modules/audio_coding/codecs/isac/unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/isac/unittest.cc
@@ -111,7 +111,7 @@
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 @@
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);
diff --git a/webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h b/webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h
index 007f5c5..ded8b6f 100644
--- a/webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h
+++ b/webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h
@@ -212,11 +212,8 @@
*
* Input:
* - inst : Decoder context
- *
- * Return value : 0 - Success
- * -1 - Error
*/
-int16_t WebRtcOpus_DecoderInit(OpusDecInst* inst);
+void WebRtcOpus_DecoderInit(OpusDecInst* inst);
/****************************************************************************
* WebRtcOpus_Decode(...)
diff --git a/webrtc/modules/audio_coding/codecs/opus/opus_interface.c b/webrtc/modules/audio_coding/codecs/opus/opus_interface.c
index e2a8383..4f6e22f 100644
--- a/webrtc/modules/audio_coding/codecs/opus/opus_interface.c
+++ b/webrtc/modules/audio_coding/codecs/opus/opus_interface.c
@@ -250,13 +250,9 @@
return inst->channels;
}
-int16_t WebRtcOpus_DecoderInit(OpusDecInst* inst) {
- int error = opus_decoder_ctl(inst->decoder, OPUS_RESET_STATE);
- if (error == OPUS_OK) {
- inst->in_dtx_mode = 0;
- return 0;
- }
- return -1;
+void WebRtcOpus_DecoderInit(OpusDecInst* inst) {
+ opus_decoder_ctl(inst->decoder, OPUS_RESET_STATE);
+ inst->in_dtx_mode = 0;
}
/* For decoder to determine if it is to output speech or comfort noise. */
diff --git a/webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc b/webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc
index 2208f74..d2fd009 100644
--- a/webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc
+++ b/webrtc/modules/audio_coding/codecs/opus/opus_unittest.cc
@@ -376,7 +376,7 @@
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(
diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
index 74f65a9..4b53a52 100644
--- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
+++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc
@@ -988,9 +988,6 @@
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));
diff --git a/webrtc/modules/audio_coding/main/test/opus_test.cc b/webrtc/modules/audio_coding/main/test/opus_test.cc
index 79124aa..d6482dd 100644
--- a/webrtc/modules/audio_coding/main/test/opus_test.cc
+++ b/webrtc/modules/audio_coding/main/test/opus_test.cc
@@ -84,8 +84,8 @@
// 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());
diff --git a/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
index 769f0b0..592f17b 100644
--- a/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
@@ -39,8 +39,7 @@
// PCMu
-int AudioDecoderPcmU::Init() {
- return 0;
+void AudioDecoderPcmU::Reset() {
}
size_t AudioDecoderPcmU::Channels() const {
return 1;
@@ -70,8 +69,7 @@
// PCMa
-int AudioDecoderPcmA::Init() {
- return 0;
+void AudioDecoderPcmA::Reset() {
}
size_t AudioDecoderPcmA::Channels() const {
return 1;
@@ -103,8 +101,7 @@
#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 @@
#ifdef WEBRTC_CODEC_ILBC
AudioDecoderIlbc::AudioDecoderIlbc() {
WebRtcIlbcfix_DecoderCreate(&dec_state_);
+ WebRtcIlbcfix_Decoderinit30Ms(dec_state_);
}
AudioDecoderIlbc::~AudioDecoderIlbc() {
@@ -170,8 +168,8 @@
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 @@
#ifdef WEBRTC_CODEC_G722
AudioDecoderG722::AudioDecoderG722() {
WebRtcG722_CreateDecoder(&dec_state_);
+ WebRtcG722_DecoderInit(dec_state_);
}
AudioDecoderG722::~AudioDecoderG722() {
@@ -206,8 +205,8 @@
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 @@
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 @@
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 @@
: 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 @@
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 @@
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,
diff --git a/webrtc/modules/audio_coding/neteq/audio_decoder_impl.h b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.h
index 427a0a6..f2ca711 100644
--- a/webrtc/modules/audio_coding/neteq/audio_decoder_impl.h
+++ b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.h
@@ -37,7 +37,7 @@
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 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 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 @@
~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 @@
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 @@
public:
AudioDecoderG722Stereo();
~AudioDecoderG722Stereo() override;
- int Init() override;
+ void Reset() override;
protected:
int DecodeInternal(const uint8_t* encoded,
@@ -212,7 +212,7 @@
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 @@
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,
diff --git a/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc b/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc
index a2ef9d1..392e3dc 100644
--- a/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc
@@ -171,7 +171,6 @@
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 @@
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 @@
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 @@
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 @@
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),
diff --git a/webrtc/modules/audio_coding/neteq/decoder_database.cc b/webrtc/modules/audio_coding/neteq/decoder_database.cc
index 18eee06..97dc00d 100644
--- a/webrtc/modules/audio_coding/neteq/decoder_database.cc
+++ b/webrtc/modules/audio_coding/neteq/decoder_database.cc
@@ -72,7 +72,6 @@
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* 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;
}
diff --git a/webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h b/webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h
index d26e2a1..90f132b 100644
--- a/webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h
+++ b/webrtc/modules/audio_coding/neteq/mock/mock_audio_decoder.h
@@ -27,7 +27,7 @@
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());
diff --git a/webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h b/webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h
index f239b4a..fca1c2d 100644
--- a/webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h
+++ b/webrtc/modules/audio_coding/neteq/mock/mock_external_decoder_pcm16b.h
@@ -28,7 +28,7 @@
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 @@
.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 @@
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,
diff --git a/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
index 3c945f9..2a11616 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_external_decoder_unittest.cc
@@ -40,8 +40,6 @@
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();
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 22e71f7f..cf7afbc 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
@@ -1178,15 +1178,14 @@
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 @@
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.
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc
index 006a5ad..ee04a6f 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl_unittest.cc
@@ -444,10 +444,7 @@
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 @@
// 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 @@
// 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 @@
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*));
diff --git a/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc b/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
index e1a0f69..139106b 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq_network_stats_unittest.cc
@@ -33,7 +33,7 @@
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 @@
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, 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, NoiseExpansionTest) {
MockAudioDecoderOpus decoder(1);
- EXPECT_CALL(decoder, Init());
NetEqNetworkStatsTest test(kDecoderOpus, &decoder);
test.NoiseExpansionTest();
EXPECT_CALL(decoder, Die()).Times(1);