From 2b0f094c8fbb341f83c7ccfca4224040de3f343d Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Fri, 21 Oct 2011 06:39:03 +0000 Subject: [PATCH] Avoid reallocating the decodedImage for every decoded frame. Also made sure the right size is allocated. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/240004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@790 4adac7df-926f-26a2-2b94-8c16560cd09d --- src/modules/video_coding/codecs/vp8/main/source/vp8.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc index aaa14cb237..a92131faa0 100644 --- a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc +++ b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc @@ -1049,8 +1049,8 @@ VP8Decoder::ReturnFrame(const vpx_image_t* img, WebRtc_UWord32 timeStamp) } // Allocate memory for decoded image - WebRtc_UWord32 requiredSize = (3 * img->h * img->w) >> 1; - if (_decodedImage._buffer != NULL) + WebRtc_UWord32 requiredSize = (3 * img->d_h * img->d_w) >> 1; + if (requiredSize > _decodedImage._size) { delete [] _decodedImage._buffer; _decodedImage._buffer = NULL;