sys/ximage/ximagesink.c (gst_ximagesink_renegotiate_size): Protect the height, width, and desired_caps with the pool_...

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.
This commit is contained in:
Andy Wingo 2005-08-03 16:44:18 +00:00
parent 443cfe920e
commit 306ae5611c
2 changed files with 15 additions and 2 deletions

View file

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

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