From c8fa75ef0f9d08063f37cbfc85f8301d8c9adcb4 Mon Sep 17 00:00:00 2001 From: jstebbins Date: Fri, 2 Apr 2010 17:12:13 +0000 Subject: [PATCH] flush frames x264 has cached properly 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://svn.handbrake.fr/HandBrake/trunk@3186 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- libhb/encx264.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libhb/encx264.c b/libhb/encx264.c index 407df689d..b74d4f213 100644 --- a/libhb/encx264.c +++ b/libhb/encx264.c @@ -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 ); -- 2.40.0