# HG changeset patch # User reimar # Date 1257522355 0 # Node ID e19b989877c620a70e6a6707115ae0b053ae3f0f # Parent c2dde95d9850a616021f720bc6203e635c73920a Only call avcodec_close if the open succeeded before, otherwise avcodec_close will crash (happens e.g. when encoding ends before any frames were actually encoded, e.g. when an MPEG file was cut down to much so it no longer contains a full video frame). diff -r c2dde95d9850 -r e19b989877c6 libmpcodecs/ve_lavc.c --- a/libmpcodecs/ve_lavc.c Fri Nov 06 14:06:58 2009 +0000 +++ b/libmpcodecs/ve_lavc.c Fri Nov 06 15:45:55 2009 +0000 @@ -911,7 +911,8 @@ av_freep(&lavc_venc_context->intra_matrix); av_freep(&lavc_venc_context->inter_matrix); - avcodec_close(lavc_venc_context); + if (lavc_venc_context->codec) + avcodec_close(lavc_venc_context); if(stats_file) fclose(stats_file);