summaryrefslogtreecommitdiff
path: root/modules/audio_coding/codecs/audio_encoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'modules/audio_coding/codecs/audio_encoder.h')
-rw-r--r--modules/audio_coding/codecs/audio_encoder.h19
1 files changed, 12 insertions, 7 deletions
diff --git a/modules/audio_coding/codecs/audio_encoder.h b/modules/audio_coding/codecs/audio_encoder.h
index f8142e2b..45c0a855 100644
--- a/modules/audio_coding/codecs/audio_encoder.h
+++ b/modules/audio_coding/codecs/audio_encoder.h
@@ -33,13 +33,13 @@ class AudioEncoder {
// output.
bool Encode(uint32_t timestamp,
const int16_t* audio,
- size_t num_samples,
+ size_t num_samples_per_channel,
size_t max_encoded_bytes,
uint8_t* encoded,
size_t* encoded_bytes,
uint32_t* encoded_timestamp) {
- CHECK_EQ(num_samples,
- static_cast<size_t>(sample_rate_hz() / 100 * num_channels()));
+ CHECK_EQ(num_samples_per_channel,
+ static_cast<size_t>(sample_rate_hz() / 100));
bool ret = Encode(timestamp,
audio,
max_encoded_bytes,
@@ -50,12 +50,17 @@ class AudioEncoder {
return ret;
}
- // Returns the input sample rate in Hz, the number of input channels, and the
- // number of 10 ms frames the encoder puts in one output packet. These are
- // constants set at instantiation time.
+ // Return the input sample rate in Hz and the number of input channels.
+ // These are constants set at instantiation time.
virtual int sample_rate_hz() const = 0;
virtual int num_channels() const = 0;
- virtual int num_10ms_frames_per_packet() const = 0;
+
+ // Returns the number of 10 ms frames the encoder will put in the next
+ // packet. This value may only change when Encode() outputs a packet; i.e.,
+ // the encoder may vary the number of 10 ms frames from packet to packet, but
+ // it must decide the length of the next packet no later than when outputting
+ // the preceding packet.
+ virtual int Num10MsFramesInNextPacket() const = 0;
protected:
virtual bool Encode(uint32_t timestamp,