[FFmpeg-devel] [PATCH 36/38] avcodec/hevcdec: switch to ff_frame_new_side_data_from_buf

Anton Khirnov anton at khirnov.net
Fri Feb 23 15:58:58 EET 2024


From: Niklas Haas <git at haasn.dev>

For consistency, even though this cannot be overriden at the packet
level.
---
 libavcodec/hevcdec.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 0cb2577b39..e5213aa252 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2824,10 +2824,8 @@ static int set_side_data(HEVCContext *s)
     }
 
     if (s->rpu_buf) {
-        AVFrameSideData *rpu = av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_DOVI_RPU_BUFFER, s->rpu_buf);
-        if (!rpu)
-            return AVERROR(ENOMEM);
-
+        if (!ff_frame_new_side_data_from_buf(s->avctx, out, AV_FRAME_DATA_DOVI_RPU_BUFFER, s->rpu_buf))
+            av_buffer_unref(&s->rpu_buf);
         s->rpu_buf = NULL;
     }
 
@@ -2839,10 +2837,8 @@ static int set_side_data(HEVCContext *s)
         if (!info_ref)
             return AVERROR(ENOMEM);
 
-        if (!av_frame_new_side_data_from_buf(out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID, info_ref)) {
+        if (!ff_frame_new_side_data_from_buf(s->avctx, out, AV_FRAME_DATA_DYNAMIC_HDR_VIVID, info_ref))
             av_buffer_unref(&info_ref);
-            return AVERROR(ENOMEM);
-        }
     }
 
     return 0;
-- 
2.42.0



More information about the ffmpeg-devel mailing list