[FFmpeg-cvslog] avcodec/nuv: prevent frame copying when outputting duplicate frames

James Almer git at videolan.org
Wed Sep 4 16:27:18 EEST 2019


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Tue Sep  3 23:54:19 2019 -0300| [a0739e8a16ac8e9d2ab2f00a590c20d7316b1430] | committer: James Almer

avcodec/nuv: prevent frame copying when outputting duplicate frames

Signed-off-by: James Almer <jamrial at gmail.com>

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

 libavcodec/nuv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/nuv.c b/libavcodec/nuv.c
index 2cca206d9b..bb80e3e884 100644
--- a/libavcodec/nuv.c
+++ b/libavcodec/nuv.c
@@ -162,6 +162,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     int keyframe, ret;
     int size_change = 0;
     int minsize = 0;
+    int flags = 0;
     int result, init_frame = !avctx->frame_number;
     enum {
         NUV_UNCOMPRESSED  = '0',
@@ -204,6 +205,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         }
         break;
     case NUV_COPY_LAST:
+        flags |= FF_REGET_BUFFER_FLAG_READONLY;
         keyframe = 0;
         break;
     default:
@@ -268,7 +270,7 @@ retry:
         init_frame = 1;
     }
 
-    if ((result = ff_reget_buffer(avctx, c->pic, 0)) < 0)
+    if ((result = ff_reget_buffer(avctx, c->pic, flags)) < 0)
         return result;
     if (init_frame) {
         memset(c->pic->data[0], 0,    avctx->height * c->pic->linesize[0]);



More information about the ffmpeg-cvslog mailing list