Reallocate encoded buffer size if needed. Initially set to the input image size.
Issue may occur for very small input images (e.g. 4x4) when encoded image length > input image size. BUG=chromium:578193 Review URL: https://codereview.webrtc.org/1603643006 Cr-Commit-Position: refs/heads/master@{#11329}
This commit is contained in:
@ -659,6 +659,12 @@ int VP9EncoderImpl::GetEncodedLayerFrame(const vpx_codec_cx_pkt* pkt) {
|
||||
int part_idx = 0;
|
||||
CodecSpecificInfo codec_specific;
|
||||
|
||||
if (pkt->data.frame.sz > encoded_image_._size) {
|
||||
delete[] encoded_image_._buffer;
|
||||
encoded_image_._size = pkt->data.frame.sz;
|
||||
encoded_image_._buffer = new uint8_t[encoded_image_._size];
|
||||
}
|
||||
|
||||
assert(pkt->kind == VPX_CODEC_CX_FRAME_PKT);
|
||||
memcpy(&encoded_image_._buffer[encoded_image_._length], pkt->data.frame.buf,
|
||||
pkt->data.frame.sz);
|
||||
|
||||
Reference in New Issue
Block a user