summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2003-07-20 12:29:18 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2003-07-20 12:29:18 +0000
commit60d924aff557a7748acd7ad960c3bb3c79ea15a5 (patch)
tree3a5c104bf26255341a6122d7d8c59085feb34ea3
parentfe77ec33afaa8ca136813da2e6746cb2667009f5 (diff)
downloadxine-lib-60d924aff557a7748acd7ad960c3bb3c79ea15a5.tar.gz
xine-lib-60d924aff557a7748acd7ad960c3bb3c79ea15a5.tar.bz2
More USB soundcard updates.
CVS patchset: 5199 CVS date: 2003/07/20 12:29:18
-rw-r--r--src/audio_out/audio_alsa_out.c3
-rw-r--r--src/xine-engine/audio_out.c13
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 <James@superbug.demon.co.uk>
*
*
- * $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 <andy@alsaplayer.org>
@@ -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);