output_all: synchronize playback with player_control.notify

This patch fixes a longer delay when moving around songs in the
playlist.  The main thread wants to enqueue a new "next" song into the
player thread, but the player thread is waiting inside
audio_output_all_wait() for the output threads.  Use
player_control.notify there, so audio_output_all_wait() gets woken up
by the main thread, too.
This commit is contained in:
Max Kellermann 2009-03-26 23:40:50 +01:00
parent ed4837662a
commit 207786ffb1
2 changed files with 4 additions and 2 deletions

View File

@ -24,6 +24,7 @@
#include "conf.h" #include "conf.h"
#include "pipe.h" #include "pipe.h"
#include "buffer.h" #include "buffer.h"
#include "player_control.h"
#ifndef NDEBUG #ifndef NDEBUG
#include "chunk.h" #include "chunk.h"
@ -414,7 +415,7 @@ audio_output_all_wait(unsigned threshold)
if (audio_output_all_check() < threshold) if (audio_output_all_check() < threshold)
return true; return true;
notify_wait(&audio_output_client_notify); notify_wait(&pc.notify);
return audio_output_all_check() < threshold; return audio_output_all_check() < threshold;
} }

View File

@ -22,6 +22,7 @@
#include "output_internal.h" #include "output_internal.h"
#include "chunk.h" #include "chunk.h"
#include "pipe.h" #include "pipe.h"
#include "player_control.h"
#include <glib.h> #include <glib.h>
@ -156,7 +157,7 @@ static void ao_play(struct audio_output *ao)
ao->chunk_finished = true; ao->chunk_finished = true;
g_mutex_unlock(ao->mutex); g_mutex_unlock(ao->mutex);
notify_signal(&audio_output_client_notify); notify_signal(&pc.notify);
} }
static void ao_pause(struct audio_output *ao) static void ao_pause(struct audio_output *ao)