From: Jan Schmidt Date: Sun, 13 Jun 2004 10:58:34 +0000 (+0000) Subject: ext/esd/esdsink.*: Close the esd connection on pause, because esd will just wait... X-Git-Tag: BRANCH-GSTREAMER-0_8-ROOT~946 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3deeade47c524006c5477073c02b56d50826f85;p=platform%2Fupstream%2Fgst-plugins-good.git ext/esd/esdsink.*: Close the esd connection on pause, because esd will just wait - blocking all other esd clients ind... Original commit message from CVS: * ext/esd/esdsink.c: (gst_esdsink_change_state): * ext/esd/esdsink.h: Close the esd connection on pause, because esd will just wait - blocking all other esd clients indefinitely. --- diff --git a/ChangeLog b/ChangeLog index 9638007..0bbf50b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-06-13 Jan Schmidt + * ext/esd/esdsink.c: (gst_esdsink_change_state): + * ext/esd/esdsink.h: + Close the esd connection on pause, because esd will just wait - + blocking all other esd clients indefinitely. + 2004-06-12 Christophe Fergeau * gst/tags/gstvorbistag.c: replaced a g_warning which I added in my diff --git a/ext/esd/esdsink.c b/ext/esd/esdsink.c index 843fad9..7ccd0b9 100644 --- a/ext/esd/esdsink.c +++ b/ext/esd/esdsink.c @@ -183,6 +183,7 @@ gst_esdsink_init (GTypeInstance * instance, gpointer g_class) GST_OBJECT (esdsink)); esdsink->sync = TRUE; esdsink->fallback = FALSE; + esdsink->link_open = FALSE; } #ifdef unused @@ -201,10 +202,13 @@ gst_esdsink_link (GstPad * pad, const GstCaps * caps) esdsink->bytes_per_sample = esdsink->channels * (esdsink->depth / 8); - gst_esdsink_close_audio (esdsink); - if (gst_esdsink_open_audio (esdsink)) { - esdsink->negotiated = TRUE; - return GST_PAD_LINK_OK; + if (esdsink->link_open) { + gst_esdsink_close_audio (esdsink); + if (gst_esdsink_open_audio (esdsink)) { + esdsink->negotiated = TRUE; + esdsink->link_open = TRUE; + return GST_PAD_LINK_OK; + } } /* FIXME: is it supposed to be correct to have closed audio when caps nego failed? */ @@ -457,25 +461,45 @@ gst_esdsink_change_state (GstElement * element) switch (GST_STATE_TRANSITION (element)) { case GST_STATE_NULL_TO_READY: - if (!gst_esdsink_open_audio (GST_ESDSINK (element))) { - return GST_STATE_FAILURE; - } break; case GST_STATE_READY_TO_PAUSED: + /* Open and close the link to test it's available */ + if (!esdsink->link_open) { + if (!gst_esdsink_open_audio (GST_ESDSINK (element))) { + return GST_STATE_FAILURE; + } + gst_esdsink_close_audio (GST_ESDSINK (element)); + } break; case GST_STATE_PAUSED_TO_PLAYING: + if (!esdsink->link_open) { + if (!gst_esdsink_open_audio (GST_ESDSINK (element))) { + return GST_STATE_FAILURE; + } + esdsink->link_open = TRUE; + } gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock), TRUE); break; case GST_STATE_PLAYING_TO_PAUSED: gst_audio_clock_set_active (GST_AUDIO_CLOCK (esdsink->provided_clock), FALSE); + if (esdsink->link_open) { + gst_esdsink_close_audio (GST_ESDSINK (element)); + esdsink->link_open = FALSE; + } esdsink->resync = TRUE; break; case GST_STATE_PAUSED_TO_READY: + /* Make doubly sure we don't leave our esd connection open + * or we'll block the other users + */ + if (esdsink->link_open) { + gst_esdsink_close_audio (GST_ESDSINK (element)); + esdsink->link_open = FALSE; + } break; case GST_STATE_READY_TO_NULL: - gst_esdsink_close_audio (GST_ESDSINK (element)); break; default: break; diff --git a/ext/esd/esdsink.h b/ext/esd/esdsink.h index 9bf8164..7ad1e41 100644 --- a/ext/esd/esdsink.h +++ b/ext/esd/esdsink.h @@ -58,6 +58,7 @@ struct _GstEsdsink { gchar *host; int handled; int bytes_per_sample; + gboolean link_open; gboolean sync; gboolean resync; gboolean fallback;