From: Anton Mitrofanov Date: Tue, 8 Jan 2013 21:29:49 +0000 (-0800) Subject: Fix crash if the first frame is forced to a non-keyframe X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=9c4ba4bde8965571159eae2d79f85cabbb47416c;p=x264.git Fix crash if the first frame is forced to a non-keyframe This is obviously bad user input, but x264 shouldn't crash if it happens. --- diff --git a/encoder/slicetype.c b/encoder/slicetype.c index f4a91a8f..658c2fbc 100644 --- a/encoder/slicetype.c +++ b/encoder/slicetype.c @@ -1651,7 +1651,10 @@ void x264_slicetype_decide( x264_t *h ) if( warn && h->param.b_open_gop ) warn &= frm->i_type != X264_TYPE_I; if( warn ) + { x264_log( h, X264_LOG_WARNING, "specified frame type (%d) at %d is not compatible with keyframe interval\n", frm->i_type, frm->i_frame ); + frm->i_type = h->param.b_open_gop && h->lookahead->i_last_keyframe >= 0 ? X264_TYPE_I : X264_TYPE_IDR; + } } if( frm->i_type == X264_TYPE_I && frm->i_frame - h->lookahead->i_last_keyframe >= h->param.i_keyint_min ) {