]> git.sesse.net Git - ffmpeg/commitdiff
fix x264 encoding when delay is > number of input frames
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>
Wed, 19 May 2010 20:48:29 +0000 (20:48 +0000)
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>
Wed, 19 May 2010 20:48:29 +0000 (20:48 +0000)
Originally committed as revision 23197 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/libx264.c

index ec6d5ea4339332a7a43de7b29ae123cbc8dcf7c7..2d84dc33af21efe1feecb01265616427370efa72 100644 (file)
@@ -102,12 +102,14 @@ static int X264_frame(AVCodecContext *ctx, uint8_t *buf,
         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;