Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Unified Diff: webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc

Issue 1725143003: Changed AudioEncoder::Encode to take an rtc::Buffer* instead of uint8_t* and a maximum size. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added more fixes for override hiding in AudioEncoder implementations. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ff61db8e8d00c07cda36c31a440aac6e833d7eb8..d850675244baf5060defd24d1b5e3f39c0780afe 100644
--- a/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
+++ b/webrtc/modules/audio_coding/codecs/g711/audio_encoder_pcm.cc
@@ -80,8 +80,7 @@ int AudioEncoderPcm::GetTargetBitrate() const {
AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal(
uint32_t rtp_timestamp,
rtc::ArrayView<const int16_t> audio,
- size_t max_encoded_bytes,
- uint8_t* encoded) {
+ rtc::Buffer* encoded) {
if (speech_buffer_.empty()) {
first_timestamp_in_buffer_ = rtp_timestamp;
}
@@ -90,12 +89,16 @@ AudioEncoder::EncodedInfo AudioEncoderPcm::EncodeInternal(
return EncodedInfo();
}
RTC_CHECK_EQ(speech_buffer_.size(), full_frame_samples_);
- RTC_CHECK_GE(max_encoded_bytes, full_frame_samples_);
EncodedInfo info;
info.encoded_timestamp = first_timestamp_in_buffer_;
info.payload_type = payload_type_;
info.encoded_bytes =
- EncodeCall(&speech_buffer_[0], full_frame_samples_, encoded);
+ encoded->AppendData(MaxEncodedBytes(),
+ [&] (rtc::ArrayView<uint8_t> encoded) {
+ return EncodeCall(&speech_buffer_[0],
+ full_frame_samples_,
+ encoded.data());
+ });
speech_buffer_.clear();
return info;
}

Powered by Google App Engine
This is Rietveld 408576698