Make AudioDecoder stateless
The channels_ member varable is removed from the base class, and the associated accessor function is changed to Channels() which is a pure virtual function. R=jmarusic@webrtc.org Review URL: https://webrtc-codereview.appspot.com/43779004 Cr-Commit-Position: refs/heads/master@{#8775} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8775 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -31,8 +31,8 @@ class AudioDecoder {
|
||||
// Used by PacketDuration below. Save the value -1 for errors.
|
||||
enum { kNotImplemented = -2 };
|
||||
|
||||
AudioDecoder() : channels_(1) {}
|
||||
virtual ~AudioDecoder() {}
|
||||
AudioDecoder() = default;
|
||||
virtual ~AudioDecoder() = default;
|
||||
|
||||
// Decodes |encode_len| bytes from |encoded| and writes the result in
|
||||
// |decoded|. The maximum bytes allowed to be written into |decoded| is
|
||||
@ -97,7 +97,7 @@ class AudioDecoder {
|
||||
// isn't a CNG decoder, don't call this method.
|
||||
virtual CNG_dec_inst* CngDecoderInstance();
|
||||
|
||||
size_t channels() const { return channels_; }
|
||||
virtual size_t Channels() const = 0;
|
||||
|
||||
protected:
|
||||
static SpeechType ConvertSpeechType(int16_t type);
|
||||
@ -114,8 +114,6 @@ class AudioDecoder {
|
||||
int16_t* decoded,
|
||||
SpeechType* speech_type);
|
||||
|
||||
size_t channels_;
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
|
||||
};
|
||||
|
@ -81,6 +81,7 @@ class AudioEncoderDecoderIsacT : public AudioEncoder, public AudioDecoder {
|
||||
uint32_t rtp_timestamp,
|
||||
uint32_t arrival_timestamp) override;
|
||||
int ErrorCode() override;
|
||||
size_t Channels() const override { return 1; }
|
||||
|
||||
protected:
|
||||
// AudioEncoder protected method.
|
||||
|
Reference in New Issue
Block a user