Fix a problem with reading uninitialized memory in ACM

When an "empty frame" was produced by ACMGenericCodecWrapper::Encode,
the timestamp value was not set. This is now fixed, and the first byte
of the bitstream is set to something as well to avoid similar problems.

BUG=chromium:459483
R=jmarusic@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/34269004

Cr-Commit-Position: refs/heads/master@{#8431}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8431 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2015-02-19 13:55:36 +00:00
parent 8ad05b7628
commit 287755246a

View File

@ -1224,11 +1224,15 @@ int16_t ACMGenericCodecWrapper::Encode(
2 * MAX_PAYLOAD_SIZE_BYTE, bitstream, encoded_info));
input_.clear();
*bitstream_len_byte = static_cast<int16_t>(encoded_info->encoded_bytes);
*timestamp = encoded_info->encoded_timestamp;
if (encoded_info->encoded_bytes == 0) {
*encoding_type = kNoEncoding;
return encoded_info->send_even_if_empty ? 1 : 0;
if (encoded_info->send_even_if_empty) {
bitstream[0] = 0;
return 1;
}
return 0;
}
*timestamp = encoded_info->encoded_timestamp;
int payload_type = encoded_info->payload_type;
if (!encoded_info->redundant.empty())