Blob Blame History Raw
diff -Nur audacious-plugins-1.5.1-sndfile-cleanup/src/sndfile/plugin.c audacious-plugins-1.5.1-sndfile-playfix/src/sndfile/plugin.c
--- audacious-plugins-1.5.1-sndfile-cleanup/src/sndfile/plugin.c	2009-10-28 14:45:17.432796535 +0100
+++ audacious-plugins-1.5.1-sndfile-playfix/src/sndfile/plugin.c	2009-10-28 14:43:21.000000000 +0100
@@ -49,7 +49,6 @@
 static glong seek_time = -1;
 static volatile char pause_flag;
 
-static GThread *decode_thread;
 static GMutex *decode_mutex;
 static GCond *decode_cond;
 
@@ -395,17 +394,8 @@
         samples = sf_read_short (sndfile, buffer, BUFFER_SIZE);
 
         if (samples > 0 && playback->playing == TRUE) {
-            while ((playback->output->buffer_free () < samples) &&
-                   playback->playing == TRUE) {
-                g_get_current_time(&sleeptime);
-                g_time_val_add(&sleeptime, 500000);
-                g_mutex_lock(decode_mutex);
-                g_cond_timed_wait(decode_cond, decode_mutex, &sleeptime);
-                g_mutex_unlock(decode_mutex);
-
                 if (playback->playing == FALSE)
                     break;
-            }
 
             playback->pass_audio(playback, FMT_S16_NE, sfinfo.channels, 
                                  samples * sizeof(buffer[0]), buffer, &playback->playing);
@@ -483,9 +473,9 @@
 
     playback->playing = TRUE;
 
-    decode_thread = g_thread_self();
     playback->set_pb_ready(playback);
     play_loop(playback);
+    playback->playing = FALSE;
 }
 
 static void
@@ -497,18 +487,12 @@
 static void
 play_stop (InputPlayback *playback)
 {
-    if (decode_thread == NULL)
-        return;
-
     g_mutex_lock(decode_mutex);
     playback->playing = FALSE;
     g_mutex_unlock(decode_mutex);
     g_cond_signal(decode_cond);
 
-    g_thread_join (decode_thread);
-
     sndfile = NULL;
-    decode_thread = NULL;
     seek_time = -1;
 }