Commit ee26abf2 authored by Vitor Sessak's avatar Vitor Sessak Committed by Ronald S. Bultje

Fix an infinite loop when RoQ encoded generated a frame with a size greater...

Fix an infinite loop when RoQ encoded generated a frame with a size greater than the maximum valid size.
Signed-off-by: 's avatarRonald S. Bultje <rsbultje@gmail.com>
parent a6d2227b
...@@ -898,9 +898,20 @@ static void roq_encode_video(RoqContext *enc) ...@@ -898,9 +898,20 @@ static void roq_encode_video(RoqContext *enc)
for (i=0; i<enc->width*enc->height/64; i++) for (i=0; i<enc->width*enc->height/64; i++)
gather_data_for_cel(tempData->cel_evals + i, enc, tempData); gather_data_for_cel(tempData->cel_evals + i, enc, tempData);
/* Quake 3 can't handle chunks bigger than 65536 bytes */ /* Quake 3 can't handle chunks bigger than 65535 bytes */
if (tempData->mainChunkSize/8 > 65536) { if (tempData->mainChunkSize/8 > 65535) {
enc->lambda *= .8; av_log(enc->avctx, AV_LOG_ERROR,
"Warning, generated a frame too big (%d > 65535), "
"try using a smaller qscale value.\n",
tempData->mainChunkSize/8);
enc->lambda *= 1.5;
tempData->mainChunkSize = 0;
memset(tempData->used_option, 0, sizeof(tempData->used_option));
memset(tempData->codebooks.usedCB4, 0,
sizeof(tempData->codebooks.usedCB4));
memset(tempData->codebooks.usedCB2, 0,
sizeof(tempData->codebooks.usedCB2));
goto retry_encode; goto retry_encode;
} }
......
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