summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/alsa/alsa.c6
-rw-r--r--streamer.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c
index a9cfd0de..96d7645b 100644
--- a/plugins/alsa/alsa.c
+++ b/plugins/alsa/alsa.c
@@ -28,8 +28,8 @@
#define min(x,y) ((x)<(y)?(x):(y))
-#define LOCK {deadbeef->mutex_lock (mutex);}
-#define UNLOCK {deadbeef->mutex_unlock (mutex);}
+#define LOCK {deadbeef->mutex_lock (mutex); /*fprintf (stderr, "alsa lock %s:%d\n", __FILE__, __LINE__);*/}
+#define UNLOCK {deadbeef->mutex_unlock (mutex); /*fprintf (stderr, "alsa unlock %s:%d\n", __FILE__, __LINE__);*/}
#define DEFAULT_BUFFER_SIZE 8192
#define DEFAULT_PERIOD_SIZE 1024
@@ -509,7 +509,7 @@ palsa_thread (void *context) {
else {
UNLOCK;
usleep (10000);
- LOCK
+ LOCK;
continue;
}
diff --git a/streamer.c b/streamer.c
index 98020b74..b1834cd0 100644
--- a/streamer.c
+++ b/streamer.c
@@ -747,11 +747,13 @@ streamer_read_async (char *bytes, int size);
static void
streamer_start_new_song (void) {
trace ("nextsong=%d\n", nextsong);
+ streamer_lock ();
int sng = nextsong;
int initsng = nextsong;
int pstate = nextsong_pstate;
nextsong = -1;
src_remaining = 0;
+ streamer_unlock ();
if (badsong == sng) {
trace ("looped to bad file. stopping...\n");
streamer_set_nextsong (-2, 1);
@@ -852,9 +854,7 @@ streamer_thread (void *ctx) {
gettimeofday (&tm1, NULL);
if (nextsong >= 0) { // start streaming next song
trace ("\033[0;34mnextsong=%d\033[37;0m\n", nextsong);
- streamer_lock ();
streamer_start_new_song ();
- streamer_unlock ();
// it's totally possible that song was switched
// while streamer_set_current was running,
// so we need to restart here