diff mbox series

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

Message ID 20240301123743.2332-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avcodec/decode: give packet side data priority over global | expand

Checks

Context Check Description
yinshiyou/commit_msg_loongarch64 warning Please wrap lines in the body of the commit message between 60 and 72 characters.
andriy/commit_msg_x86 warning Please wrap lines in the body of the commit message between 60 and 72 characters.
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer March 1, 2024, 12:37 p.m. UTC
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@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(+)

Comments

Anton Khirnov March 1, 2024, 3:29 p.m. UTC | #1
Quoting James Almer (2024-03-01 13:37:43)
> 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.

Does it actually fix the ticket? I think
ff_decode_frame_props_from_pkt() is called before the decoder adds
bitstream side data to the frame.
James Almer March 1, 2024, 3:37 p.m. UTC | #2
On 3/1/2024 12:29 PM, Anton Khirnov wrote:
> Quoting James Almer (2024-03-01 13:37:43)
>> 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.
> 
> Does it actually fix the ticket? I think
> ff_decode_frame_props_from_pkt() is called before the decoder adds
> bitstream side data to the frame.

Oh, bitstream side data. I was thinking about packet side data (so also 
coming from lavf). Right, this would not work then, so patch dropped.
diff mbox series

Patch

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);