From 3e59635d1e04bbf29e10e276a027ab9aa1204471 Mon Sep 17 00:00:00 2001 From: guy-with-a-why Date: Tue, 25 Aug 2026 14:24:05 +0100 Subject: [PATCH] avcodec/h264_parser: recognise partition A as a picture start parse_nal_units() takes slice_type and the POC fields from the first VCL NAL of a picture, but recognised only plain and IDR slices. A partition A opens with a slice header too, so until now a partitioned stream left the parser reporting no picture type at all. It needs the same leading bytes as any other VCL NAL, so it gets the same source length cap rather than having its whole RBSP extracted. Signed-off-by: guy-with-a-why --- libavcodec/h264_parser.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index af43cad609..1bd0be38a5 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -314,6 +314,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, switch (state & 0x1f) { case H264_NAL_SLICE: case H264_NAL_IDR_SLICE: + case H264_NAL_DPA: // Do not walk the whole buffer just to decode slice header if ((state & 0x1f) == H264_NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) { /* IDR or disposable slice @@ -360,6 +361,7 @@ static inline int parse_nal_units(AVCodecParserContext *s, p->poc.prev_poc_lsb = 0; av_fallthrough; case H264_NAL_SLICE: + case H264_NAL_DPA: // starts with a slice header too get_ue_golomb_long(&nal.gb); // skip first_mb_in_slice slice_type = get_ue_golomb_31(&nal.gb); s->pict_type = ff_h264_golomb_to_pict_type[slice_type % 5];