Added EncodedImage::GetBufferPaddingBytes.

The FFmpeg video decoder requires up to 8 additional bytes to be allocated for its encoded image buffer input, due to optimized byte readers over-reading on some platforms.
We plan to use FFmpeg for a soon-to-land H.264 enc/dec.

This CL adds support for padding encoded image buffers based on codec type, and makes sure calls to VCMEncodedFrame::VerifyAndAllocate use the padding.

All padding constants are 0 but making H.264 pad with 8 bytes will be a one-line change.

Also, added -framework CoreFoundation to webrtc_h264_video_toolbox which was missing.

BUG=chromium:468365
BUG=https://bugs.chromium.org/p/webrtc/issues/detail?id=5424
NOTRY=True

Review URL: https://codereview.webrtc.org/1602523004

Cr-Commit-Position: refs/heads/master@{#11337}
This commit is contained in:
hbos
2016-01-21 05:43:11 -08:00
committed by Commit bot
parent 429c345b02
commit d664836efa
5 changed files with 35 additions and 3 deletions

View File

@ -41,7 +41,8 @@ VCMEncodedFrame::VCMEncodedFrame(const webrtc::EncodedImage& rhs)
_size = 0;
_length = 0;
if (rhs._buffer != NULL) {
VerifyAndAllocate(rhs._length);
VerifyAndAllocate(rhs._length +
EncodedImage::GetBufferPaddingBytes(_codec));
memcpy(_buffer, rhs._buffer, rhs._length);
}
}
@ -60,7 +61,8 @@ VCMEncodedFrame::VCMEncodedFrame(const VCMEncodedFrame& rhs)
_size = 0;
_length = 0;
if (rhs._buffer != NULL) {
VerifyAndAllocate(rhs._length);
VerifyAndAllocate(rhs._length +
EncodedImage::GetBufferPaddingBytes(_codec));
memcpy(_buffer, rhs._buffer, rhs._length);
_length = rhs._length;
}