mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-07 11:12:17 +00:00
Fix gst_rtp_buffer_set_csrc() and enable csrc-related unit test checks.
Original commit message from CVS: * gst-libs/gst/rtp/gstrtpbuffer.c: * tests/check/libs/rtp.c: Fix gst_rtp_buffer_set_csrc() and enable csrc-related unit test checks.
This commit is contained in:
parent
b2948f2453
commit
03992b8779
3 changed files with 37 additions and 33 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2007-09-07 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst-libs/gst/rtp/gstrtpbuffer.c:
|
||||||
|
* tests/check/libs/rtp.c:
|
||||||
|
Fix gst_rtp_buffer_set_csrc() and enable csrc-related unit test checks.
|
||||||
|
|
||||||
2007-09-07 Tim-Philipp Müller <tim at centricular dot net>
|
2007-09-07 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
Based on patch by: Haakon Sporsheim <haakon.sporsheim at tandberg com>
|
Based on patch by: Haakon Sporsheim <haakon.sporsheim at tandberg com>
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include "gstrtpbuffer.h"
|
#include "gstrtpbuffer.h"
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define GST_RTP_HEADER_LEN 12
|
#define GST_RTP_HEADER_LEN 12
|
||||||
|
|
||||||
|
@ -115,7 +116,9 @@ gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len,
|
||||||
GST_RTP_HEADER_VERSION (buffer) = GST_RTP_VERSION;
|
GST_RTP_HEADER_VERSION (buffer) = GST_RTP_VERSION;
|
||||||
GST_RTP_HEADER_PADDING (buffer) = FALSE;
|
GST_RTP_HEADER_PADDING (buffer) = FALSE;
|
||||||
GST_RTP_HEADER_EXTENSION (buffer) = FALSE;
|
GST_RTP_HEADER_EXTENSION (buffer) = FALSE;
|
||||||
GST_RTP_HEADER_CSRC_COUNT (buffer) = 0; /* FIXME: not csrc_count? */
|
GST_RTP_HEADER_CSRC_COUNT (buffer) = csrc_count;
|
||||||
|
memset (GST_RTP_HEADER_CSRC_LIST_OFFSET (buffer, 0), 0,
|
||||||
|
csrc_count * sizeof (guint32));
|
||||||
GST_RTP_HEADER_MARKER (buffer) = FALSE;
|
GST_RTP_HEADER_MARKER (buffer) = FALSE;
|
||||||
GST_RTP_HEADER_PAYLOAD_TYPE (buffer) = 0;
|
GST_RTP_HEADER_PAYLOAD_TYPE (buffer) = 0;
|
||||||
GST_RTP_HEADER_SEQ (buffer) = 0;
|
GST_RTP_HEADER_SEQ (buffer) = 0;
|
||||||
|
|
|
@ -35,10 +35,9 @@ GST_START_TEST (test_rtp_buffer)
|
||||||
guint8 *data;
|
guint8 *data;
|
||||||
|
|
||||||
/* check GstRTPHeader structure alignment and packing */
|
/* check GstRTPHeader structure alignment and packing */
|
||||||
buf = gst_rtp_buffer_new_allocate (16, 4, 3);
|
buf = gst_rtp_buffer_new_allocate (16, 4, 0);
|
||||||
fail_unless (buf != NULL);
|
fail_unless (buf != NULL);
|
||||||
fail_unless_equals_int (GST_BUFFER_SIZE (buf),
|
fail_unless_equals_int (GST_BUFFER_SIZE (buf), RTP_HEADER_LEN + 16 + 4);
|
||||||
RTP_HEADER_LEN + 16 + 4 + 4 * 3);
|
|
||||||
data = GST_BUFFER_DATA (buf);
|
data = GST_BUFFER_DATA (buf);
|
||||||
|
|
||||||
/* check version in bitfield */
|
/* check version in bitfield */
|
||||||
|
@ -72,41 +71,37 @@ GST_START_TEST (test_rtp_buffer)
|
||||||
gst_rtp_buffer_set_ssrc (buf, 0);
|
gst_rtp_buffer_set_ssrc (buf, 0);
|
||||||
fail_unless_equals_int (gst_rtp_buffer_get_ssrc (buf), 0);
|
fail_unless_equals_int (gst_rtp_buffer_get_ssrc (buf), 0);
|
||||||
fail_unless_equals_int (GST_READ_UINT32_BE (data + 4 + 4), 0);
|
fail_unless_equals_int (GST_READ_UINT32_BE (data + 4 + 4), 0);
|
||||||
|
|
||||||
|
/* check csrc bits */
|
||||||
|
fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 0);
|
||||||
|
ASSERT_CRITICAL (gst_rtp_buffer_get_csrc (buf, 0));
|
||||||
|
fail_unless_equals_int (data[0] & 0xf, 0);
|
||||||
gst_buffer_unref (buf);
|
gst_buffer_unref (buf);
|
||||||
|
|
||||||
/* FIXME: this is broken, the _set_csrc doesn't work because the csrc count
|
|
||||||
* is initialised to 0 and _set_csrc() then has an assertion to make sure
|
|
||||||
* index is < the value in the struct ... */
|
|
||||||
#if 0
|
|
||||||
/* and again, this time with CSRCs */
|
/* and again, this time with CSRCs */
|
||||||
{
|
buf = gst_rtp_buffer_new_allocate (16, 4, 3);
|
||||||
volatile guint32 ret;
|
fail_unless (buf != NULL);
|
||||||
|
fail_unless_equals_int (GST_BUFFER_SIZE (buf),
|
||||||
|
RTP_HEADER_LEN + 16 + 4 + 4 * 3);
|
||||||
|
|
||||||
buf = gst_rtp_buffer_new_allocate (16, 4, 3);
|
data = GST_BUFFER_DATA (buf);
|
||||||
fail_unless (buf != NULL);
|
|
||||||
fail_unless_equals_int (GST_BUFFER_SIZE (buf),
|
|
||||||
RTP_HEADER_LEN + 16 + 4 + 4 * 3);
|
|
||||||
|
|
||||||
data = GST_BUFFER_DATA (buf);
|
fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 3);
|
||||||
|
ASSERT_CRITICAL (gst_rtp_buffer_get_csrc (buf, 3));
|
||||||
|
fail_unless_equals_int (data[0] & 0xf, 3);
|
||||||
|
fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 0), 0);
|
||||||
|
fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 1), 0);
|
||||||
|
fail_unless_equals_int (gst_rtp_buffer_get_csrc (buf, 2), 0);
|
||||||
|
|
||||||
/* the default value is 0, because we haven't set any yet (FIXME?) */
|
data += RTP_HEADER_LEN; /* skip the other header stuff */
|
||||||
fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 0);
|
gst_rtp_buffer_set_csrc (buf, 0, 0xf7c0);
|
||||||
ASSERT_CRITICAL (ret = gst_rtp_buffer_get_csrc (buf, 0));
|
fail_unless_equals_int (GST_READ_UINT32_BE (data + 0 * 4), 0xf7c0);
|
||||||
|
gst_rtp_buffer_set_csrc (buf, 1, 0xf7c1);
|
||||||
data += RTP_HEADER_LEN; /* skip the other header stuff */
|
fail_unless_equals_int (GST_READ_UINT32_BE (data + 1 * 4), 0xf7c1);
|
||||||
gst_rtp_buffer_set_csrc (buf, 0, 0xf7c0);
|
gst_rtp_buffer_set_csrc (buf, 2, 0xf7c2);
|
||||||
fail_unless_equals_int (GST_READ_UINT32_BE (data + 0 * 4), 0xf7c0);
|
fail_unless_equals_int (GST_READ_UINT32_BE (data + 2 * 4), 0xf7c2);
|
||||||
fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 1); /* FIXME? */
|
ASSERT_CRITICAL (gst_rtp_buffer_set_csrc (buf, 3, 0xf123));
|
||||||
gst_rtp_buffer_set_csrc (buf, 1, 0xf7c1);
|
gst_buffer_unref (buf);
|
||||||
fail_unless_equals_int (GST_READ_UINT32_BE (data + 1 * 4), 0xf7c1);
|
|
||||||
fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 2); /* FIXME? */
|
|
||||||
gst_rtp_buffer_set_csrc (buf, 2, 0xf7c2);
|
|
||||||
fail_unless_equals_int (GST_READ_UINT32_BE (data + 2 * 4), 0xf7c2);
|
|
||||||
fail_unless_equals_int (gst_rtp_buffer_get_csrc_count (buf), 3); /* FIXME? */
|
|
||||||
ASSERT_CRITICAL (gst_rtp_buffer_set_csrc (buf, 3, 0xf123));
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
Loading…
Reference in a new issue