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:
@ -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) {
|
||||
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. */
|
||||
|
||||
@ -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(
|
||||
|
||||
Reference in New Issue
Block a user