From: Andy Wingo Date: Wed, 3 Aug 2005 16:44:18 +0000 (+0000) Subject: sys/ximage/ximagesink.c (gst_ximagesink_renegotiate_size): Protect the height, width... X-Git-Tag: 1.19.3~511^2~12885 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=306ae5611ca087f83f92c7b5c379c6c98e74a160;p=platform%2Fupstream%2Fgstreamer.git 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 * 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. --- diff --git a/ChangeLog b/ChangeLog index 355f6bd..089ecc4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-08-03 Andy Wingo + + * 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 * gst/volume/gstvolume.c: diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index ba31d18..6303bd5 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -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;