[FFmpeg-cvslog] avcodec/libutvideodec: copy frame so it has reference counters when refcounted_frames is set

Michael Niedermayer git at videolan.org
Sat Apr 30 03:36:42 CEST 2016


ffmpeg | branch: release/2.6 | Michael Niedermayer <michael at niedermayer.cc> | Thu Mar 24 20:55:30 2016 +0100| [cb7809cc4d6b1b47e936d2e94b21f4e41850ffaf] | committer: Michael Niedermayer

avcodec/libutvideodec: copy frame so it has reference counters when refcounted_frames is set

Reviewed-by: maintainer
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 0cd9ff4e3aa23318a855c21d60b1c9035b2b99d2)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/libutvideodec.cpp |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/libavcodec/libutvideodec.cpp b/libavcodec/libutvideodec.cpp
index e4b87a8..93fbcb4 100644
--- a/libavcodec/libutvideodec.cpp
+++ b/libavcodec/libutvideodec.cpp
@@ -222,9 +222,19 @@ static int utvideo_decode_frame(AVCodecContext *avctx, void *data,
         pic->data[0] = utv->buffer + utv->buf_size + pic->linesize[0];
         break;
     }
+    pic->width  = w;
+    pic->height = h;
+    pic->format = avctx->pix_fmt;
+
+    if (avctx->refcounted_frames) {
+        int ret = av_frame_ref((AVFrame*)data, pic);
+        if (ret < 0)
+             return ret;
+    } else {
+        av_frame_move_ref((AVFrame*)data, pic);
+    }
 
     *got_frame = 1;
-    av_frame_move_ref((AVFrame*)data, pic);
 
     return avpkt->size;
 }



More information about the ffmpeg-cvslog mailing list