diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2010-05-10 12:44:41 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2010-05-10 12:44:41 +0200 |
commit | 6914986cb3b68465e0d9381ba7027c7321eeda8e (patch) | |
tree | 815ac295da7274f8b27bd4983283eb8e5738d041 | |
parent | df5c772c44ef798b5d4b56b4b860f064e61ae243 (diff) |
ximagesink: Check if the X context is allocated before using it
It should be allocated at these places already or the state changes
would have failed... but better add an additional check here.
-rw-r--r-- | sys/ximage/ximagesink.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index 713615c4e..f8bcf578e 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -1658,6 +1658,11 @@ gst_ximagesink_show_frame (GstVideoSink * vsink, GstBuffer * buf) ximagesink = GST_XIMAGESINK (vsink); + /* This shouldn't really happen because state changes will fail + * if the xcontext can't be allocated */ + if (!ximagesink->xcontext) + return GST_FLOW_ERROR; + /* If this buffer has been allocated using our buffer management we simply put the ximage which is in the PRIVATE pointer */ if (GST_IS_XIMAGE_BUFFER (buf)) { @@ -1768,6 +1773,11 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, ximagesink = GST_XIMAGESINK (bsink); + /* This shouldn't really happen because state changes will fail + * if the xcontext can't be allocated */ + if (!ximagesink->xcontext) + return GST_FLOW_ERROR; + GST_LOG_OBJECT (ximagesink, "a buffer of %d bytes was requested with caps %" GST_PTR_FORMAT " and offset %" G_GUINT64_FORMAT, size, caps, offset); |