changeset 29438:0b61e12a6ca2

Add a giant hack to the x264 encoder module to ensure all delayed frames are written on FLUSH_FRAMES, this is necessary since using multiple threads adds an additional delay beyond the B-frame delay.
author reimar
date Fri, 07 Aug 2009 09:07:02 +0000
parents d401b1eefcad
children 02dec439f717
files libmpcodecs/ve_x264.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/ve_x264.c	Thu Aug 06 20:04:19 2009 +0000
+++ b/libmpcodecs/ve_x264.c	Fri Aug 07 09:07:02 2009 +0000
@@ -218,9 +218,11 @@
 static int control(struct vf_instance_s* vf, int request, void *data)
 {
     h264_module_t *mod=(h264_module_t*)vf->priv;
+    int count = 256; // giant HACK, x264_encoder_encode may incorrectly return 0
+                     // when threads > 1 and delayed frames pending
     switch(request){
         case VFCTRL_FLUSH_FRAMES:
-            if(param.i_bframe)
+            while(encode_frame(vf, NULL) == 0 && --count);
                 while(encode_frame(vf, NULL) > 0);
             return CONTROL_TRUE;
         default: