Relanding r3071 - updates for i420: Making sure that decoded frame is complete and buffer size is sufficient. Re-landing is possible following r3094 - which disabled a problematic test.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3097 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
mikhal@webrtc.org 2012-11-14 17:56:46 +00:00
parent 71fd288b95
commit 9e9cc72b53

View File

@ -171,10 +171,18 @@ I420Decoder::Decode(const EncodedImage& inputImage,
if (inputImage._length <= 0) {
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
}
if (inputImage._completeFrame == false) {
return WEBRTC_VIDEO_CODEC_ERR_PARAMETER;
}
if (!_inited) {
return WEBRTC_VIDEO_CODEC_UNINITIALIZED;
}
// Verify that the available length is sufficient:
int req_length = CalcBufferSize(kI420, _width, _height);
if (req_length > static_cast<int>(inputImage._length)) {
return WEBRTC_VIDEO_CODEC_ERROR;
}
// Set decoded image parameters.
int half_width = (_width + 1) / 2;
int half_height = (_height + 1) / 2;