avcodec/av1dec: add a reference to the raw frame header to AV1Frames

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2020-11-12 16:59:37 -03:00
parent 8f4aec719e
commit f5517be32a
2 changed files with 17 additions and 0 deletions

View File

@ -442,6 +442,8 @@ static void av1_frame_unref(AVCodecContext *avctx, AV1Frame *f)
ff_thread_release_buffer(avctx, &f->tf);
av_buffer_unref(&f->hwaccel_priv_buf);
f->hwaccel_picture_private = NULL;
av_buffer_unref(&f->header_ref);
f->raw_frame_header = NULL;
f->spatial_id = f->temporal_id = 0;
f->order_hint = 0;
memset(f->skip_mode_frame_idx, 0,
@ -457,6 +459,12 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s
if (ret < 0)
return ret;
dst->header_ref = av_buffer_ref(src->header_ref);
if (!dst->header_ref)
goto fail;
dst->raw_frame_header = src->raw_frame_header;
if (src->hwaccel_picture_private) {
dst->hwaccel_priv_buf = av_buffer_ref(src->hwaccel_priv_buf);
if (!dst->hwaccel_priv_buf)
@ -643,6 +651,12 @@ static int av1_frame_alloc(AVCodecContext *avctx, AV1Frame *f)
AVFrame *frame;
int ret;
f->header_ref = av_buffer_ref(s->header_ref);
if (!f->header_ref)
return AVERROR(ENOMEM);
f->raw_frame_header = s->raw_frame_header;
ret = update_context_with_frame_header(avctx, header);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Failed to update context with frame header\n");

View File

@ -36,6 +36,9 @@ typedef struct AV1Frame {
AVBufferRef *hwaccel_priv_buf;
void *hwaccel_picture_private;
AVBufferRef *header_ref;
AV1RawFrameHeader *raw_frame_header;
int temporal_id;
int spatial_id;