tests/check/libs/rtp.c: Add check for RTP buffer defaults, padding and marker bit API.

Original commit message from CVS:
* tests/check/libs/rtp.c: (GST_START_TEST):
Add check for RTP buffer defaults, padding and marker bit API.
This commit is contained in:
Wim Taymans 2008-02-27 10:55:03 +00:00
parent 07cd425c25
commit 5c1a648f83
2 changed files with 33 additions and 3 deletions

View file

@ -1,3 +1,8 @@
2008-02-27 Wim Taymans <wim.taymans@collabora.co.uk>
* tests/check/libs/rtp.c: (GST_START_TEST):
Add check for RTP buffer defaults, padding and marker bit API.
2008-02-27 Sebastian Dröge <slomo@circular-chaos.org> 2008-02-27 Sebastian Dröge <slomo@circular-chaos.org>
* gst-libs/gst/cdda/sha1.c: (sha_transform): * gst-libs/gst/cdda/sha1.c: (sha_transform):

View file

@ -40,13 +40,38 @@ GST_START_TEST (test_rtp_buffer)
fail_unless_equals_int (GST_BUFFER_SIZE (buf), RTP_HEADER_LEN + 16 + 4); fail_unless_equals_int (GST_BUFFER_SIZE (buf), RTP_HEADER_LEN + 16 + 4);
data = GST_BUFFER_DATA (buf); data = GST_BUFFER_DATA (buf);
/* check defaults */
fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 2);
fail_unless (gst_rtp_buffer_get_padding (buf) == FALSE);
fail_unless (gst_rtp_buffer_get_extension (buf) == FALSE);
fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 0);
fail_unless (gst_rtp_buffer_get_marker (buf) == FALSE);
fail_unless (gst_rtp_buffer_get_payload_type (buf) == 0);
fail_unless_equals_int (GST_READ_UINT16_BE (data), 0x8000);
/* check version in bitfield */ /* check version in bitfield */
gst_rtp_buffer_set_version (buf, 3); gst_rtp_buffer_set_version (buf, 3);
fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 3); fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 3);
fail_unless_equals_int ((data[0] & 0xC0) >> 6, 3); fail_unless_equals_int ((data[0] & 0xC0) >> 6, 3);
gst_rtp_buffer_set_version (buf, 0); gst_rtp_buffer_set_version (buf, 2);
fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 0); fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 2);
fail_unless_equals_int ((data[0] & 0xC0) >> 6, 0); fail_unless_equals_int ((data[0] & 0xC0) >> 6, 2);
/* check padding bit */
gst_rtp_buffer_set_padding (buf, TRUE);
fail_unless (gst_rtp_buffer_get_padding (buf) == TRUE);
fail_unless_equals_int ((data[0] & 0x20) >> 5, 1);
gst_rtp_buffer_set_padding (buf, FALSE);
fail_unless (gst_rtp_buffer_get_padding (buf) == FALSE);
fail_unless_equals_int ((data[0] & 0x20) >> 5, 0);
/* check marker bit */
gst_rtp_buffer_set_marker (buf, TRUE);
fail_unless (gst_rtp_buffer_get_marker (buf) == TRUE);
fail_unless_equals_int ((data[1] & 0x80) >> 7, 1);
gst_rtp_buffer_set_marker (buf, FALSE);
fail_unless (gst_rtp_buffer_get_marker (buf) == FALSE);
fail_unless_equals_int ((data[1] & 0x80) >> 7, 0);
/* check sequence offset */ /* check sequence offset */
gst_rtp_buffer_set_seq (buf, 0xF2C9); gst_rtp_buffer_set_seq (buf, 0xF2C9);