[FFmpeg-cvslog] doc/examples: fix mem issues in filtering_video.

Clément Bœsch git at videolan.org
Tue Nov 19 10:33:21 CET 2013


ffmpeg | branch: master | Clément Bœsch <clement at stupeflix.com> | Tue Nov 19 10:31:39 2013 +0100| [1f7b7d54471711b89f8a64bef1c6636b6aa08c12] | committer: Clément Bœsch

doc/examples: fix mem issues in filtering_video.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f7b7d54471711b89f8a64bef1c6636b6aa08c12
---

 doc/examples/filtering_video.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/examples/filtering_video.c b/doc/examples/filtering_video.c
index d3c33df..3a26b1a 100644
--- a/doc/examples/filtering_video.c
+++ b/doc/examples/filtering_video.c
@@ -36,6 +36,7 @@
 #include <libavfilter/avcodec.h>
 #include <libavfilter/buffersink.h>
 #include <libavfilter/buffersrc.h>
+#include <libavutil/opt.h>
 
 const char *filter_descr = "scale=78:24";
 
@@ -70,6 +71,7 @@ static int open_input_file(const char *filename)
     }
     video_stream_index = ret;
     dec_ctx = fmt_ctx->streams[video_stream_index]->codec;
+    av_opt_set_int(dec_ctx, "refcounted_frames", 1, 0);
 
     /* init the video decoder */
     if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {
@@ -228,6 +230,7 @@ int main(int argc, char **argv)
                     display_frame(filt_frame, buffersink_ctx->inputs[0]->time_base);
                     av_frame_unref(filt_frame);
                 }
+                av_frame_unref(frame);
             }
         }
         av_free_packet(&packet);



More information about the ffmpeg-cvslog mailing list