Index: webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc |
diff --git a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc |
index ed496186469e1a7ccc4d48858fc1635528f6680e..905a7152dd40dda0dc523207d34e0072165a4c00 100644 |
--- a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc |
+++ b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc |
@@ -60,7 +60,7 @@ int AudioEncoderPcm::NumChannels() const { |
} |
size_t AudioEncoderPcm::MaxEncodedBytes() const { |
- return full_frame_samples_; |
+ return full_frame_samples_ * BytesPerSample(); |
} |
int AudioEncoderPcm::Num10MsFramesInNextPacket() const { |
@@ -71,6 +71,10 @@ int AudioEncoderPcm::Max10MsFramesInAPacket() const { |
return num_10ms_frames_per_packet_; |
} |
+int AudioEncoderPcm::GetTargetBitrate() const { |
+ return 8 * BytesPerSample() * SampleRateHz() * NumChannels(); |
+} |
+ |
AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal( |
uint32_t rtp_timestamp, |
const int16_t* audio, |
@@ -104,12 +108,20 @@ int16_t AudioEncoderPcmA::EncodeCall(const int16_t* audio, |
return WebRtcG711_EncodeA(audio, static_cast<int16_t>(input_len), encoded); |
} |
+int AudioEncoderPcmA::BytesPerSample() const { |
+ return 1; |
+} |
+ |
int16_t AudioEncoderPcmU::EncodeCall(const int16_t* audio, |
size_t input_len, |
uint8_t* encoded) { |
return WebRtcG711_EncodeU(audio, static_cast<int16_t>(input_len), encoded); |
} |
+int AudioEncoderPcmU::BytesPerSample() const { |
+ return 1; |
+} |
+ |
namespace { |
template <typename T> |
typename T::Config CreateConfig(const CodecInst& codec_inst) { |