From 5c1a648f83163e76b6142a3ec10482b0e102eda0 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 27 Feb 2008 10:55:03 +0000 Subject: [PATCH] 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. --- ChangeLog | 5 +++++ tests/check/libs/rtp.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 79dbeeb9ca..24465098da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2008-02-27 Wim Taymans + + * 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 * gst-libs/gst/cdda/sha1.c: (sha_transform): diff --git a/tests/check/libs/rtp.c b/tests/check/libs/rtp.c index 757f00b3de..04f981054f 100644 --- a/tests/check/libs/rtp.c +++ b/tests/check/libs/rtp.c @@ -40,13 +40,38 @@ GST_START_TEST (test_rtp_buffer) fail_unless_equals_int (GST_BUFFER_SIZE (buf), RTP_HEADER_LEN + 16 + 4); 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 */ gst_rtp_buffer_set_version (buf, 3); fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 3); fail_unless_equals_int ((data[0] & 0xC0) >> 6, 3); - gst_rtp_buffer_set_version (buf, 0); - fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 0); - fail_unless_equals_int ((data[0] & 0xC0) >> 6, 0); + gst_rtp_buffer_set_version (buf, 2); + fail_unless_equals_int (gst_rtp_buffer_get_version (buf), 2); + 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 */ gst_rtp_buffer_set_seq (buf, 0xF2C9);