[FFmpeg-devel] [PATCH] add warning if some buffers were not released

Reimar Döffinger Reimar.Doeffinger
Tue Oct 13 20:28:13 CEST 2009


Hello,
as some of you may have noticed, there is a huge amount of decoders that
do not properly release their buffers.
valgrind doesn't show it because FFmpeg has code to make sure all are
freed.
Thus I propose this change that makes FFmpeg itself warn - hopefully
then nobody writing decoders will forget those release_buffer anymore.
I tested it with the 4xm decoder decoding to -f framecrc and there it works perfectly.
Index: utils.c
===================================================================
--- utils.c     (revision 20223)
+++ utils.c     (working copy)
@@ -946,6 +946,8 @@
 
     if(s->internal_buffer==NULL) return;
 
+    if (s->internal_buffer_count)
+        av_log(s, AV_LOG_WARNING, "Found %i unreleased buffers!\n", s->internal_buffer_count);
     for(i=0; i<INTERNAL_BUFFER_SIZE; i++){
         InternalBuffer *buf= &((InternalBuffer*)s->internal_buffer)[i];
         for(j=0; j<4; j++){




More information about the ffmpeg-devel mailing list