From 296e1bf3dd756c939a622422ced3e639fa0cce04 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 4 Apr 2012 09:33:30 +0200 Subject: [PATCH] rtpbuffer: removed old memory Ensure writability of rtp buffer and remove old memory first Fix some docs --- gst-libs/gst/rtp/gstrtpbuffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/rtp/gstrtpbuffer.c b/gst-libs/gst/rtp/gstrtpbuffer.c index 4cd24c3..e4752aa 100644 --- a/gst-libs/gst/rtp/gstrtpbuffer.c +++ b/gst-libs/gst/rtp/gstrtpbuffer.c @@ -92,7 +92,7 @@ typedef struct _GstRTPHeader * * Allocate enough data in @buffer to hold an RTP packet with @csrc_count CSRCs, * a payload length of @payload_len and padding of @pad_len. - * MALLOCDATA of @buffer will be overwritten and will not be freed. + * @buffer must be writable and all previous memory in @buffer will be freed. * All other RTP header fields will be set to 0/FALSE. */ void @@ -105,6 +105,9 @@ gst_rtp_buffer_allocate_data (GstBuffer * buffer, guint payload_len, g_return_if_fail (csrc_count <= 15); g_return_if_fail (GST_IS_BUFFER (buffer)); + g_return_if_fail (gst_buffer_is_writable (buffer)); + + gst_buffer_remove_all_memory (buffer); len = GST_RTP_HEADER_LEN + csrc_count * sizeof (guint32) + payload_len + pad_len; -- 2.7.4