test: h265parser: Test for NAL missing header bytes

H.265 NAL always have 2 bytes of headers. Unlike the H.264 parser, this parser
will simply return that there is NO_NAL if some of these bytes are missing.
This is then properly special cased by parsers and decoders. Add a test to
ensure we don't break this in the future.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3234>
This commit is contained in:
Nicolas Dufresne 2022-10-20 15:07:15 -04:00 committed by GStreamer Marge Bot
parent dacb2a2b51
commit 0780e31581

View file

@ -1450,6 +1450,26 @@ GST_START_TEST (test_h265_decoder_config_record)
GST_END_TEST; GST_END_TEST;
GST_START_TEST (test_h265_parse_partial_nal)
{
GstH265ParserResult res;
GstH265NalUnit nalu;
GstH265Parser *parser = gst_h265_parser_new ();
const guint8 *buf = slice_eos_slice_eob;
const guint buf_size = 5;
res = gst_h265_parser_identify_nalu (parser, buf, 0, buf_size, &nalu);
/* H.265 parser is a bit different then H.264 one, and will return
* NO_NAL if there is a start code but not enough bytes to hold the
* header. */
assert_equals_int (res, GST_H265_PARSER_NO_NAL);
gst_h265_parser_free (parser);
}
GST_END_TEST;
static Suite * static Suite *
h265parser_suite (void) h265parser_suite (void)
{ {
@ -1474,6 +1494,7 @@ h265parser_suite (void)
tcase_add_test (tc_chain, test_h265_create_sei); tcase_add_test (tc_chain, test_h265_create_sei);
tcase_add_test (tc_chain, test_h265_split_hevc); tcase_add_test (tc_chain, test_h265_split_hevc);
tcase_add_test (tc_chain, test_h265_decoder_config_record); tcase_add_test (tc_chain, test_h265_decoder_config_record);
tcase_add_test (tc_chain, test_h265_parse_partial_nal);
return s; return s;
} }