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 +++- src/xine-engine/audio_out.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') 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); diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 442e37ab0..2d4f5c05d 100644 --- a/src/xine-engine/audio_out.c +++ b/src/xine-engine/audio_out.c @@ -17,7 +17,7 @@ * along with self program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: audio_out.c,v 1.133 2003/07/02 23:10:21 jcdutton Exp $ + * $Id: audio_out.c,v 1.134 2003/07/20 10:34:30 jcdutton Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe @@ -1197,6 +1197,7 @@ static int ao_change_settings(aos_t *this, uint32_t bits, uint32_t rate, int mod output_sample_rate = this->input.rate; if ( output_sample_rate == 0) { + this->driver_open = 0; xprintf (this->xine, XINE_VERBOSITY_LOG, "open failed!\n"); return 0; }; -- cgit v1.2.3