buffersrc: avoid creating unnecessary buffer reference
authorAnton Khirnov <anton@khirnov.net>
Sun, 15 Jul 2012 08:28:17 +0000 (10:28 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 22 Jul 2012 07:14:05 +0000 (09:14 +0200)
libavfilter/buffersrc.c

index 2aa7d7d..16a38a6 100644 (file)
@@ -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;
 }