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:
@ -13,9 +13,7 @@
|
||||
|
||||
#include <stdlib.h> // NULL
|
||||
|
||||
#include "webrtc/base/checks.h"
|
||||
#include "webrtc/base/constructormagic.h"
|
||||
#include "webrtc/modules/audio_coding/codecs/cng/include/webrtc_cng.h"
|
||||
#include "webrtc/typedefs.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -65,7 +63,7 @@ class AudioDecoder {
|
||||
// Used by PacketDuration below. Save the value -1 for errors.
|
||||
enum { kNotImplemented = -2 };
|
||||
|
||||
AudioDecoder() : channels_(1) {}
|
||||
AudioDecoder() : channels_(1), state_(NULL) {}
|
||||
virtual ~AudioDecoder() {}
|
||||
|
||||
// Decodes |encode_len| bytes from |encoded| and writes the result in
|
||||
@ -116,12 +114,8 @@ class AudioDecoder {
|
||||
// Returns true if the packet has FEC and false otherwise.
|
||||
virtual bool PacketHasFec(const uint8_t* encoded, size_t encoded_len) const;
|
||||
|
||||
// If this is a CNG decoder, return the underlying CNG_dec_inst*. If this
|
||||
// isn't a CNG decoder, don't call this method.
|
||||
virtual CNG_dec_inst* CngDecoderInstance() {
|
||||
FATAL() << "Not a CNG decoder";
|
||||
return NULL;
|
||||
}
|
||||
// Returns the underlying decoder state.
|
||||
void* state() { return state_; }
|
||||
|
||||
// Returns true if |codec_type| is supported.
|
||||
static bool CodecSupported(NetEqDecoder codec_type);
|
||||
@ -140,6 +134,7 @@ class AudioDecoder {
|
||||
static SpeechType ConvertSpeechType(int16_t type);
|
||||
|
||||
size_t channels_;
|
||||
void* state_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
|
||||
|
||||
Reference in New Issue
Block a user