[FFmpeg-cvslog] avutil/frame: continue to process bufs even if some are empty

Xidorn Quan git at videolan.org
Tue May 21 00:21:00 CEST 2013


ffmpeg | branch: master | Xidorn Quan <quanxunzhen at gmail.com> | Mon May 20 23:28:06 2013 +0800| [5a65fea655fb2558a3004a93f782c1534dd6a363] | committer: Michael Niedermayer

avutil/frame: continue to process bufs even if some are empty

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavutil/frame.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 11601ad..24ad0dd 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -259,7 +259,9 @@ int av_frame_ref(AVFrame *dst, AVFrame *src)
     }
 
     /* ref the buffers */
-    for (i = 0; i < FF_ARRAY_ELEMS(src->buf) && src->buf[i]; i++) {
+    for (i = 0; i < FF_ARRAY_ELEMS(src->buf); i++) {
+        if (!src->buf[i])
+            continue;
         dst->buf[i] = av_buffer_ref(src->buf[i]);
         if (!dst->buf[i]) {
             ret = AVERROR(ENOMEM);
@@ -366,8 +368,9 @@ int av_frame_is_writable(AVFrame *frame)
     if (!frame->buf[0])
         return 0;
 
-    for (i = 0; i < FF_ARRAY_ELEMS(frame->buf) && frame->buf[i]; i++)
-        ret &= !!av_buffer_is_writable(frame->buf[i]);
+    for (i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++)
+        if (frame->buf[i])
+            ret &= !!av_buffer_is_writable(frame->buf[i]);
     for (i = 0; i < frame->nb_extended_buf; i++)
         ret &= !!av_buffer_is_writable(frame->extended_buf[i]);
 



More information about the ffmpeg-cvslog mailing list