Fix invalid output buffer usage
This patch fixes the internal AudioCoder output buffer setting to be set
prior it will be used within callback from ACM
BUG=webrtc:7462
Review-Url: https://codereview.webrtc.org/2806933002
Cr-Commit-Position: refs/heads/master@{#17800}
diff --git a/webrtc/voice_engine/coder.cc b/webrtc/voice_engine/coder.cc
index 552e5a5..6337e10 100644
--- a/webrtc/voice_engine/coder.cc
+++ b/webrtc/voice_engine/coder.cc
@@ -95,10 +95,11 @@
// For any codec with a frame size that is longer than 10 ms the encoded
// length in bytes should be zero until a a full frame has been encoded.
encoded_length_in_bytes_ = 0;
+ encoded_data_ = encoded_data;
if (acm_->Add10MsData((AudioFrame&)audio_frame) == -1) {
return -1;
}
- encoded_data_ = encoded_data;
+
*encoded_length_in_bytes = encoded_length_in_bytes_;
return 0;
}