avcodec/h264_parse: return SPS/PPS errors from avcC with explode

decode_extradata_ps_mp4() skips the retry with an escaped NAL when
AV_EF_EXPLODE is set, but then returns 0 regardless, so a parameter set
that fails to parse in avcC extradata is silently ignored exactly when
the caller asked for errors to be fatal. h264_decode_init() fails on
extradata errors only with explode, so avcodec_open2() succeeded with
-err_detect explode on avcC extradata with a broken SPS, and the
"Decoding sps %d from avcC failed" path was unreachable.

Return the error when explode is set.

Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
This commit is contained in:
Martin Mirchev authored and James Almer committed 2026-10-21 14:52:52 +00:00
1 parent e2798d5cad
commit 510dbddd52
1 file changed
+3 -1
+3 -1
View File
@@ -424,7 +424,9 @@ static int decode_extradata_ps_mp4(const uint8_t *buf, int buf_size, H264ParamSe
int ret;
ret = decode_extradata_ps(buf, buf_size, ps, 1, logctx);
if (ret < 0 && !(err_recognition & AV_EF_EXPLODE)) {
if (ret < 0 && (err_recognition & AV_EF_EXPLODE))
return ret;
if (ret < 0) {
GetByteContext gbc;
PutByteContext pbc;
uint8_t *escaped_buf;