summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-09-21 09:49:05 +0000
committerattila <attila@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-09-21 09:49:05 +0000
commit81e60cd6bbb8c353d75022f3f35f04e8a173fb2f (patch)
treebd71e4815dbb4c1de560a23b51bb8cbbd00923a6 /libao2
parent5df4253e55e13b685df4e38a5282a5dd59058dce (diff)
downloadmpv-81e60cd6bbb8c353d75022f3f35f04e8a173fb2f.tar.bz2
mpv-81e60cd6bbb8c353d75022f3f35f04e8a173fb2f.tar.xz
patch from Pierre Lombard <p_l@gmx.fr>
If the sound channel is already busy the async open fails and returns -EBUSY. There's no need to try to open it synchronously as it will block mplayer till the sound channel is released. (Granted there's a very slight chance your sound device happen to be freed between those two calls but it's not the common case). The behavior is changed by this oneliner to match the ao_oss behavior (disable sound if the sound device is busy). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10899 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_alsa1x.c2
-rw-r--r--libao2/ao_alsa9.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/libao2/ao_alsa1x.c b/libao2/ao_alsa1x.c
index 3de16a3422..8f05e884bb 100644
--- a/libao2/ao_alsa1x.c
+++ b/libao2/ao_alsa1x.c
@@ -503,7 +503,7 @@ static int init(int rate_hz, int channels, int format, int flags)
//modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC
if ((err = snd_pcm_open(&alsa_handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0)
{
- if (ao_noblock) {
+ if (err != -EBUSY && ao_noblock) {
printf("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n");
if ((err = snd_pcm_open(&alsa_handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
printf("alsa-init: playback open error: %s\n", snd_strerror(err));
diff --git a/libao2/ao_alsa9.c b/libao2/ao_alsa9.c
index 3de16a3422..8f05e884bb 100644
--- a/libao2/ao_alsa9.c
+++ b/libao2/ao_alsa9.c
@@ -503,7 +503,7 @@ static int init(int rate_hz, int channels, int format, int flags)
//modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC
if ((err = snd_pcm_open(&alsa_handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0)
{
- if (ao_noblock) {
+ if (err != -EBUSY && ao_noblock) {
printf("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n");
if ((err = snd_pcm_open(&alsa_handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
printf("alsa-init: playback open error: %s\n", snd_strerror(err));