From b7cfd11b72693a93cea3db66cc883253f66aa077 Mon Sep 17 00:00:00 2001 From: Jordan Yelloz Date: Wed, 3 Jul 2024 07:58:58 -0600 Subject: [PATCH] h265parse: Reject FD received before SPS A previous fix, a275e1e029e9b5d88be26b8304c9a162e4567346, is correct but was too permissive since it treats all un-matched NAL units the same as AU delimiters even though some other NAL unit types can be encountered in the processing loop. The problem this can cause is that some hardware decoders experience bad performance when handling FD units that precede the SPS. This change restores the original behavior for FDs so that they're ignored until the SPS is received and it preserves the codec conformance test gains that the fix has achieved. Part-of: --- .../gst-plugins-bad/gst/videoparsers/gsth265parse.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c index 6b6a70effc..5994abafc5 100644 --- a/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c +++ b/subprojects/gst-plugins-bad/gst/videoparsers/gsth265parse.c @@ -981,6 +981,15 @@ gst_h265_parse_process_nal (GstH265Parse * h265parse, GstH265NalUnit * nalu) } break; } + case GST_H265_NAL_FD: + if (!GST_H265_PARSE_STATE_VALID (h265parse, GST_H265_PARSE_STATE_GOT_SPS)) { + GST_DEBUG_OBJECT (h265parse, "dropping FD received before SPS"); + return FALSE; + } + pres = gst_h265_parser_parse_nal (nalparser, nalu); + if (pres != GST_H265_PARSER_OK) + return FALSE; + break; case GST_H265_NAL_AUD: default: /* Just accumulate AU Delimiter, whether it's before SPS or not */