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

Unified Diff: webrtc/modules/audio_coding/acm2/audio_coding_module_impl.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/acm2/audio_coding_module_impl.cc
diff --git a/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc b/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc
index a7d9df457c1133c79db9752116a106837ed99bf7..3262d48b6ed0f7a0121357e544580f38ee144a4c 100644
--- a/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc
+++ b/webrtc/modules/audio_coding/acm2/audio_coding_module_impl.cc
@@ -145,13 +145,14 @@ int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) {
last_rtp_timestamp_ = rtp_timestamp;
first_frame_ = false;
- encode_buffer_.SetSize(encoder_stack_->MaxEncodedBytes());
+ // Clear the buffer before reuse - encoded data will get appended.
+ encode_buffer_.Clear();
encoded_info = encoder_stack_->Encode(
rtp_timestamp, rtc::ArrayView<const int16_t>(
input_data.audio, input_data.audio_channel *
input_data.length_per_channel),
- encode_buffer_.size(), encode_buffer_.data());
- encode_buffer_.SetSize(encoded_info.encoded_bytes);
+ &encode_buffer_);
+
bitrate_logger_.MaybeLog(encoder_stack_->GetTargetBitrate() / 1000);
if (encode_buffer_.size() == 0 && !encoded_info.send_even_if_empty) {
// Not enough data.

Powered by Google App Engine
This is Rietveld 408576698