libx264: Fix loop failure due to bufsize becoming 0

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2011-10-04 23:21:52 +02:00
parent 26c7ff9317
commit 751a4efd4d

View File

@ -127,13 +127,14 @@ static int encode_nals(AVCodecContext *ctx, uint8_t *buf, int size,
} }
static int X264_frame(AVCodecContext *ctx, uint8_t *buf, static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
int bufsize, void *data) int orig_bufsize, void *data)
{ {
X264Context *x4 = ctx->priv_data; X264Context *x4 = ctx->priv_data;
AVFrame *frame = data; AVFrame *frame = data;
x264_nal_t *nal; x264_nal_t *nal;
int nnal, i; int nnal, i;
x264_picture_t pic_out; x264_picture_t pic_out;
int bufsize;
x264_picture_init( &x4->pic ); x264_picture_init( &x4->pic );
x4->pic.img.i_csp = X264_CSP_I420; x4->pic.img.i_csp = X264_CSP_I420;
@ -164,6 +165,7 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
} }
do { do {
bufsize = orig_bufsize;
if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0) if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
return -1; return -1;