[FFmpeg-cvslog] r17422 - trunk/output_example.c

andoma subversion
Wed Feb 18 07:49:32 CET 2009


Author: andoma
Date: Wed Feb 18 07:49:32 2009
New Revision: 17422

Log:
av_write_trailer() must be done before closing codecs.

Patch by aclarke a xuggle d com

Modified:
   trunk/output_example.c

Modified: trunk/output_example.c
==============================================================================
--- trunk/output_example.c	Wed Feb 18 05:57:54 2009	(r17421)
+++ trunk/output_example.c	Wed Feb 18 07:49:32 2009	(r17422)
@@ -523,15 +523,18 @@ int main(int argc, char **argv)
         }
     }
 
+    /* write the trailer, if any.  the trailer must be written
+     * before you close the CodecContexts open when you wrote the
+     * header; otherwise write_trailer may try to use memory that
+     * was freed on av_codec_close() */
+    av_write_trailer(oc);
+
     /* close each codec */
     if (video_st)
         close_video(oc, video_st);
     if (audio_st)
         close_audio(oc, audio_st);
 
-    /* write the trailer, if any */
-    av_write_trailer(oc);
-
     /* free the streams */
     for(i = 0; i < oc->nb_streams; i++) {
         av_freep(&oc->streams[i]->codec);




More information about the ffmpeg-cvslog mailing list