[FFmpeg-cvslog] buffersrc: avoid creating unnecessary buffer reference

Anton Khirnov git at videolan.org
Sun Jul 22 23:56:50 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Jul 15 10:28:17 2012 +0200| [785fa50f0b33bdbafebce49fec4df62f0c81eed4] | committer: Anton Khirnov

buffersrc: avoid creating unnecessary buffer reference

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

 libavfilter/buffersrc.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 2aa7d7d..16a38a6 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -323,21 +323,19 @@ static int request_frame(AVFilterLink *link)
 
     switch (link->type) {
     case AVMEDIA_TYPE_VIDEO:
-        if ((ret = ff_start_frame(link, avfilter_ref_buffer(buf, ~0))) < 0 ||
+        if ((ret = ff_start_frame(link, buf)) < 0 ||
             (ret = ff_draw_slice(link, 0, link->h, 1)) < 0 ||
             (ret = ff_end_frame(link)) < 0)
-            goto fail;
+            return ret;
         break;
     case AVMEDIA_TYPE_AUDIO:
-        ret = ff_filter_samples(link, avfilter_ref_buffer(buf, ~0));
+        ret = ff_filter_samples(link, buf);
         break;
     default:
+        avfilter_unref_bufferp(&buf);
         return AVERROR(EINVAL);
     }
 
-fail:
-    avfilter_unref_buffer(buf);
-
     return ret;
 }
 



More information about the ffmpeg-cvslog mailing list