PR #26159 opened by Baptiste Coudurier (bcoudurier) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26159 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/26159.patch
When an input packet is split by a parser, the first output receives the original packet side data. Copying the leading skip to subsequent outputs can make the decoder restart the skip on every packet. Keep the full leading skip on the first output. Omit leading-only skip side data from later outputs, or clear just the leading count and reason when trailing discard is also present. Verified with grouped AC-3 packets whose input duration was unset. Leading skips of 2,000 and 3,500 samples each appeared once, on the first output packet. >From 6c9d8e92d3bbb63887eb063f42d50dc909a2bd19 Mon Sep 17 00:00:00 2001 From: Baptiste Coudurier <[email protected]> Date: Tue, 17 Nov 2026 16:44:36 -0800 Subject: [PATCH] avformat/demux: copy leading sample skip only to the first parser output --- libavformat/demux.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavformat/demux.c b/libavformat/demux.c index 3c5157df4e8..b608f35e28a 100644 --- a/libavformat/demux.c +++ b/libavformat/demux.c @@ -1263,12 +1263,21 @@ static int parse_packet(AVFormatContext *s, AVPacket *pkt, out_pkt->side_data_elems = pkt->side_data_elems; } else for (int i = 0; i < pkt->side_data_elems; i++) { const AVPacketSideData *const src_sd = &pkt->side_data[i]; + int skip_samples = src_sd->type == AV_PKT_DATA_SKIP_SAMPLES && + src_sd->size >= 10; + + if (skip_samples && !AV_RL32(src_sd->data + 4)) + continue; uint8_t *dst_data = av_packet_new_side_data(out_pkt, src_sd->type, src_sd->size); if (!dst_data) { ret = AVERROR(ENOMEM); goto fail; } memcpy(dst_data, src_sd->data, src_sd->size); + if (skip_samples) { + AV_WL32(dst_data, 0); + dst_data[8] = 0; + } } } -- 2.54.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
