[FFmpeg-devel] [PATCH 2/2] avcodec/hevc/hevcdec: simplify creating a new reference to HDR10 side data

James Almer jamrial at gmail.com
Tue Feb 4 23:12:56 EET 2025


Signed-off-by: James Almer <jamrial at gmail.com>
---
 libavcodec/hevc/hevcdec.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index cf4062c75c..24d801c39f 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -3081,16 +3081,11 @@ static int set_side_data(HEVCContext *s)
     }
 
     if (s->sei.common.dynamic_hdr_plus.info) {
-        AVBufferRef *info_ref = av_buffer_ref(s->sei.common.dynamic_hdr_plus.info);
-        if (!info_ref)
-            return AVERROR(ENOMEM);
-
         ret = ff_frame_new_side_data_from_buf(s->avctx, out, AV_FRAME_DATA_DYNAMIC_HDR_PLUS,
-                                              &info_ref, 0);
-        if (ret < 0) {
-            av_buffer_unref(&info_ref);
+                                              &s->sei.common.dynamic_hdr_plus.info,
+                                              AV_FRAME_SIDE_DATA_FLAG_NEW_REF);
+        if (ret < 0)
             return ret;
-        }
     }
 
     if (s->rpu_buf) {
-- 
2.48.1



More information about the ffmpeg-devel mailing list