sys/ximage/ximagesink.c (gst_ximagesink_renegotiate_size): Protect the height, width...
authorAndy Wingo <wingo@pobox.com>
Wed, 3 Aug 2005 16:44:18 +0000 (16:44 +0000)
committerAndy Wingo <wingo@pobox.com>
Wed, 3 Aug 2005 16:44:18 +0000 (16:44 +0000)
Original commit message from CVS:
2005-08-03  Andy Wingo  <wingo@pobox.com>

* sys/ximage/ximagesink.c (gst_ximagesink_renegotiate_size):
(gst_ximagesink_buffer_alloc):
Protect the height, width, and desired_caps with the pool_lock.
Fixes videotestsrc ! queue ! ximagesink.

ChangeLog
sys/ximage/ximagesink.c

index 355f6bd..089ecc4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-08-03  Andy Wingo  <wingo@pobox.com>
+
+       * sys/ximage/ximagesink.c (gst_ximagesink_renegotiate_size):
+       (gst_ximagesink_buffer_alloc): 
+       Protect the height, width, and desired_caps with the pool_lock.
+       Fixes videotestsrc ! queue ! ximagesink.
+
 2005-08-02  Edward Hervey  <edward@fluendo.com>
 
        * gst/volume/gstvolume.c:
index ba31d18..6303bd5 100644 (file)
@@ -653,10 +653,14 @@ gst_ximagesink_renegotiate_size (GstXImageSink * ximagesink)
     }
 
     if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (ximagesink), caps)) {
+      g_mutex_lock (ximagesink->pool_lock);
+
       gst_caps_replace (&ximagesink->desired_caps, caps);
       GST_VIDEO_SINK_WIDTH (ximagesink) = ximagesink->xwindow->width;
       GST_VIDEO_SINK_HEIGHT (ximagesink) = ximagesink->xwindow->height;
 
+      g_mutex_unlock (ximagesink->pool_lock);
+
       if (ximagesink->ximage) {
         GST_DEBUG_OBJECT (ximagesink, "destroying and recreating our ximage");
         gst_ximagesink_ximage_destroy (ximagesink, ximagesink->ximage);
@@ -1335,8 +1339,6 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
     }
   }
 
-  g_mutex_unlock (ximagesink->pool_lock);
-
   if (!ximage) {
     /* We found no suitable image in the pool. Creating... */
     gint height, width;
@@ -1357,9 +1359,13 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
     if (ximagesink->desired_caps)
       gst_buffer_set_caps (GST_BUFFER (ximage), ximagesink->desired_caps);
     else
+      /* fixme we have no guarantee that the ximage is actually of these caps,
+         do we? */
       gst_buffer_set_caps (GST_BUFFER (ximage), caps);
   }
 
+  g_mutex_unlock (ximagesink->pool_lock);
+
   *buf = GST_BUFFER (ximage);
 
   return GST_FLOW_OK;