[FFmpeg-devel] [PATCH] dvenc.c: save some memory

Janne Grunau janne-ffmpeg
Thu Apr 23 01:36:30 CEST 2009


Hi,

the dv muxer ended as worst offender of heap usage during the regression
tests. It ended up using 29MB heap memory. 2/3 of it are allocated in a
single fifo worth of 100 seconds audio data.
Following patch fixes it. make test still passes.

Janne

Index: libavformat/dvenc.c
===================================================================
--- libavformat/dvenc.c	(revision 18663)
+++ libavformat/dvenc.c	(working copy)
@@ -337,7 +337,7 @@
     c->start_time = (time_t)s->timestamp;
 
     for (i=0; i < c->n_ast; i++) {
-        if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) {
+        if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(AVCODEC_MAX_AUDIO_FRAME_SIZE))) {
             while (i > 0) {
                 i--;
                 av_fifo_free(c->audio_data[i]);



More information about the ffmpeg-devel mailing list