From 9e15b6d8e4b0c927c8ebf0abc75c4467437a91f9 Mon Sep 17 00:00:00 2001 From: Steven Walters Date: Wed, 9 Sep 2009 12:19:40 -0700 Subject: [PATCH] Fix crash if encoder_close is called before delayed frames are flushed Also no longer flush frames when ctrl-Cing x264, so x264 will close faster. --- encoder/lookahead.c | 2 +- x264.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/encoder/lookahead.c b/encoder/lookahead.c index 35ed729d..0f647410 100644 --- a/encoder/lookahead.c +++ b/encoder/lookahead.c @@ -176,7 +176,7 @@ void x264_lookahead_delete( x264_t *h ) x264_synch_frame_list_delete( &h->lookahead->next ); x264_synch_frame_list_delete( &h->lookahead->ofbuf ); if( h->lookahead->last_nonb ) - x264_frame_delete( h->lookahead->last_nonb ); + x264_frame_push_unused( h, h->lookahead->last_nonb ); x264_free( h->lookahead ); } diff --git a/x264.c b/x264.c index 08095d59..0fdde7d8 100644 --- a/x264.c +++ b/x264.c @@ -1227,7 +1227,7 @@ static int Encode( x264_param_t *param, cli_opt_t *opt ) } } /* Flush delayed frames */ - while( x264_encoder_delayed_frames( h ) ) + while( !b_ctrl_c && x264_encoder_delayed_frames( h ) ) { i_frame_size = Encode_frame( h, opt->hout, NULL ); if( i_frame_size < 0 ) -- 2.40.0