[FFmpeg-cvslog] r20769 - trunk/ffmpeg.c

michael subversion
Tue Dec 8 15:48:36 CET 2009


Author: michael
Date: Tue Dec  8 15:48:36 2009
New Revision: 20769

Log:
10l bug, use av_fast_malloc() instead if av_malloc() for allocating audio
buffers.

Modified:
   trunk/ffmpeg.c

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Tue Dec  8 15:28:28 2009	(r20768)
+++ trunk/ffmpeg.c	Tue Dec  8 15:48:36 2009	(r20769)
@@ -219,6 +219,7 @@ static int64_t timer_start;
 
 static uint8_t *audio_buf;
 static uint8_t *audio_out;
+unsigned int allocated_audio_out_size, allocated_audio_buf_size;
 
 static short *samples;
 
@@ -449,6 +450,7 @@ static int av_exit(int ret)
     av_free(sws_opts);
     av_free(audio_buf);
     av_free(audio_out);
+    allocated_audio_buf_size= allocated_audio_out_size= 0;
     av_free(samples);
 
     if (received_sigterm) {
@@ -579,11 +581,8 @@ static void do_audio_out(AVFormatContext
         av_exit(1);
     }
 
-    /* SC: dynamic allocation of buffers */
-    if (!audio_buf)
-        audio_buf = av_malloc(audio_buf_size);
-    if (!audio_out)
-        audio_out = av_malloc(audio_out_size);
+    av_fast_malloc(&audio_buf, &allocated_audio_buf_size, audio_buf_size);
+    av_fast_malloc(&audio_out, &allocated_audio_out_size, audio_out_size);
     if (!audio_buf || !audio_out)
         return;               /* Should signal an error ! */
 



More information about the ffmpeg-cvslog mailing list