Chromium Code Reviews| Index: webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t.h |
| 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 a8498fa224b65420d6797324f064a041dcdc7e7c..0a19194746b19471c449a0742d3f6093629ac2ca 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 |
| @@ -19,6 +19,8 @@ |
| namespace webrtc { |
| +struct CodecInst; |
| + |
| template <typename T> |
| class AudioEncoderIsacT final : public AudioEncoder { |
| public: |
| @@ -31,30 +33,33 @@ class AudioEncoderIsacT final : public AudioEncoder { |
| Config(); |
|
hlundin-webrtc
2015/09/07 20:00:01
Do you still need this one? In audio_encoder_cng.h
kwiberg-webrtc
2015/09/08 10:47:45
No, it seems not. Removing.
|
| bool IsOk() const; |
| - LockedIsacBandwidthInfo* bwinfo; |
| + LockedIsacBandwidthInfo* bwinfo = nullptr; |
| - int payload_type; |
| - int sample_rate_hz; |
| - int frame_size_ms; |
| - int bit_rate; // Limit on the short-term average bit rate, in bits/s. |
| - int max_payload_size_bytes; |
| - int max_bit_rate; |
| + int payload_type = 103; |
| + int sample_rate_hz = 16000; |
| + int frame_size_ms = 30; |
| + int bit_rate = kDefaultBitRate; // Limit on the short-term average bit |
| + // rate, in bits/s. |
| + int max_payload_size_bytes = -1; |
| + int max_bit_rate = -1; |
| // If true, the encoder will dynamically adjust frame size and bit rate; |
| // the configured values are then merely the starting point. |
| - bool adaptive_mode; |
| + bool adaptive_mode = false; |
| // In adaptive mode, prevent adaptive changes to the frame size. (Not used |
| // in nonadaptive mode.) |
| - bool enforce_frame_size; |
| + bool enforce_frame_size = false; |
| }; |
| explicit AudioEncoderIsacT(const Config& config); |
| + explicit AudioEncoderIsacT(const CodecInst& codec_inst, |
| + LockedIsacBandwidthInfo* bwinfo); |
| ~AudioEncoderIsacT() override; |
| + size_t MaxEncodedBytes() const override; |
| int SampleRateHz() const override; |
| int NumChannels() const override; |
| - size_t MaxEncodedBytes() const override; |
| size_t Num10MsFramesInNextPacket() const override; |
| size_t Max10MsFramesInAPacket() const override; |
| int GetTargetBitrate() const override; |
| @@ -62,18 +67,25 @@ class AudioEncoderIsacT final : public AudioEncoder { |
| const int16_t* audio, |
| size_t max_encoded_bytes, |
| uint8_t* encoded) override; |
| + void Reset() override; |
| + void SetMaxPayloadSize(int max_payload_size_bytes) override; |
| + void SetMaxBitrate(int max_rate_bps) override; |
| private: |
| // This value is taken from STREAM_SIZE_MAX_60 for iSAC float (60 ms) and |
| // STREAM_MAXW16_60MS for iSAC fix (60 ms). |
| static const size_t kSufficientEncodeBufferSizeBytes = 400; |
| - const int payload_type_; |
| - typename T::instance_type* isac_state_; |
| - LockedIsacBandwidthInfo* bwinfo_; |
| + static const int kDefaultBitRate = 32000; |
| + |
| + void RecreateEncoderInstance(const Config& config); |
| + |
| + Config config_; |
| + typename T::instance_type* isac_state_ = nullptr; |
| + LockedIsacBandwidthInfo* bwinfo_ = nullptr; |
| // Have we accepted input but not yet emitted it in a packet? |
| - bool packet_in_progress_; |
| + bool packet_in_progress_ = false; |
| // Timestamp of the first input of the currently in-progress packet. |
| uint32_t packet_timestamp_; |
| @@ -81,8 +93,6 @@ class AudioEncoderIsacT final : public AudioEncoder { |
| // Timestamp of the previously encoded packet. |
| uint32_t last_encoded_timestamp_; |
| - const int target_bitrate_bps_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(AudioEncoderIsacT); |
| }; |