OSDN Git Service

flush frames x264 has cached properly
authorjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 2 Apr 2010 17:12:13 +0000 (17:12 +0000)
committerjstebbins <jstebbins@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Fri, 2 Apr 2010 17:12:13 +0000 (17:12 +0000)
waiting until the returned size is == 0 isn't adequate.
you must use the function x264_encoder_delayed_frames

encoding very short clips resulted in invalid unplayable files.

git-svn-id: svn://localhost/HandBrake/trunk@3186 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/encx264.c

index 407df68..b74d4f2 100644 (file)
@@ -623,10 +623,12 @@ int encx264Work( hb_work_object_t * w, hb_buffer_t ** buf_in,
         x264_nal_t *nal;
         hb_buffer_t *last_buf = NULL;
 
-        while (1)
+        while ( x264_encoder_delayed_frames( pv->x264 ) )
         {
             x264_encoder_encode( pv->x264, &nal, &i_nal, NULL, &pic_out );
-            if ( i_nal <= 0 )
+            if ( i_nal == 0 )
+                continue;
+            if ( i_nal < 0 )
                 break;
 
             hb_buffer_t *buf = nal_encode( w, &pic_out, i_nal, nal );