From f91baadfcd578246f61d362e199394f7d74019a8 Mon Sep 17 00:00:00 2001 From: Julien Moutte Date: Mon, 31 Jul 2006 16:50:27 +0000 Subject: ext/directfb/dfbvideosink.c: Don't try allocating if we are not setup yet. Fail changing state if setup fails. Original commit message from CVS: 2006-07-31 Julien MOUTTE * ext/directfb/dfbvideosink.c: (gst_dfbvideosink_change_state), (gst_dfbvideosink_buffer_alloc): Don't try allocating if we are not setup yet. Fail changing state if setup fails. --- ext/directfb/dfbvideosink.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'ext/directfb') diff --git a/ext/directfb/dfbvideosink.c b/ext/directfb/dfbvideosink.c index db51f7e9..8a56ecbe 100644 --- a/ext/directfb/dfbvideosink.c +++ b/ext/directfb/dfbvideosink.c @@ -1425,7 +1425,11 @@ gst_dfbvideosink_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_NULL_TO_READY: dfbvideosink->running = TRUE; if (!dfbvideosink->setup) { - gst_dfbvideosink_setup (dfbvideosink); + if (!gst_dfbvideosink_setup (dfbvideosink)) { + GST_DEBUG_OBJECT (dfbvideosink, "setup failed when changing state " + "from NULL to READY"); + return GST_STATE_CHANGE_FAILURE; + } } break; case GST_STATE_CHANGE_READY_TO_PAUSED: @@ -1697,6 +1701,12 @@ gst_dfbvideosink_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size, GST_DEBUG_OBJECT (dfbvideosink, "a buffer of %d bytes was requested " "with caps %" GST_PTR_FORMAT " and offset %llu", size, caps, offset); + if (G_UNLIKELY (!dfbvideosink->setup)) { + GST_DEBUG_OBJECT (dfbvideosink, "we are not setup yet, can't allocate!"); + *buf = NULL; + return ret; + } + desired_caps = gst_caps_copy (caps); structure = gst_caps_get_structure (desired_caps, 0); -- cgit v1.2.1