From c47c410e7b86075cc48fbe2470f953027bcd70b1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 10 Sep 2012 13:35:15 +0200 Subject: [PATCH] pulsesrc: consider stream alive when not connected yet When we start and renegotiate, there is a moment where the stream is created but not yet connected. Make sure all functions deal with this situation correctly instead of erroring out. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=681247 --- ext/pulse/pulsesrc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ext/pulse/pulsesrc.c b/ext/pulse/pulsesrc.c index 02a914c..4a6e0f4 100644 --- a/ext/pulse/pulsesrc.c +++ b/ext/pulse/pulsesrc.c @@ -366,6 +366,9 @@ gst_pulsesrc_finalize (GObject * object) static gboolean gst_pulsesrc_is_dead (GstPulseSrc * pulsesrc, gboolean check_stream) { + if (!pulsesrc->stream_connected) + return TRUE; + if (!CONTEXT_OK (pulsesrc->context)) goto error; @@ -1004,6 +1007,9 @@ gst_pulsesrc_read (GstAudioSrc * asrc, gpointer data, guint length, pa_threaded_mainloop_lock (pulsesrc->mainloop); pulsesrc->in_read = TRUE; + if (!pulsesrc->stream_connected) + goto not_connected; + if (pulsesrc->paused) goto was_paused; @@ -1069,6 +1075,11 @@ gst_pulsesrc_read (GstAudioSrc * asrc, gpointer data, guint length, return sum; /* ERRORS */ +not_connected: + { + GST_LOG_OBJECT (pulsesrc, "we are not connected"); + goto unlock_and_fail; + } was_paused: { GST_LOG_OBJECT (pulsesrc, "we are paused"); -- 2.7.4