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

Unified Diff: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc

Issue 1626373002: Reallocate encoded buffer size if needed for VP8. Initially set to the input image size. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
diff --git a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
index b1b5e02dc08ffc990ffb2e3dd1607fea014a7aba..090bf56380cd57faee39170c4502930b97935b5a 100644
--- a/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
+++ b/webrtc/modules/video_coding/codecs/vp8/vp8_impl.cc
@@ -971,6 +971,14 @@ int VP8EncoderImpl::GetEncodedPartitions(const VideoFrame& input_image,
switch (pkt->kind) {
case VPX_CODEC_CX_FRAME_PKT: {
uint32_t length = encoded_images_[encoder_idx]._length;
+ if (pkt->data.frame.sz + length >
+ encoded_images_[encoder_idx]._size) {
+ uint8_t* buffer = new uint8_t[pkt->data.frame.sz + length];
+ memcpy(buffer, encoded_images_[encoder_idx]._buffer, length);
+ delete[] encoded_images_[encoder_idx]._buffer;
+ encoded_images_[encoder_idx]._buffer = buffer;
+ encoded_images_[encoder_idx]._size = pkt->data.frame.sz + length;
+ }
memcpy(&encoded_images_[encoder_idx]._buffer[length],
pkt->data.frame.buf, pkt->data.frame.sz);
frag_info.fragmentationOffset[part_idx] = length;
« no previous file with comments | « webrtc/modules/video_coding/codecs/vp8/simulcast_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698