From 75c337c72607892129de7f765c7410e8b7eec131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 18 Apr 2011 11:24:57 +0200 Subject: [PATCH] x(v)imagesink: If NULL caps are passed to buffer_alloc() do fallback allocation Fixes bug #647857. --- sys/ximage/ximagesink.c | 7 +++++++ sys/xvimage/xvimagesink.c | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/sys/ximage/ximagesink.c b/sys/ximage/ximagesink.c index d1780fcf51..99ad35b350 100644 --- a/sys/ximage/ximagesink.c +++ b/sys/ximage/ximagesink.c @@ -1779,6 +1779,13 @@ gst_ximagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, ximagesink = GST_XIMAGESINK (bsink); + if (G_UNLIKELY (!caps)) { + GST_WARNING_OBJECT (ximagesink, "have no caps, doing fallback allocation"); + *buf = NULL; + ret = GST_FLOW_OK; + goto beach; + } + /* This shouldn't really happen because state changes will fail * if the xcontext can't be allocated */ if (!ximagesink->xcontext) diff --git a/sys/xvimage/xvimagesink.c b/sys/xvimage/xvimagesink.c index 51b2d9cf4e..30368d51f0 100644 --- a/sys/xvimage/xvimagesink.c +++ b/sys/xvimage/xvimagesink.c @@ -2508,6 +2508,9 @@ gst_xvimagesink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, xvimagesink = GST_XVIMAGESINK (bsink); + if (G_UNLIKELY (!caps)) + goto no_caps; + g_mutex_lock (xvimagesink->pool_lock); if (G_UNLIKELY (xvimagesink->pool_invalid)) goto invalid; @@ -2701,6 +2704,13 @@ invalid_caps: g_mutex_unlock (xvimagesink->pool_lock); goto beach; } +no_caps: + { + GST_WARNING_OBJECT (xvimagesink, "have no caps, doing fallback allocation"); + *buf = NULL; + ret = GST_FLOW_OK; + goto beach; + } } /* Interfaces stuff */