[FFmpeg-cvslog] lavfi: unref AVFilterLink.out_buf in ff_end_frame().

Anton Khirnov git at videolan.org
Sat Jul 21 22:32:09 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Jul 14 17:09:43 2012 +0200| [4c9080a7ef18ad71fb0a75c8d1c1803edd780edd] | committer: Anton Khirnov

lavfi: unref AVFilterLink.out_buf in ff_end_frame().

This reduces code duplication and prevents stale pointers from remaining
on the link.

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

 libavfilter/vf_delogo.c     |    1 -
 libavfilter/vf_fieldorder.c |    1 -
 libavfilter/vf_frei0r.c     |    1 -
 libavfilter/vf_gradfun.c    |    1 -
 libavfilter/vf_hqdn3d.c     |    1 -
 libavfilter/vf_libopencv.c  |    1 -
 libavfilter/vf_pad.c        |    1 -
 libavfilter/vf_transpose.c  |    1 -
 libavfilter/vf_unsharp.c    |    1 -
 libavfilter/video.c         |    5 +----
 10 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c
index f9c5ad7..9c6e488 100644
--- a/libavfilter/vf_delogo.c
+++ b/libavfilter/vf_delogo.c
@@ -260,7 +260,6 @@ static void end_frame(AVFilterLink *inlink)
 
     ff_draw_slice(outlink, 0, inlink->h, 1);
     ff_end_frame(outlink);
-    avfilter_unref_buffer(outpicref);
 }
 
 AVFilter avfilter_vf_delogo = {
diff --git a/libavfilter/vf_fieldorder.c b/libavfilter/vf_fieldorder.c
index 05882d1..1ddec15 100644
--- a/libavfilter/vf_fieldorder.c
+++ b/libavfilter/vf_fieldorder.c
@@ -213,7 +213,6 @@ static void end_frame(AVFilterLink *inlink)
     }
 
     ff_end_frame(outlink);
-    avfilter_unref_bufferp(&outlink->out_buf);
 }
 
 AVFilter avfilter_vf_fieldorder = {
diff --git a/libavfilter/vf_frei0r.c b/libavfilter/vf_frei0r.c
index 87c9276..98d34ab 100644
--- a/libavfilter/vf_frei0r.c
+++ b/libavfilter/vf_frei0r.c
@@ -354,7 +354,6 @@ static void end_frame(AVFilterLink *inlink)
                    (uint32_t *)outpicref->data[0]);
     ff_draw_slice(outlink, 0, outlink->h, 1);
     ff_end_frame(outlink);
-    avfilter_unref_buffer(outpicref);
 }
 
 AVFilter avfilter_vf_frei0r = {
diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c
index b6583d7..873c0d0 100644
--- a/libavfilter/vf_gradfun.c
+++ b/libavfilter/vf_gradfun.c
@@ -225,7 +225,6 @@ static void end_frame(AVFilterLink *inlink)
 
     ff_draw_slice(outlink, 0, inlink->h, 1);
     ff_end_frame(outlink);
-    avfilter_unref_buffer(outpic);
 }
 
 AVFilter avfilter_vf_gradfun = {
diff --git a/libavfilter/vf_hqdn3d.c b/libavfilter/vf_hqdn3d.c
index 79adaea..221ff2e2 100644
--- a/libavfilter/vf_hqdn3d.c
+++ b/libavfilter/vf_hqdn3d.c
@@ -322,7 +322,6 @@ static void end_frame(AVFilterLink *inlink)
 
     ff_draw_slice(outlink, 0, inpic->video->h, 1);
     ff_end_frame(outlink);
-    avfilter_unref_buffer(outpic);
 }
 
 AVFilter avfilter_vf_hqdn3d = {
diff --git a/libavfilter/vf_libopencv.c b/libavfilter/vf_libopencv.c
index f04d469..1e8185f 100644
--- a/libavfilter/vf_libopencv.c
+++ b/libavfilter/vf_libopencv.c
@@ -367,7 +367,6 @@ static void end_frame(AVFilterLink *inlink)
 
     ff_draw_slice(outlink, 0, outlink->h, 1);
     ff_end_frame(outlink);
-    avfilter_unref_buffer(outpicref);
 }
 
 AVFilter avfilter_vf_ocv = {
diff --git a/libavfilter/vf_pad.c b/libavfilter/vf_pad.c
index b0d5c5f..6ce70bd 100644
--- a/libavfilter/vf_pad.c
+++ b/libavfilter/vf_pad.c
@@ -347,7 +347,6 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
 static void end_frame(AVFilterLink *link)
 {
     ff_end_frame(link->dst->outputs[0]);
-    avfilter_unref_buffer(link->dst->outputs[0]->out_buf);
 }
 
 static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice)
diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
index e772e8b..ed75866 100644
--- a/libavfilter/vf_transpose.c
+++ b/libavfilter/vf_transpose.c
@@ -194,7 +194,6 @@ static void end_frame(AVFilterLink *inlink)
 
     ff_draw_slice(outlink, 0, outpic->video->h, 1);
     ff_end_frame(outlink);
-    avfilter_unref_buffer(outpic);
 }
 
 AVFilter avfilter_vf_transpose = {
diff --git a/libavfilter/vf_unsharp.c b/libavfilter/vf_unsharp.c
index 3d28759..2a0fe00 100644
--- a/libavfilter/vf_unsharp.c
+++ b/libavfilter/vf_unsharp.c
@@ -227,7 +227,6 @@ static void end_frame(AVFilterLink *link)
 
     ff_draw_slice(link->dst->outputs[0], 0, link->h, 1);
     ff_end_frame(link->dst->outputs[0]);
-    avfilter_unref_buffer(out);
 }
 
 static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
diff --git a/libavfilter/video.c b/libavfilter/video.c
index e507f97..f61eafe 100644
--- a/libavfilter/video.c
+++ b/libavfilter/video.c
@@ -225,10 +225,6 @@ static void default_end_frame(AVFilterLink *inlink)
         outlink = inlink->dst->outputs[0];
 
     if (outlink) {
-        if (outlink->out_buf) {
-            avfilter_unref_buffer(outlink->out_buf);
-            outlink->out_buf = NULL;
-        }
         ff_end_frame(outlink);
     }
 }
@@ -249,6 +245,7 @@ void ff_end_frame(AVFilterLink *link)
         link->src_buf = NULL;
     }
     avfilter_unref_bufferp(&link->cur_buf);
+    avfilter_unref_bufferp(&link->out_buf);
 }
 
 void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)



More information about the ffmpeg-cvslog mailing list