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
diff --git a/webrtc/modules/audio_coding/codecs/audio_decoder.h b/webrtc/modules/audio_coding/codecs/audio_decoder.h
index 22e44a4..1ac02c5 100644
--- a/webrtc/modules/audio_coding/codecs/audio_decoder.h
+++ b/webrtc/modules/audio_coding/codecs/audio_decoder.h
@@ -31,8 +31,8 @@
// 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 @@
// 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 @@
int16_t* decoded,
SpeechType* speech_type);
- size_t channels_;
-
private:
DISALLOW_COPY_AND_ASSIGN(AudioDecoder);
};
diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
index 6b197bc..077568a 100644
--- a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
+++ b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h
@@ -81,6 +81,7 @@
uint32_t rtp_timestamp,
uint32_t arrival_timestamp) override;
int ErrorCode() override;
+ size_t Channels() const override { return 1; }
protected:
// AudioEncoder protected method.