diff -up xmms-1.2.11-20071117cvs/Output/alsa/audio.c.fix-loop xmms-1.2.11-20071117cvs/Output/alsa/audio.c
--- xmms-1.2.11-20071117cvs/Output/alsa/audio.c.fix-loop 2006-07-25 17:45:08.000000000 -0400
+++ xmms-1.2.11-20071117cvs/Output/alsa/audio.c 2011-07-15 16:05:55.805328775 -0400
@@ -807,7 +807,7 @@ static void *alsa_loop(void *arg)
unsigned short *revents;
if (npfds <= 0)
- goto _error;
+ goto _cleanup;
pfds = alloca(sizeof(*pfds) * npfds);
revents = alloca(sizeof(*revents) * npfds);
while (going && alsa_pcm)
@@ -828,16 +828,34 @@ static void *alsa_loop(void *arg)
int i;
snd_pcm_poll_descriptors_revents(alsa_pcm, pfds,
npfds, revents);
- for (i = 0; i < npfds; i++)
+ for (i = 0; i < npfds; i++)
+ {
if (revents[i] & POLLOUT)
{
+ debug("calling alsa_write_out_thread_data()");
alsa_write_out_thread_data();
+ debug("done with alsa_write_out_thread_data, break!");
break;
- }
+ }
+ debug("Still in the for loop");
+ }
+ debug("Out of the for loop, but still in the if poll.");
}
+ debug("Still in the not-paused not-prebuffer conditional");
}
else
- xmms_usleep(10000);
+ {
+ if (paused)
+ debug("Sorry, I'm paused. Taking a little nap.");
+ if (prebuffer)
+ debug("Buffering like Real Player.");
+ if (paused || prebuffer) {
+ xmms_usleep(10000);
+ } else {
+ debug("All done!");
+ goto _cleanup;
+ }
+ }
if (pause_request != paused)
alsa_do_pause(pause_request);
@@ -850,11 +868,12 @@ static void *alsa_loop(void *arg)
}
}
- _error:
+ _cleanup:
alsa_close_pcm();
g_free(thread_buffer);
thread_buffer = NULL;
pthread_exit(NULL);
+ return;
}
/* open callback */
@@ -901,6 +920,7 @@ int alsa_open(AFormat fmt, int rate, int
flush_request = -1;
pthread_create(&audio_thread, NULL, alsa_loop, NULL);
+ debug("Do we get here?");
return 1;
}