Commit 716cf882 authored by Anton Mitrofanov's avatar Anton Mitrofanov Committed by Fiona Glaser
Browse files

Fix incorrect frame duration for VFR input for some frames

parent d7c05794
...@@ -992,8 +992,7 @@ x264_t *x264_encoder_open( x264_param_t *param ) ...@@ -992,8 +992,7 @@ x264_t *x264_encoder_open( x264_param_t *param )
i_slicetype_length = h->frames.i_delay; i_slicetype_length = h->frames.i_delay;
h->frames.i_delay += h->i_thread_frames - 1; h->frames.i_delay += h->i_thread_frames - 1;
h->frames.i_delay += h->param.i_sync_lookahead; 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->frames.i_delay += h->param.b_vfr_input;
|| h->param.rc.i_vbv_buffer_size);
h->frames.i_bframe_delay = h->param.i_bframe ? (h->param.i_bframe_pyramid ? 2 : 1) : 0; 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; h->frames.i_max_ref0 = h->param.i_frame_reference;
......
...@@ -100,7 +100,7 @@ static void x264_lookahead_thread( x264_t *h ) ...@@ -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 ); 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_lookahead_shift( &h->lookahead->next, &h->lookahead->ifbuf, shift );
x264_pthread_mutex_unlock( &h->lookahead->next.mutex ); 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 ) while( !h->lookahead->ifbuf.i_size && !h->lookahead->b_exit_thread )
x264_pthread_cond_wait( &h->lookahead->ifbuf.cv_fill, &h->lookahead->ifbuf.mutex ); x264_pthread_cond_wait( &h->lookahead->ifbuf.cv_fill, &h->lookahead->ifbuf.mutex );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment