changeset 3147:a6a57fe6a75c

Fix last second(s) of playback getting lost, by Hans de Goede.
author Tony Vroon <chainsaw@gentoo.org>
date Sun, 10 May 2009 21:15:29 +0100
parents 87b0c47089e5
children d443c917dab9
files src/alsa/audio.c
diffstat 1 files changed, 5 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/alsa/audio.c	Sat May 09 13:47:30 2009 -0500
+++ b/src/alsa/audio.c	Sun May 10 21:15:29 2009 +0100
@@ -141,13 +141,11 @@
 
 int alsa_playing(void)
 {
-	if (!going || paused || alsa_pcm == NULL)
+	if (!going || paused || prebuffer || alsa_pcm == NULL)
 		return FALSE;
 
-	return snd_pcm_state(alsa_pcm) == SND_PCM_STATE_RUNNING &&
-               !paused &&
-               !prebuffer &&
-               get_thread_buffer_filled() > hw_period_size_in;
+	return snd_pcm_state(alsa_pcm) == SND_PCM_STATE_RUNNING ||
+	       get_thread_buffer_filled();
 }
 
 static gint
@@ -647,7 +645,7 @@
 {
 	gint length, cnt, avail;
 
-	length = MIN(hw_period_size_in, get_thread_buffer_filled());
+	length = get_thread_buffer_filled();
 	avail = snd_pcm_frames_to_bytes(alsa_pcm, alsa_get_avail());
 	length = MIN(length, avail);
 	while (length > 0)
@@ -677,8 +675,7 @@
 	{
 		if (get_thread_buffer_filled() > prebuffer_size)
 			prebuffer = FALSE;
-		if (!paused && !prebuffer &&
-		    get_thread_buffer_filled() > hw_period_size_in)
+		if (!paused && !prebuffer && get_thread_buffer_filled())
 		{
 			wr = snd_pcm_wait(alsa_pcm, 10);
 			if (wr > 0)