? pad-caps-lock.diff
Index: gstbasetransform.c
===================================================================
RCS file: /cvs/gstreamer/gstreamer/libs/gst/base/gstbasetransform.c,v
retrieving revision 1.123
diff -u -p -r1.123 gstbasetransform.c
--- gstbasetransform.c	20 Aug 2008 10:52:08 -0000	1.123
+++ gstbasetransform.c	20 Aug 2008 22:52:32 -0000
@@ -1068,7 +1068,7 @@ gst_base_transform_prepare_output_buffer
   GstFlowReturn ret = GST_FLOW_OK;
   guint outsize, newsize, expsize;
   gboolean discard;
-  GstCaps *incaps, *oldcaps, *newcaps;
+  GstCaps *incaps, *oldcaps, *newcaps, *tmpcaps;
 
   bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
 
@@ -1108,7 +1108,9 @@ gst_base_transform_prepare_output_buffer
     }
   }
 
-  oldcaps = GST_PAD_CAPS (trans->srcpad);
+  GST_OBJECT_LOCK (trans->srcpad);
+  oldcaps = gst_caps_ref (GST_PAD_CAPS (trans->srcpad));
+  GST_OBJECT_UNLOCK (trans->srcpad);
 
   if (bclass->prepare_output_buffer) {
     GST_DEBUG_OBJECT (trans,
@@ -1149,7 +1151,9 @@ gst_base_transform_prepare_output_buffer
 
     GST_DEBUG_OBJECT (trans, "received new caps %" GST_PTR_FORMAT, newcaps);
 
-    incaps = GST_PAD_CAPS (trans->sinkpad);
+    GST_OBJECT_LOCK (trans);
+    incaps = gst_caps_ref (GST_PAD_CAPS (trans->sinkpad));
+    GST_OBJECT_UNLOCK (trans);
 
     /* it's possible that the buffer we got is of the wrong size, get the
      * expected size here, we will check the size if we are going to use the
@@ -1255,7 +1259,12 @@ gst_base_transform_prepare_output_buffer
           GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS);
     }
   }
-  gst_buffer_set_caps (*out_buf, GST_PAD_CAPS (trans->srcpad));
+
+  GST_OBJECT_LOCK (trans->srcpad);
+  tmpcaps = gst_caps_ref (GST_PAD_CAPS (trans->srcpad));
+  GST_OBJECT_UNLOCK (trans->srcpad);
+  gst_buffer_set_caps (*out_buf, tmpcaps);
+  gst_caps_unref (tmpcaps);
 
   /* clear the GAP flag when the subclass does not understand it */
   if (!trans->priv->gap_aware)
@@ -1953,12 +1962,14 @@ gst_base_transform_activate (GstBaseTran
 
     GST_OBJECT_LOCK (trans);
 
+    GST_OBJECT_LOCK (trans->sinkpad);
     if (GST_PAD_CAPS (trans->sinkpad) && GST_PAD_CAPS (trans->srcpad))
       trans->have_same_caps =
           gst_caps_is_equal (GST_PAD_CAPS (trans->sinkpad),
           GST_PAD_CAPS (trans->srcpad)) || trans->passthrough;
     else
       trans->have_same_caps = trans->passthrough;
+    GST_OBJECT_UNLOCK (trans->sinkpad);
     GST_DEBUG_OBJECT (trans, "have_same_caps %d", trans->have_same_caps);
     trans->negotiated = FALSE;
     trans->have_newsegment = FALSE;
