# HG changeset patch # User reimar # Date 1253708804 0 # Node ID 18b540567d562b22d0b868d67a180996b462fae1 # Parent fb0202969d923684d51ffcc716648300f596de71 Use x264_encoder_delayed_frames instead of the current hack to flush delayed frames in VFCTRL_FLUSH_FRAMES. diff -r fb0202969d92 -r 18b540567d56 libmpcodecs/ve_x264.c --- a/libmpcodecs/ve_x264.c Wed Sep 23 12:01:04 2009 +0000 +++ b/libmpcodecs/ve_x264.c Wed Sep 23 12:26:44 2009 +0000 @@ -196,12 +196,10 @@ 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: - while(encode_frame(vf, NULL) == 0 && --count); - while(encode_frame(vf, NULL) > 0); + while (x264_encoder_delayed_frames(mod->x264) > 0) + encode_frame(vf, NULL); return CONTROL_TRUE; default: return CONTROL_UNKNOWN;