summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-07-01 16:54:00 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2014-07-01 16:54:44 +0200
commit1a455c25cd2328143d2aa87d9ab0cb61035fd511 (patch)
tree2891170f7705cf5e9d9dce017e49d735a15da201 /tests
parent804c0ac27bb011dc3e4a62b547c7cbed34666612 (diff)
downloadgstreamer-plugins-bad-1a455c25cd2328143d2aa87d9ab0cb61035fd511.tar.gz
tests: h264parser: add test to identify EOSEQ / EOS NALs.
Check that end_of_seq() [EOSEQ] and end_of_stream [EOS] NAL units are correctly parsed and the reported NAL unit size yields 1 byte, i.e. the only NalHeaderBytes in there. https://bugzilla.gnome.org/show_bug.cgi?id=732553 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/check/libs/h264parser.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/check/libs/h264parser.c b/tests/check/libs/h264parser.c
index 285a4f420..65fd0c73c 100644
--- a/tests/check/libs/h264parser.c
+++ b/tests/check/libs/h264parser.c
@@ -132,6 +132,18 @@ static guint8 slice_dpa[] = {
0x63, 0x72, 0x6f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02
};
+/* IDR slice, EOSEQ, IDR slice */
+static guint8 slice_eoseq_slice[] = {
+ 0x00, 0x00, 0x00, 0x01, 0x65, 0x88, 0x84, 0x00,
+ 0x10, 0xff, 0xfe, 0xf6, 0xf0, 0xfe, 0x05, 0x36,
+ 0x56, 0x04, 0x50, 0x96, 0x7b, 0x3f, 0x53, 0xe1,
+ 0x00, 0x00, 0x00, 0x01, 0x0a,
+ 0x00, 0x00, 0x00, 0x01, 0x65, 0x88, 0x84, 0x00,
+ 0x10, 0xff, 0xfe, 0xf6, 0xf0, 0xfe, 0x05, 0x36,
+ 0x56, 0x04, 0x50, 0x96, 0x7b, 0x3f, 0x53, 0xe1,
+ 0x00, 0x00, 0x00, 0x01, 0x0b
+};
+
GST_START_TEST (test_h264_parse_slice_dpa)
{
GstH264ParserResult res;
@@ -150,6 +162,55 @@ GST_START_TEST (test_h264_parse_slice_dpa)
GST_END_TEST;
+GST_START_TEST (test_h264_parse_slice_eoseq_slice)
+{
+ GstH264ParserResult res;
+ GstH264NalUnit nalu;
+ GstH264NalParser *const parser = gst_h264_nal_parser_new ();
+ const guint8 *buf = slice_eoseq_slice;
+ guint n, buf_size = sizeof (slice_eoseq_slice);
+
+ res = gst_h264_parser_identify_nalu (parser, buf, 0, buf_size, &nalu);
+
+ assert_equals_int (res, GST_H264_PARSER_OK);
+ assert_equals_int (nalu.type, GST_H264_NAL_SLICE_IDR);
+ assert_equals_int (nalu.size, 20);
+
+ n = nalu.offset + nalu.size;
+ buf += n;
+ buf_size -= n;
+
+ res = gst_h264_parser_identify_nalu (parser, buf, 0, buf_size, &nalu);
+
+ assert_equals_int (res, GST_H264_PARSER_OK);
+ assert_equals_int (nalu.type, GST_H264_NAL_SEQ_END);
+ assert_equals_int (nalu.size, 1);
+
+ n = nalu.offset + nalu.size;
+ buf += n;
+ buf_size -= n;
+
+ res = gst_h264_parser_identify_nalu (parser, buf, 0, buf_size, &nalu);
+
+ assert_equals_int (res, GST_H264_PARSER_OK);
+ assert_equals_int (nalu.type, GST_H264_NAL_SLICE_IDR);
+ assert_equals_int (nalu.size, 20);
+
+ n = nalu.offset + nalu.size;
+ buf += n;
+ buf_size -= n;
+
+ res = gst_h264_parser_identify_nalu (parser, buf, 0, buf_size, &nalu);
+
+ assert_equals_int (res, GST_H264_PARSER_OK);
+ assert_equals_int (nalu.type, GST_H264_NAL_STREAM_END);
+ assert_equals_int (nalu.size, 1);
+
+ gst_h264_nal_parser_free (parser);
+}
+
+GST_END_TEST;
+
static Suite *
h264parser_suite (void)
{
@@ -159,6 +220,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);
return s;
}