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

This commit is contained in:
Olivier Crête 2012-01-26 18:24:20 +01:00
parent 30af2fe7d6
commit ab359d36d5

View file

@ -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;