| Index: webrtc/modules/audio_coding/codecs/audio_encoder.h
|
| diff --git a/webrtc/modules/audio_coding/codecs/audio_encoder.h b/webrtc/modules/audio_coding/codecs/audio_encoder.h
|
| index 58d9fff4519cdf3f73e08b5143962e5331bed801..3fdee259ce7735567013f052d634e4175661a734 100644
|
| --- a/webrtc/modules/audio_coding/codecs/audio_encoder.h
|
| +++ b/webrtc/modules/audio_coding/codecs/audio_encoder.h
|
| @@ -52,6 +52,14 @@
|
|
|
| virtual ~AudioEncoder() = default;
|
|
|
| + // Returns the maximum number of bytes that can be produced by the encoder
|
| + // at each Encode() call. The caller can use the return value to determine
|
| + // the size of the buffer that needs to be allocated. This value is allowed
|
| + // to depend on encoder parameters like bitrate, frame size etc., so if
|
| + // any of these change, the caller of Encode() is responsible for checking
|
| + // that the buffer is large enough by calling MaxEncodedBytes() again.
|
| + virtual size_t MaxEncodedBytes() const = 0;
|
| +
|
| // Returns the input sample rate in Hz and the number of input channels.
|
| // These are constants set at instantiation time.
|
| virtual int SampleRateHz() const = 0;
|
| @@ -86,6 +94,33 @@
|
| EncodedInfo Encode(uint32_t rtp_timestamp,
|
| rtc::ArrayView<const int16_t> audio,
|
| rtc::Buffer* encoded);
|
| +
|
| + // Deprecated interface to Encode (remove eventually, bug 5591). May incur a
|
| + // copy. The encoder produces zero or more bytes of output in |encoded| and
|
| + // returns additional encoding information. The caller is responsible for
|
| + // making sure that |max_encoded_bytes| is not smaller than the number of
|
| + // bytes actually produced by the encoder.
|
| + RTC_DEPRECATED EncodedInfo Encode(uint32_t rtp_timestamp,
|
| + rtc::ArrayView<const int16_t> audio,
|
| + size_t max_encoded_bytes,
|
| + uint8_t* encoded);
|
| +
|
| + EncodedInfo DEPRECATED_Encode(uint32_t rtp_timestamp,
|
| + rtc::ArrayView<const int16_t> audio,
|
| + size_t max_encoded_bytes,
|
| + uint8_t* encoded);
|
| +
|
| + // Deprecated interface EncodeInternal (see bug 5591). May incur a copy.
|
| + // Subclasses implement this to perform the actual encoding. Called by
|
| + // Encode(). By default, this is implemented as a call to the newer
|
| + // EncodeImpl() that accepts an rtc::Buffer instead of a raw pointer.
|
| + // That version is protected, so see below. At least one of EncodeInternal
|
| + // or EncodeImpl _must_ be implemented by a subclass.
|
| + virtual EncodedInfo EncodeInternal(
|
| + uint32_t rtp_timestamp,
|
| + rtc::ArrayView<const int16_t> audio,
|
| + size_t max_encoded_bytes,
|
| + uint8_t* encoded);
|
|
|
| // Resets the encoder to its starting state, discarding any input that has
|
| // been fed to the encoder but not yet emitted in a packet.
|
| @@ -127,19 +162,13 @@
|
|
|
| protected:
|
| // Subclasses implement this to perform the actual encoding. Called by
|
| - // Encode().
|
| + // Encode(). For compatibility reasons, this is implemented by default as a
|
| + // call to the older interface EncodeInternal(). At least one of
|
| + // EncodeInternal or EncodeImpl _must_ be implemented by a
|
| + // subclass. Preferably this one.
|
| virtual EncodedInfo EncodeImpl(uint32_t rtp_timestamp,
|
| rtc::ArrayView<const int16_t> audio,
|
| - rtc::Buffer* encoded) = 0;
|
| -
|
| - private:
|
| - // This function is deprecated. It was used to return the maximum number of
|
| - // bytes that can be produced by the encoder at each Encode() call. Since the
|
| - // Encode interface was changed to use rtc::Buffer, this is no longer
|
| - // applicable. It is only kept in to avoid breaking subclasses that still have
|
| - // it implemented (with the override attribute). It will be removed as soon
|
| - // as these subclasses have been given a chance to change.
|
| - virtual size_t MaxEncodedBytes() const;
|
| + rtc::Buffer* encoded);
|
| };
|
| } // namespace webrtc
|
| #endif // WEBRTC_MODULES_AUDIO_CODING_CODECS_AUDIO_ENCODER_H_
|
|
|