comparison libao2/ao_alsa9.c @ 10898:716edc005b18

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).
author attila
date Sun, 21 Sep 2003 09:49:05 +0000
parents 7c404c64a2bc
children 6e35326c742f
comparison
equal deleted inserted replaced
10897:ee9d3d88020a 10898:716edc005b18
501 501
502 if (!alsa_handler) { 502 if (!alsa_handler) {
503 //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC 503 //modes = 0, SND_PCM_NONBLOCK, SND_PCM_ASYNC
504 if ((err = snd_pcm_open(&alsa_handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0) 504 if ((err = snd_pcm_open(&alsa_handler, alsa_device, SND_PCM_STREAM_PLAYBACK, open_mode)) < 0)
505 { 505 {
506 if (ao_noblock) { 506 if (err != -EBUSY && ao_noblock) {
507 printf("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n"); 507 printf("alsa-init: open in nonblock-mode failed, trying to open in block-mode\n");
508 if ((err = snd_pcm_open(&alsa_handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { 508 if ((err = snd_pcm_open(&alsa_handler, alsa_device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) {
509 printf("alsa-init: playback open error: %s\n", snd_strerror(err)); 509 printf("alsa-init: playback open error: %s\n", snd_strerror(err));
510 return(0); 510 return(0);
511 } else { 511 } else {