gstbuffer: add additional checking for writability

Check for metadata writability when setting caps on buffer or when copying
metadata flags. Only enable these extra assertions in git versions.
This should help us find bad elements.
This commit is contained in:
Wim Taymans 2009-08-06 18:47:32 +02:00
parent 06cc1d1d58
commit aa33db85cc

View file

@ -197,6 +197,11 @@ gst_buffer_copy_metadata (GstBuffer * dest, const GstBuffer * src,
if (G_UNLIKELY (dest == src))
return;
#if GST_VERSION_NANO == 1
/* we enable this extra debugging in git versions only for now */
g_return_if_fail (gst_buffer_is_metadata_writable (dest));
#endif
GST_CAT_LOG (GST_CAT_BUFFER, "copy %p to %p", src, dest);
if (flags & GST_BUFFER_COPY_FLAGS) {
@ -395,6 +400,10 @@ void
gst_buffer_set_caps (GstBuffer * buffer, GstCaps * caps)
{
g_return_if_fail (buffer != NULL);
#if GST_VERSION_NANO == 1
/* we enable this extra debugging in git versions only for now */
g_return_if_fail (gst_buffer_is_metadata_writable (buffer));
#endif
gst_caps_replace (&GST_BUFFER_CAPS (buffer), caps);
}