From 5cd49e1bfd049170c37ff907523bf177fe70fee2 Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 2 Jan 2025 12:10:19 -0300 Subject: [PATCH] avcodec/hevc/hevcdec: use av_frame_side_data_add() where useful Signed-off-by: James Almer --- libavcodec/hevc/hevcdec.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 4fc48c28a7..3655ed0039 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -3095,14 +3095,11 @@ static int set_side_data(HEVCContext *s) return ret; if (s->sei.common.dynamic_hdr_vivid.info) { - AVBufferRef *info_ref = av_buffer_ref(s->sei.common.dynamic_hdr_vivid.info); - if (!info_ref) + if (!av_frame_side_data_add(&out->side_data, &out->nb_side_data, + AV_FRAME_DATA_DYNAMIC_HDR_VIVID, + &s->sei.common.dynamic_hdr_vivid.info, + AV_FRAME_SIDE_DATA_FLAG_NEW_REF)) return AVERROR(ENOMEM); - - if (!av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID, info_ref)) { - av_buffer_unref(&info_ref); - return AVERROR(ENOMEM); - } } return 0;