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/neteq/neteq_impl.cc b/webrtc/modules/audio_coding/neteq/neteq_impl.cc
index 22e71f7..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.