Revert 7623 "Remove the state_ member from AudioDecoder"

Breaks Chrome compile:
e:\b\build\slave\win_builder\build\src\third_party\webrtc\modules\audio_coding\neteq\neteq_impl.cc(131) : error C3867: 'webrtc::NetEqImpl::InsertPacketInternal': function call missing argument list; use '&webrtc::NetEqImpl::InsertPacketInternal' to create a pointer to member
e:\b\build\slave\win_builder\build\src\third_party\webrtc\modules\audio_coding\neteq\neteq_impl.cc(131) : error C3861: 'LOG_FERR1': identifier not found
e:\b\build\slave\win_builder\build\src\third_party\webrtc\modules\audio_coding\neteq\neteq_impl.cc(152) : error C3867: 'webrtc::NetEqImpl::InsertPacketInternal': function call missing argument list; use '&webrtc::NetEqImpl::InsertPacketInternal' to create a pointer to member
e:\b\build\slave\win_builder\build\src\third_party\webrtc\modules\audio_coding\neteq\neteq_impl.cc(152) : error C3861: 'LOG_FERR1': identifier not found
e:\b\build\slave\win_builder\build\src\third_party\webrtc\modules\audio_coding\neteq\neteq_impl.cc(169) : error C3867: 'webrtc::NetEqImpl::GetAudioInternal': function call missing argument list; use '&webrtc::NetEqImpl::GetAudioInternal' to create a pointer to member
...

> Remove the state_ member from AudioDecoder
> 
> The subclasses that need a state pointer should declare them---with
> the right type, not void*, to get rid of all those casts.
> 
> Two small but not quite trivial cleanups are included because they
> blocked the state_ removal:
> 
>   - AudioDecoderG722Stereo now inherits directly from AudioDecoder
>     instead of being a subclass of AudioDecoderG722.
> 
>   - AudioDecoder now has a CngDecoderInstance member function, which
>     is implemented only by AudioDecoderCng. This replaces the previous
>     practice of calling AudioDecoder::state() and casting the result
>     to a CNG_dec_inst*. It still isn't pretty, but now the blemish is
>     plainly visible in the AudioDecoder class declaration.
> 
> R=henrik.lundin@webrtc.org
> 
> Review URL: https://webrtc-codereview.appspot.com/24169005

TBR=kwiberg@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/30879005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@7629 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
niklas.enbom@webrtc.org
2014-11-05 00:45:58 +00:00
parent 8a232f65dd
commit 368215dacb
6 changed files with 68 additions and 84 deletions

View File

@ -19,22 +19,6 @@
#include "webrtc/engine_configurations.h"
#endif
#include "webrtc/base/constructormagic.h"
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
#ifdef WEBRTC_CODEC_G722
#include "webrtc/modules/audio_coding/codecs/g722/include/g722_interface.h"
#endif
#ifdef WEBRTC_CODEC_ILBC
#include "webrtc/modules/audio_coding/codecs/ilbc/interface/ilbc.h"
#endif
#ifdef WEBRTC_CODEC_ISACFX
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h"
#endif
#ifdef WEBRTC_CODEC_ISAC
#include "webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h"
#endif
#ifdef WEBRTC_CODEC_OPUS
#include "webrtc/modules/audio_coding/codecs/opus/interface/opus_interface.h"
#endif
#include "webrtc/modules/audio_coding/neteq/interface/audio_decoder.h"
#include "webrtc/typedefs.h"
@ -125,7 +109,6 @@ class AudioDecoderIlbc : public AudioDecoder {
virtual int Init();
private:
iLBC_decinst_t* dec_state_;
DISALLOW_COPY_AND_ASSIGN(AudioDecoderIlbc);
};
#endif
@ -150,7 +133,6 @@ class AudioDecoderIsac : public AudioDecoder {
virtual int ErrorCode();
private:
ISACStruct* isac_state_;
DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsac);
};
#endif
@ -171,7 +153,6 @@ class AudioDecoderIsacFix : public AudioDecoder {
virtual int ErrorCode();
private:
ISACFIX_MainStruct* isac_state_;
DISALLOW_COPY_AND_ASSIGN(AudioDecoderIsacFix);
};
#endif
@ -188,11 +169,10 @@ class AudioDecoderG722 : public AudioDecoder {
virtual int PacketDuration(const uint8_t* encoded, size_t encoded_len);
private:
G722DecInst* dec_state_;
DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722);
};
class AudioDecoderG722Stereo : public AudioDecoder {
class AudioDecoderG722Stereo : public AudioDecoderG722 {
public:
AudioDecoderG722Stereo();
virtual ~AudioDecoderG722Stereo();
@ -209,8 +189,8 @@ class AudioDecoderG722Stereo : public AudioDecoder {
void SplitStereoPacket(const uint8_t* encoded, size_t encoded_len,
uint8_t* encoded_deinterleaved);
G722DecInst* dec_state_left_;
G722DecInst* dec_state_right_;
void* const state_left_;
void* state_right_;
DISALLOW_COPY_AND_ASSIGN(AudioDecoderG722Stereo);
};
@ -249,7 +229,6 @@ class AudioDecoderOpus : public AudioDecoder {
virtual bool PacketHasFec(const uint8_t* encoded, size_t encoded_len) const;
private:
OpusDecInst* dec_state_;
DISALLOW_COPY_AND_ASSIGN(AudioDecoderOpus);
};
#endif
@ -273,10 +252,7 @@ class AudioDecoderCng : public AudioDecoder {
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) { return -1; }
virtual CNG_dec_inst* CngDecoderInstance() OVERRIDE { return dec_state_; }
private:
CNG_dec_inst* dec_state_;
DISALLOW_COPY_AND_ASSIGN(AudioDecoderCng);
};