ext/alsa/gstalsasink.c: Open non-blocking, set to blocking mode afterwards to avoid lockups when audio device is busy.

Original commit message from CVS:
* ext/alsa/gstalsasink.c: (gst_alsasink_open):
Open non-blocking, set to blocking mode afterwards to avoid
lockups when audio device is busy.
This commit is contained in:
Wim Taymans 2005-05-25 11:57:45 +00:00
parent a159660dfc
commit 391c82601f
2 changed files with 16 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2005-05-25 Wim Taymans <wim@fluendo.com>
* ext/alsa/gstalsasink.c: (gst_alsasink_open):
Open non-blocking, set to blocking mode afterwards to avoid
lockups when audio device is busy.
2005-05-23 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst-libs/gst/audio/gstringbuffer.c: (gst_ringbuffer_clear):

View file

@ -429,8 +429,10 @@ gst_alsasink_open (GstAudioSink * asink, GstRingBufferSpec * spec)
if (!alsasink_parse_spec (alsa, spec))
goto spec_parse;
CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_PLAYBACK, 0),
open_error);
CHECK (snd_pcm_open (&alsa->handle, alsa->device, SND_PCM_STREAM_PLAYBACK,
SND_PCM_NONBLOCK), open_error);
CHECK (snd_pcm_nonblock (alsa->handle, 0), non_block);
CHECK (set_hwparams (alsa), hw_params_failed);
CHECK (set_swparams (alsa), sw_params_failed);
@ -459,6 +461,12 @@ open_error:
("Playback open error: %s", snd_strerror (err)), (NULL));
return FALSE;
}
non_block:
{
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,
("Could not set device to blocking: %s", snd_strerror (err)), (NULL));
return FALSE;
}
hw_params_failed:
{
GST_ELEMENT_ERROR (alsa, RESOURCE, OPEN_READ,