From ad58211837d4dfce51ac2824d0353703017d1812 Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Wed, 2 Feb 2011 22:51:45 +0300 Subject: [PATCH] Fix incorrect frame duration for VFR input for some frames --- encoder/encoder.c | 3 +-- encoder/lookahead.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index 02fcf852..53c40339 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -992,8 +992,7 @@ x264_t *x264_encoder_open( x264_param_t *param ) i_slicetype_length = h->frames.i_delay; h->frames.i_delay += h->i_thread_frames - 1; h->frames.i_delay += h->param.i_sync_lookahead; - h->frames.i_delay += h->param.b_vfr_input && (h->param.rc.i_rc_method == X264_RC_ABR || h->param.rc.b_stat_write - || h->param.rc.i_vbv_buffer_size); + h->frames.i_delay += h->param.b_vfr_input; h->frames.i_bframe_delay = h->param.i_bframe ? (h->param.i_bframe_pyramid ? 2 : 1) : 0; h->frames.i_max_ref0 = h->param.i_frame_reference; diff --git a/encoder/lookahead.c b/encoder/lookahead.c index 31ae04e8..7e048645 100644 --- a/encoder/lookahead.c +++ b/encoder/lookahead.c @@ -100,7 +100,7 @@ static void x264_lookahead_thread( x264_t *h ) shift = X264_MIN( h->lookahead->next.i_max_size - h->lookahead->next.i_size, h->lookahead->ifbuf.i_size ); x264_lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, shift ); x264_pthread_mutex_unlock( &h->lookahead->next.mutex ); - if( h->lookahead->next.i_size <= h->lookahead->i_slicetype_length ) + if( h->lookahead->next.i_size <= h->lookahead->i_slicetype_length + h->param.b_vfr_input ) { while( !h->lookahead->ifbuf.i_size && !h->lookahead->b_exit_thread ) x264_pthread_cond_wait( &h->lookahead->ifbuf.cv_fill, &h->lookahead->ifbuf.mutex ); -- 2.47.3