diff options
author | Jan Schmidt <thaytan@mad.scientist.com> | 2008-09-27 00:43:07 +0000 |
---|---|---|
committer | Jan Schmidt <thaytan@mad.scientist.com> | 2008-09-27 00:43:07 +0000 |
commit | 44cb25a34299247d695dec9a9c7881832e54e3ef (patch) | |
tree | 668fd4c26117cf98d282227878d7ea5e1f8db33a | |
parent | b17599a297fcb5d15a7f871e4ef3230d12b9f024 (diff) |
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-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/pulse/pulsesink.c | 12 |
2 files changed, 16 insertions, 2 deletions
@@ -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 e922e07e..33b51d54 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)); |