avcodec/libutvideodec: copy frame so it has reference counters when refcounted_frames...
authorMichael Niedermayer <michael@niedermayer.cc>
Thu, 24 Mar 2016 19:55:30 +0000 (20:55 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 29 Apr 2016 12:23:41 +0000 (14:23 +0200)
Reviewed-by: maintainer
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 0cd9ff4e3aa23318a855c21d60b1c9035b2b99d2)

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavcodec/libutvideodec.cpp

index e4b87a8..93fbcb4 100644 (file)
@@ -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;
 }