Commit a0739e8a authored by James Almer's avatar James Almer

avcodec/nuv: prevent frame copying when outputting duplicate frames

Signed-off-by: 's avatarJames Almer <jamrial@gmail.com>
parent 343f8d51
...@@ -162,6 +162,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -162,6 +162,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
int keyframe, ret; int keyframe, ret;
int size_change = 0; int size_change = 0;
int minsize = 0; int minsize = 0;
int flags = 0;
int result, init_frame = !avctx->frame_number; int result, init_frame = !avctx->frame_number;
enum { enum {
NUV_UNCOMPRESSED = '0', NUV_UNCOMPRESSED = '0',
...@@ -204,6 +205,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -204,6 +205,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
} }
break; break;
case NUV_COPY_LAST: case NUV_COPY_LAST:
flags |= FF_REGET_BUFFER_FLAG_READONLY;
keyframe = 0; keyframe = 0;
break; break;
default: default:
...@@ -268,7 +270,7 @@ retry: ...@@ -268,7 +270,7 @@ retry:
init_frame = 1; 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; return result;
if (init_frame) { if (init_frame) {
memset(c->pic->data[0], 0, avctx->height * c->pic->linesize[0]); memset(c->pic->data[0], 0, avctx->height * c->pic->linesize[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment