From bd785965c620e0032b3d449cdc81010a142cf0b6 Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Sun, 20 Jul 2003 10:34:29 +0000 Subject: Improve playback on USB sound cards. These changes improve xine's response to the removal of a USB cable while playing audio. Further changes will need to happen so as to allow sound output to continue when the USB cable is plugged back in, without having to stop the media stream. To enable that, when xine detects that the sound card is not there any more, it will have to close both pcm and mixer, so that the kernel can release USB resources, then when the USB cable is plugged back in, the pcm and mixer are opened again. This code might also modify what xine does in underrun situations, so this code might need to be changed again. CVS patchset: 5196 CVS date: 2003/07/20 10:34:29 --- src/audio_out/audio_alsa_out.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/audio_out') diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index a1cb1241d..77928de27 100644 --- a/src/audio_out/audio_alsa_out.c +++ b/src/audio_out/audio_alsa_out.c @@ -26,7 +26,7 @@ * (c) 2001 James Courtier-Dutton * * - * $Id: audio_alsa_out.c,v 1.98 2003/07/19 11:58:32 mroi Exp $ + * $Id: audio_alsa_out.c,v 1.99 2003/07/20 10:34:29 jcdutton Exp $ */ #ifdef HAVE_CONFIG_H @@ -667,6 +667,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #ifdef LOG_DEBUG printf("audio_alsa_out:write:loop:wait_result=%d\n",wait_result); #endif + if (wait_result < 0) return 0; } if (this->mmap != 0) { result = snd_pcm_mmap_writei(this->audio_fd, buffer, number_of_frames); @@ -701,6 +702,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { #ifdef LOG_DEBUG printf("audio_alsa_out:write:loop:wait_result=%d\n",wait_result); #endif + if (wait_result < 0) return 0; } #ifdef LOG_DEBUG gettimeofday(&now, 0); -- cgit v1.2.3