[x264-devel] Fix crash if the first frame is forced to a non-keyframe

Anton Mitrofanov git at videolan.org
Wed Jan 9 19:32:22 CET 2013


x264 | branch: master | Anton Mitrofanov <BugMaster at narod.ru> | Tue Jan  8 13:29:49 2013 -0800| [9c4ba4bde8965571159eae2d79f85cabbb47416c] | committer: Jason Garrett-Glaser

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.

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=9c4ba4bde8965571159eae2d79f85cabbb47416c
---

 encoder/slicetype.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/encoder/slicetype.c b/encoder/slicetype.c
index f4a91a8..658c2fb 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 )
         {



More information about the x264-devel mailing list