From 60d924aff557a7748acd7ad960c3bb3c79ea15a5 Mon Sep 17 00:00:00 2001 From: James Courtier-Dutton Date: Sun, 20 Jul 2003 12:29:18 +0000 Subject: More USB soundcard updates. CVS patchset: 5199 CVS date: 2003/07/20 12:29:18 --- src/audio_out/audio_alsa_out.c | 3 ++- src/xine-engine/audio_out.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c index 77928de27..77c100761 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.99 2003/07/20 10:34:29 jcdutton Exp $ + * $Id: audio_alsa_out.c,v 1.100 2003/07/20 12:29:18 jcdutton Exp $ */ #ifdef HAVE_CONFIG_H @@ -645,6 +645,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) { snd_pcm_status_dump(pcm_stat, jcd_out); #endif if ((res = snd_pcm_prepare(this->audio_fd))<0) { + return 0; XINE_ASSERT (0,"audio_alsa_out: xrun: prepare error: %s", snd_strerror(res)); } state = snd_pcm_state(this->audio_fd); diff --git a/src/xine-engine/audio_out.c b/src/xine-engine/audio_out.c index 2d4f5c05d..0b8dfb229 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.134 2003/07/20 10:34:30 jcdutton Exp $ + * $Id: audio_out.c,v 1.135 2003/07/20 12:29:18 jcdutton Exp $ * * 22-8-2001 James imported some useful AC3 sections from the previous alsa driver. * (c) 2001 Andy Lo A Foe @@ -872,6 +872,7 @@ static void *ao_loop (void *this_gen) { int64_t cur_time; int64_t last_sync_time; int bufs_since_sync; + int result; last_sync_time = bufs_since_sync = 0; in_buf = NULL; @@ -1056,8 +1057,14 @@ static void *ao_loop (void *this_gen) { lprintf ("loop: writing %d samples to sound device\n", out_buf->num_frames); pthread_mutex_lock( &this->driver_lock ); - this->driver->write (this->driver, out_buf->mem, out_buf->num_frames ); - pthread_mutex_unlock( &this->driver_lock ); + result = this->driver->write (this->driver, out_buf->mem, out_buf->num_frames ); + pthread_mutex_unlock( &this->driver_lock ); + /* FIXME: USB device unplugged. + * We should get the card into a closed state here, that involves closing + * the PCM as well as the MIXER. + * Maybe we should pause the stream until the USB device is plugged in again. + */ + XINE_ASSERT(result == 1, "write to sound card failed. Was a USB device unplugged?"); lprintf ("loop: next buf from fifo\n"); fifo_append (this->free_fifo, in_buf); -- cgit v1.2.3