diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2014-06-25 18:47:55 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2014-07-01 16:26:48 +0200 |
commit | fb2263632524296f499812cdc548f4b3f9a60dd9 (patch) | |
tree | ba71e97da91ea26bc4c62a2b9aa00efb8bb15230 /tests | |
parent | 7d44a51bfe6f54061956be9d31590fa11319a8ef (diff) | |
download | gstreamer-plugins-bad-fb2263632524296f499812cdc548f4b3f9a60dd9.tar.gz |
tests: h264parse: check SEI buffering_period() message is output.
If an SEI NAL unit with a buffering_period() message is inserted
between an SPS and PPS NAL unit, check that the output buffer still
contain it. i.e. make sure that this SEI message is not dropped.
https://bugzilla.gnome.org/show_bug.cgi?id=732156
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/elements/h264parse.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/tests/check/elements/h264parse.c b/tests/check/elements/h264parse.c index 895f74c3f..16ae5e8f6 100644 --- a/tests/check/elements/h264parse.c +++ b/tests/check/elements/h264parse.c @@ -71,6 +71,11 @@ static guint8 h264_pps[] = { 0x00, 0x00, 0x00, 0x01, 0x68, 0xeb, 0xec, 0xb2 }; +/* SEI buffering_period() message */ +static guint8 h264_sei_buffering_period[] = { + 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0x01, 0xc0 +}; + /* combines to this codec-data */ static guint8 h264_avc_codec_data[] = { 0x01, 0x4d, 0x40, 0x15, 0xff, 0xe1, 0x00, 0x17, @@ -116,10 +121,14 @@ verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer) if (vdata->discard) { /* check separate header NALs */ gint i = vdata->buffer_counter; + guint ofs; - fail_unless (i <= 1); - fail_unless (gst_buffer_get_size (buffer) == ctx_headers[i].size); - fail_unless (gst_buffer_memcmp (buffer, 0, ctx_headers[i].data, + /* SEI with start code prefix with 2 0-bytes */ + ofs = i == 1; + + fail_unless (i <= 2); + fail_unless (gst_buffer_get_size (buffer) == ctx_headers[i].size - ofs); + fail_unless (gst_buffer_memcmp (buffer, 0, ctx_headers[i].data + ofs, gst_buffer_get_size (buffer)) == 0); } else { GstMapInfo map; @@ -145,7 +154,7 @@ verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer) guint8 *data = map.data; fail_unless (map.size == vdata->data_to_verify_size + - ctx_headers[0].size + ctx_headers[1].size); + ctx_headers[0].size + ctx_headers[1].size + ctx_headers[2].size); fail_unless (GST_READ_UINT32_BE (data) == ctx_headers[0].size - 4); fail_unless (memcmp (data + 4, ctx_headers[0].data + 4, ctx_headers[0].size - 4) == 0); @@ -154,6 +163,10 @@ verify_buffer (buffer_verify_data_s * vdata, GstBuffer * buffer) fail_unless (memcmp (data + 4, ctx_headers[1].data + 4, ctx_headers[1].size - 4) == 0); data += ctx_headers[1].size; + fail_unless (GST_READ_UINT32_BE (data) == ctx_headers[2].size - 4); + fail_unless (memcmp (data + 4, ctx_headers[2].data + 4, + ctx_headers[2].size - 4) == 0); + data += ctx_headers[2].size; fail_unless (GST_READ_UINT32_BE (data) == vdata->data_to_verify_size - 4); fail_unless (memcmp (data + 4, vdata->data_to_verify + 4, vdata->data_to_verify_size - 4) == 0); @@ -380,11 +393,13 @@ main (int argc, char **argv) ctx_src_template = &srctemplate; ctx_headers[0].data = h264_sps; ctx_headers[0].size = sizeof (h264_sps); - ctx_headers[1].data = h264_pps; - ctx_headers[1].size = sizeof (h264_pps); + ctx_headers[1].data = h264_sei_buffering_period; + ctx_headers[1].size = sizeof (h264_sei_buffering_period); + ctx_headers[2].data = h264_pps; + ctx_headers[2].size = sizeof (h264_pps); ctx_verify_buffer = verify_buffer; /* discard initial sps/pps buffers */ - ctx_discard = 2; + ctx_discard = 3; /* no timing info to parse */ ctx_no_metadata = TRUE; ctx_codec_data = FALSE; @@ -436,8 +451,10 @@ main (int argc, char **argv) /* no more config headers */ ctx_headers[0].data = NULL; ctx_headers[1].data = NULL; + ctx_headers[2].data = NULL; ctx_headers[0].size = 0; ctx_headers[1].size = 0; + ctx_headers[2].size = 0; /* and need adapter buffer check */ ctx_verify_buffer = verify_buffer_packetized; |