History

fftools/ffmpeg_dec: don't try to copy side data from the decoder if it already exists in the output frame

We can't use AV_FRAME_SIDE_DATA_FLAG_REPLACE here because the side data already in the frame should have priority over the global one, so just ensure we don't copy any if it already exists. Fixes ticket #11468.

James Almer committed 1 year ago

Commit 8e603291 parent d1616041 file · +8 −4Browse files

Unified · Split

fftools/ffmpeg_dec.c+8−4
@@ -788,10 +788,14 @@ static int packet_decode(DecoderPriv *dp, AVPacket *pkt, AVFrame *frame) · 787 unmodified lines
788788
789789 frame->time_base = dec->pkt_timebase;
790790
791− ret = clone_side_data(&frame->side_data, &frame->nb_side_data,
792− dec->decoded_side_data, dec->nb_decoded_side_data, 0);
793− if (ret < 0)
794− return ret;
791+ for (int i = 0; i < dec->nb_decoded_side_data; i++) {
792+ const AVFrameSideData *src = dec->decoded_side_data[i];
793+ if (av_frame_side_data_get(frame->side_data, frame->nb_side_data, src->type))
794+ continue;
795+ ret = av_frame_side_data_clone(&frame->side_data, &frame->nb_side_data, src, 0);
796+ if (ret < 0)
797+ return ret;
798+ }
795799
796800 if (dec->codec_type == AVMEDIA_TYPE_AUDIO) {
797801 dp->dec.samples_decoded += frame->nb_samples;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t