[FFmpeg-devel] [PATCH] avcodec/decode: give packet side data priority over global

James Almer jamrial at gmail.com
Fri Mar 1 14:37:43 EET 2024


Restores the behavior prior to ae22271620df90567ba276832b33607d64e9ba9c, where
global side data would be inserted first to the output frame, resulting in both
two entries for the same type and having priority when fetched by the AVFrame
helpers.

This is a temporary fix for ticket #10857 until a proper method to select the
source for side data is implemented.

Signed-off-by: James Almer <jamrial at gmail.com>
---
This is meant to restore the old behavior in git master until
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=10880 is finally
implemented.

 libavcodec/decode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 7c67b18bc4..0dbbf4a6da 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1465,6 +1465,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
         if (packet_sd) {
             AVFrameSideData *frame_sd;
 
+            av_frame_remove_side_data(frame, sd_global_map[i].frame);
             frame_sd = av_frame_new_side_data(frame, sd_global_map[i].frame, size);
             if (!frame_sd)
                 return AVERROR(ENOMEM);
-- 
2.44.0



More information about the ffmpeg-devel mailing list