summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2004-03-21 03:29:43 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2004-03-21 03:29:43 +0000
commit129fe0acaadf16cc7ff2184c07ab1c073fcd6657 (patch)
tree886278efd88f2c63a844cb9a2cafbd8d697242d2
parent6bf3c6739eb662780f07ca01826a20a8bc46cc23 (diff)
downloadxine-lib-129fe0acaadf16cc7ff2184c07ab1c073fcd6657.tar.gz
xine-lib-129fe0acaadf16cc7ff2184c07ab1c073fcd6657.tar.bz2
Fix longstanding problem when using xine with alsa's dmix audio out plugin.
CVS patchset: 6292 CVS date: 2004/03/21 03:29:43
-rw-r--r--ChangeLog2
-rw-r--r--src/audio_out/audio_alsa_out.c13
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 57b1818fe..0c4a1fb41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -50,6 +50,8 @@ xine-lib (1-rc3b)
to continue playback in case of errors
* ignore the hue setting on NVidia cards using the Xv video output
as both the XFree86 and the proprietary driver are broken
+ * fix long standing problem with xine using alsa's dmix audio out.
+ Sound is now continuous.
xine-lib (1-rc3a)
* new subtitle formats: jacobsub, subviewer 2.0, subrip 0.9
diff --git a/src/audio_out/audio_alsa_out.c b/src/audio_out/audio_alsa_out.c
index 3f4247fb1..0f1f77a10 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.133 2004/03/20 20:45:18 hadess Exp $
+ * $Id: audio_alsa_out.c,v 1.134 2004/03/21 03:29:43 jcdutton Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -788,11 +788,14 @@ 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:waiting for Godot\n");
#endif
- wait_result = snd_pcm_wait(this->audio_fd, 1000000);
+ snd_pcm_status(this->audio_fd, pcm_stat);
+ if ( snd_pcm_status_get_avail(pcm_stat) < number_of_frames) {
+ wait_result = snd_pcm_wait(this->audio_fd, 1000000);
#ifdef LOG_DEBUG
- printf("audio_alsa_out:write:loop:wait_result=%d\n",wait_result);
+ printf("audio_alsa_out:write:loop:wait_result=%d\n",wait_result);
#endif
- if (wait_result < 0) return 0;
+ if (wait_result < 0) return 0;
+ }
}
if (this->mmap != 0) {
result = snd_pcm_mmap_writei(this->audio_fd, buffer, number_of_frames);
@@ -822,6 +825,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) {
buffer += result * this->bytes_per_frame;
}
}
+#if 0
if ( (state == SND_PCM_STATE_RUNNING) ) {
#ifdef LOG_DEBUG
printf("audio_alsa_out:write:loop:waiting for Godot2\n");
@@ -832,6 +836,7 @@ static int ao_alsa_write(ao_driver_t *this_gen, int16_t *data, uint32_t count) {
#endif
if (wait_result < 0) return 0;
}
+#endif
#ifdef LOG_DEBUG
gettimeofday(&now, 0);
printf("audio_alsa_out:write: Time = %ld.%ld\n", now.tv_sec, now.tv_usec);