diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/codecparsers/gsth264parser.c b/subprojects/gst-plugins-bad/gst-libs/gst/codecparsers/gsth264parser.c index 76937cdf01..1aa9e719c0 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/codecparsers/gsth264parser.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/codecparsers/gsth264parser.c @@ -1507,9 +1507,9 @@ gst_h264_parser_identify_nalu_unchecked (GstH264NalParser * nalparser, nalu->size = size - nalu->offset; if (!gst_h264_parse_nalu_header (nalu)) { - GST_WARNING ("error parsing \"NAL unit header\""); + GST_DEBUG ("not enough data to parse \"NAL unit header\""); nalu->size = 0; - return GST_H264_PARSER_BROKEN_DATA; + return GST_H264_PARSER_NO_NAL; } nalu->valid = TRUE; diff --git a/subprojects/gst-plugins-bad/tests/check/libs/h264parser.c b/subprojects/gst-plugins-bad/tests/check/libs/h264parser.c index 17238bafaf..0d92e81eea 100644 --- a/subprojects/gst-plugins-bad/tests/check/libs/h264parser.c +++ b/subprojects/gst-plugins-bad/tests/check/libs/h264parser.c @@ -825,6 +825,28 @@ GST_START_TEST (test_h264_decoder_config_record) GST_END_TEST; +GST_START_TEST (test_h264_parse_partial_nal_header) +{ + GstH264ParserResult res; + GstH264NalUnit nalu; + GstH264NalParser *const parser = gst_h264_nal_parser_new (); + const guint8 buf[] = { 0x00, 0x00, 0x00, 0x01, 0x0e }; + guint buf_size = sizeof (buf); + + /* Test that incomplete prefix NAL do return NO_NAL_END and not BROKEN_NAL. + * This also covers for SLICE_EXT. */ + res = gst_h264_parser_identify_nalu (parser, buf, 0, buf_size, &nalu); + + assert_equals_int (res, GST_H264_PARSER_NO_NAL); + assert_equals_int (nalu.type, GST_H264_NAL_PREFIX_UNIT); + assert_equals_int (nalu.size, 0); + + gst_h264_nal_parser_free (parser); +} + +GST_END_TEST; + + static Suite * h264parser_suite (void) { @@ -840,6 +862,7 @@ h264parser_suite (void) tcase_add_test (tc_chain, test_h264_parse_invalid_sei); tcase_add_test (tc_chain, test_h264_create_sei); tcase_add_test (tc_chain, test_h264_decoder_config_record); + tcase_add_test (tc_chain, test_h264_parse_partial_nal_header); return s; }