summaryrefslogtreecommitdiffstats
path: root/libhb/encx264.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-04-02 17:12:13 +0000
committerjstebbins <[email protected]>2010-04-02 17:12:13 +0000
commitc8fa75ef0f9d08063f37cbfc85f8301d8c9adcb4 (patch)
treed40d1a07b78b6ccd593629fd0687a032fb88b1fb /libhb/encx264.c
parenta62905aa4be418585647054bb1b6e2ff2f9171d2 (diff)
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
Diffstat (limited to 'libhb/encx264.c')
-rw-r--r--libhb/encx264.c6
1 files 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 );