changeset 11748:40911dc14bdc libavcodec

fix x264 encoding when delay is > number of input frames
author bcoudurier
date Wed, 19 May 2010 20:48:29 +0000
parents 3a150ee29655
children c6368258b694
files libx264.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libx264.c	Wed May 19 20:18:40 2010 +0000
+++ b/libx264.c	Wed May 19 20:48:29 2010 +0000
@@ -102,12 +102,14 @@
         x4->pic.i_type = X264_TYPE_AUTO;
     }
 
+    do {
     if (x264_encoder_encode(x4->enc, &nal, &nnal, frame? &x4->pic: NULL, &pic_out) < 0)
         return -1;
 
     bufsize = encode_nals(ctx, buf, bufsize, nal, nnal, 0);
     if (bufsize < 0)
         return -1;
+    } while (!bufsize && !frame && x264_encoder_delayed_frames(x4->enc));
 
     /* FIXME: libx264 now provides DTS, but AVFrame doesn't have a field for it. */
     x4->out_pic.pts = pic_out.i_pts;