summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2008-09-27 00:43:07 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2008-09-27 00:43:07 +0000
commit44cb25a34299247d695dec9a9c7881832e54e3ef (patch)
tree668fd4c26117cf98d282227878d7ea5e1f8db33a
parentb17599a297fcb5d15a7f871e4ef3230d12b9f024 (diff)
downloadgstreamer-plugins-good-44cb25a34299247d695dec9a9c7881832e54e3ef.tar.gz
ext/pulse/pulsesink.c: Fix problems with pulsesink randomly erroring with code 'OK' after a format change on the stre...
Original commit message from CVS: * ext/pulse/pulsesink.c: Fix problems with pulsesink randomly erroring with code 'OK' after a format change on the stream by waiting when disconnecting the stream.
-rw-r--r--ChangeLog6
-rw-r--r--ext/pulse/pulsesink.c12
2 files changed, 16 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 03102233c..f5cef9006 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-09-27 Jan Schmidt <jan.schmidt@sun.com>
+
+ * ext/pulse/pulsesink.c:
+ Fix problems with pulsesink randomly erroring with code 'OK' after a
+ format change on the stream by waiting when disconnecting the stream.
+
2008-09-26 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/rtp/gstrtpamrdepay.c: (gst_rtp_amr_depay_class_init),
diff --git a/ext/pulse/pulsesink.c b/ext/pulse/pulsesink.c
index e922e07e1..33b51d543 100644
--- a/ext/pulse/pulsesink.c
+++ b/ext/pulse/pulsesink.c
@@ -273,6 +273,7 @@ gst_pulsesink_destroy_stream (GstPulseSink * pulsesink)
{
if (pulsesink->stream) {
pa_stream_disconnect (pulsesink->stream);
+ pa_threaded_mainloop_wait (pulsesink->mainloop);
pa_stream_unref (pulsesink->stream);
pulsesink->stream = NULL;
}
@@ -507,6 +508,7 @@ gst_pulsesink_open (GstAudioSink * asink)
{
GstPulseSink *pulsesink = GST_PULSESINK (asink);
gchar *name = gst_pulse_client_name ();
+ pa_context_state_t state;
pa_threaded_mainloop_lock (pulsesink->mainloop);
@@ -530,7 +532,9 @@ gst_pulsesink_open (GstAudioSink * asink)
/* Wait until the context is ready */
pa_threaded_mainloop_wait (pulsesink->mainloop);
- if (pa_context_get_state (pulsesink->context) != PA_CONTEXT_READY) {
+ state = pa_context_get_state (pulsesink->context);
+ if (state != PA_CONTEXT_READY) {
+ GST_DEBUG_OBJECT (pulsesink, "Context state was not READY. Got: %d", state);
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED, ("Failed to connect: %s",
pa_strerror (pa_context_errno (pulsesink->context))), (NULL));
goto unlock_and_fail;
@@ -564,6 +568,7 @@ gst_pulsesink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
{
pa_buffer_attr buf_attr;
pa_channel_map channel_map;
+ pa_stream_state_t s_state;
GstPulseSink *pulsesink = GST_PULSESINK (asink);
if (!gst_pulse_fill_sample_spec (spec, &pulsesink->sample_spec)) {
@@ -620,7 +625,10 @@ gst_pulsesink_prepare (GstAudioSink * asink, GstRingBufferSpec * spec)
/* Wait until the stream is ready */
pa_threaded_mainloop_wait (pulsesink->mainloop);
- if (pa_stream_get_state (pulsesink->stream) != PA_STREAM_READY) {
+ s_state = pa_stream_get_state (pulsesink->stream);
+ if (s_state != PA_STREAM_READY) {
+ GST_DEBUG_OBJECT (pulsesink, "Stream state was not READY. Got: %d",
+ s_state);
GST_ELEMENT_ERROR (pulsesink, RESOURCE, FAILED,
("Failed to connect stream: %s",
pa_strerror (pa_context_errno (pulsesink->context))), (NULL));