summaryrefslogtreecommitdiff
path: root/tests/check/libs
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2018-11-02 13:59:58 -0400
committerSebastian Dröge <slomo@coaxion.net>2018-11-06 07:26:03 +0000
commit1df45620771c4153b58992b11ab356522d127f26 (patch)
tree103ffffe766c6ce45dfbcfc59f4201ec6551fb85 /tests/check/libs
parentcf7ea41c7531af4e647614f1f045211f60694abc (diff)
downloadgstreamer-plugins-bad-1df45620771c4153b58992b11ab356522d127f26.tar.gz
h264parser: Add unit test parsing 5 valid bytes of a NAL
In the case 5 valid bytes of a slice NAL, the parser should return NO_NAL_END.
Diffstat (limited to 'tests/check/libs')
-rw-r--r--tests/check/libs/h264parser.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/check/libs/h264parser.c b/tests/check/libs/h264parser.c
index cc355191a..9d07a218a 100644
--- a/tests/check/libs/h264parser.c
+++ b/tests/check/libs/h264parser.c
@@ -132,7 +132,7 @@ static guint8 slice_dpa[] = {
0x63, 0x72, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02
};
-/* IDR slice, EOSEQ, IDR slice */
+/* IDR slice, SEQ_END, IDR slice, STREAM_END */
static guint8 slice_eoseq_slice[] = {
0x00, 0x00, 0x00, 0x01, 0x65, 0x88, 0x84, 0x00,
0x10, 0xff, 0xfe, 0xf6, 0xf0, 0xfe, 0x05, 0x36,
@@ -211,6 +211,24 @@ GST_START_TEST (test_h264_parse_slice_eoseq_slice)
GST_END_TEST;
+GST_START_TEST (test_h264_parse_slice_5bytes)
+{
+ GstH264ParserResult res;
+ GstH264NalUnit nalu;
+ GstH264NalParser *const parser = gst_h264_nal_parser_new ();
+ const guint8 *buf = slice_eoseq_slice;
+
+ res = gst_h264_parser_identify_nalu (parser, buf, 0, 5, &nalu);
+
+ assert_equals_int (res, GST_H264_PARSER_NO_NAL_END);
+ assert_equals_int (nalu.type, GST_H264_NAL_SLICE_IDR);
+ assert_equals_int (nalu.size, 1);
+
+ gst_h264_nal_parser_free (parser);
+}
+
+GST_END_TEST;
+
static Suite *
h264parser_suite (void)
{
@@ -221,6 +239,7 @@ h264parser_suite (void)
suite_add_tcase (s, tc_chain);
tcase_add_test (tc_chain, test_h264_parse_slice_dpa);
tcase_add_test (tc_chain, test_h264_parse_slice_eoseq_slice);
+ tcase_add_test (tc_chain, test_h264_parse_slice_5bytes);
return s;
}