[0.11] gst-plugins-base: rtcpbuffer: Don't try to modify read-only buffers

Olivier Crête tester at kemper.freedesktop.org
Sat Jan 28 08:51:29 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: ab359d36d5e0e980ce51863b3d592d975200998f
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=ab359d36d5e0e980ce51863b3d592d975200998f

Author: Olivier Crête <olivier.crete at collabora.com>
Date:   Thu Jan 26 18:24:20 2012 +0100

rtcpbuffer: Don't try to modify read-only buffers

---

 gst-libs/gst/rtp/gstrtcpbuffer.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/gst-libs/gst/rtp/gstrtcpbuffer.c b/gst-libs/gst/rtp/gstrtcpbuffer.c
index 317c35d..a37d65f 100644
--- a/gst-libs/gst/rtp/gstrtcpbuffer.c
+++ b/gst-libs/gst/rtp/gstrtcpbuffer.c
@@ -285,12 +285,15 @@ gst_rtcp_buffer_unmap (GstRTCPBuffer * rtcp)
   g_return_val_if_fail (rtcp != NULL, FALSE);
   g_return_val_if_fail (GST_IS_BUFFER (rtcp->buffer), FALSE);
 
-  /* move to the first free space */
-  if (gst_rtcp_buffer_get_first_packet (rtcp, &packet))
-    while (gst_rtcp_packet_move_to_next (&packet));
+  if (rtcp->map.flags & GST_MAP_WRITE) {
+    /* move to the first free space */
+    if (gst_rtcp_buffer_get_first_packet (rtcp, &packet))
+      while (gst_rtcp_packet_move_to_next (&packet));
+
+    /* shrink size */
+    gst_buffer_resize (rtcp->buffer, 0, packet.offset);
+  }
 
-  /* shrink size */
-  gst_buffer_resize (rtcp->buffer, 0, packet.offset);
   gst_buffer_unmap (rtcp->buffer, &rtcp->map);
   rtcp->buffer = NULL;
 



More information about the gstreamer-commits mailing list