Commit 296140eb authored by Stephan Hilb's avatar Stephan Hilb

cpia: move reget_buffer after header check

If the header is invalid, there is no need to get at buffer.
Do it after the header has been checked.
Suggested by Reimar Döffinger
parent 54ca7e39
...@@ -61,12 +61,6 @@ static int cpia_decode_frame(AVCodecContext* avctx, ...@@ -61,12 +61,6 @@ static int cpia_decode_frame(AVCodecContext* avctx,
AVFrame* const frame = &cpia->frame; AVFrame* const frame = &cpia->frame;
uint8_t *y, *u, *v, *y_end, *u_end, *v_end; uint8_t *y, *u, *v, *y_end, *u_end, *v_end;
// Get buffer filled with previous frame
if ((ret = avctx->reget_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed!\n");
return ret;
}
// Check header // Check header
if ( avpkt->size < FRAME_HEADER_SIZE if ( avpkt->size < FRAME_HEADER_SIZE
|| header[0] != MAGIC_0 || header[1] != MAGIC_1 || header[0] != MAGIC_0 || header[1] != MAGIC_1
...@@ -104,6 +98,12 @@ static int cpia_decode_frame(AVCodecContext* avctx, ...@@ -104,6 +98,12 @@ static int cpia_decode_frame(AVCodecContext* avctx,
frame->key_frame = 0; frame->key_frame = 0;
} }
// Get buffer filled with previous frame
if ((ret = avctx->reget_buffer(avctx, frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed!\n");
return ret;
}
for ( i = 0; for ( i = 0;
i < frame->height; i < frame->height;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment