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.
This commit is contained in:
Sebastian Dröge 2010-05-10 12:44:41 +02:00
parent df5c772c44
commit 6914986cb3

View file

@ -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);