From e33b73f9df5bffd75f66d81f2077ff399a290899 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 28 Mar 2011 18:42:09 +0200 Subject: [PATCH] tests: fix RTP and RTCP unit tests --- gst-libs/gst/rtp/gstrtcpbuffer.c | 4 +--- gst-libs/gst/rtp/gstrtpbuffer.c | 9 +++++---- gst-libs/gst/rtp/gstrtpbuffer.h | 6 +----- tests/check/libs/rtp.c | 6 +++--- 4 files changed, 10 insertions(+), 15 deletions(-) diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.c b/gst-libs/gst/rtp/gstrtcpbuffer.c index eea15a3ac3..07a1b79fba 100644 --- a/gst-libs/gst/rtp/gstrtcpbuffer.c +++ b/gst-libs/gst/rtp/gstrtcpbuffer.c @@ -287,9 +287,7 @@ gst_rtcp_buffer_unmap (GstRTCPBuffer * rtcp) while (gst_rtcp_packet_move_to_next (&packet)); /* shrink size */ - gst_buffer_set_size (rtcp->buffer, packet.offset); - - res = gst_buffer_unmap (rtcp->buffer, rtcp->data, rtcp->size); + res = gst_buffer_unmap (rtcp->buffer, rtcp->data, packet.offset); rtcp->buffer = NULL; return res; diff --git a/gst-libs/gst/rtp/gstrtpbuffer.c b/gst-libs/gst/rtp/gstrtpbuffer.c index d802e2e2af..02bc1df67a 100644 --- a/gst-libs/gst/rtp/gstrtpbuffer.c +++ b/gst-libs/gst/rtp/gstrtpbuffer.c @@ -427,20 +427,21 @@ gboolean gst_rtp_buffer_map (GstBuffer * buffer, GstMapFlags flags, GstRTPBuffer * rtp) { guint8 *data; - gsize size; + gsize size, maxsize; g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE); g_return_val_if_fail (rtp != NULL, FALSE); g_return_val_if_fail (rtp->buffer == NULL, FALSE); - data = gst_buffer_map (buffer, &size, NULL, flags); + data = gst_buffer_map (buffer, &size, &maxsize, flags); if (data == NULL) return FALSE; rtp->buffer = buffer; rtp->flags = flags; rtp->data = data; - rtp->data_size = size; + rtp->size = size; + rtp->maxsize = maxsize; return TRUE; } @@ -451,7 +452,7 @@ gst_rtp_buffer_unmap (GstRTPBuffer * rtp) g_return_val_if_fail (rtp != NULL, FALSE); g_return_val_if_fail (rtp->buffer != NULL, FALSE); - gst_buffer_unmap (rtp->buffer, rtp->data, rtp->data_size); + gst_buffer_unmap (rtp->buffer, rtp->data, rtp->size); rtp->buffer = NULL; diff --git a/gst-libs/gst/rtp/gstrtpbuffer.h b/gst-libs/gst/rtp/gstrtpbuffer.h index 71fc952c07..b40e7149bf 100644 --- a/gst-libs/gst/rtp/gstrtpbuffer.h +++ b/gst-libs/gst/rtp/gstrtpbuffer.h @@ -50,13 +50,9 @@ struct _GstRTPBuffer { GstBuffer *buffer; GstMapFlags flags; + guint8 *data; gsize size; gsize maxsize; - - guint8 *data; - gsize data_size; - guint8 *payload; - gsize payload_size; }; /* creating buffers */ diff --git a/tests/check/libs/rtp.c b/tests/check/libs/rtp.c index b0802fc728..a8346c4fdf 100644 --- a/tests/check/libs/rtp.c +++ b/tests/check/libs/rtp.c @@ -35,7 +35,7 @@ GST_START_TEST (test_rtp_buffer) GstBuffer *buf; guint8 *data; gsize size; - GstRTPBuffer rtp; + GstRTPBuffer rtp = { NULL, }; /* check GstRTPHeader structure alignment and packing */ buf = gst_rtp_buffer_new_allocate (16, 4, 0); @@ -225,7 +225,7 @@ GST_START_TEST (test_rtp_buffer_set_extension_data) gpointer pointer; guint8 appbits; gsize bsize; - GstRTPBuffer rtp; + GstRTPBuffer rtp = { NULL, }; /* check GstRTPHeader structure alignment and packing */ buf = gst_rtp_buffer_new_allocate (4, 0, 0); @@ -676,7 +676,7 @@ GST_START_TEST (test_rtcp_buffer) GstRTCPPacket packet; guint8 *data; gsize size; - GstRTCPBuffer rtcp; + GstRTCPBuffer rtcp = { NULL, }; buf = gst_rtcp_buffer_new (1400); fail_unless (buf != NULL);