Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Unified Diff: webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc

Issue 1319683002: AudioDecoder: Replace Init() with Reset() (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@buffer
Patch Set: review fixes Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
diff --git a/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc b/webrtc/modules/audio_coding/neteq/audio_decoder_impl.cc
index 769f0b0fa8f82c5df9476ae3e254c1c282eba382..592f17b097d5b343b0edddc72f142c18e45dd4e6 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 @@ 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,
« no previous file with comments | « webrtc/modules/audio_coding/neteq/audio_decoder_impl.h ('k') | webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698