changeset 29793:e19b989877c6

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).
author reimar
date Fri, 06 Nov 2009 15:45:55 +0000
parents c2dde95d9850
children df1826dcdb2d
files libmpcodecs/ve_lavc.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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);