rtpsession: Make rtcp buffer metadata writable after processing it
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>
Tue, 7 Sep 2010 10:35:16 +0000 (13:35 +0300)
committerWim Taymans <wim.taymans@collabora.co.uk>
Tue, 1 Feb 2011 17:28:50 +0000 (18:28 +0100)
Functions that process the rtcp buffer could decide to keep a ref
on the buffer for further processing. So make the metadata writable
only after they are done.

gst/rtpmanager/rtpsession.c

index d4bbf08..5938d55 100644 (file)
@@ -2048,9 +2048,6 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer,
   if (sess->sent_bye)
     goto ignore;
 
-  /* make writable, we might want to change the buffer */
-  buffer = gst_buffer_make_metadata_writable (buffer);
-
   /* start processing the compound packet */
   more = gst_rtcp_buffer_get_first_packet (buffer, &packet);
   while (more) {
@@ -2111,10 +2108,13 @@ rtp_session_process_rtcp (RTPSession * sess, GstBuffer * buffer,
   RTP_SESSION_UNLOCK (sess);
 
   /* notify caller of sr packets in the callback */
-  if (do_sync && sess->callbacks.sync_rtcp)
+  if (do_sync && sess->callbacks.sync_rtcp) {
+    /* make writable, we might want to change the buffer */
+    buffer = gst_buffer_make_metadata_writable (buffer);
+
     result = sess->callbacks.sync_rtcp (sess, sess->source, buffer,
         sess->sync_rtcp_user_data);
-  else
+  else
     gst_buffer_unref (buffer);
 
   return result;