diff options
author | Max Kellermann <max@duempel.org> | 2009-03-25 18:00:31 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-03-25 18:00:31 +0100 |
commit | 933fcf42326972c93dfa840ef06e2639e16cc43d (patch) | |
tree | f0f803fcd842fd98b81d6af411740f890a8c11b1 /src/output | |
parent | 4dbf73d88bf5ab2da154ac2f537aa28a67c5f8b6 (diff) | |
download | mpd-933fcf42326972c93dfa840ef06e2639e16cc43d.tar.gz mpd-933fcf42326972c93dfa840ef06e2639e16cc43d.tar.xz mpd-933fcf42326972c93dfa840ef06e2639e16cc43d.zip |
output_all: moved code to audio_output_all_wait()
Synchronization with the output thread will be implemented in
output_all.c, not in player_thread.c. Currently, that's just a simple
g_usleep(1ms).
Diffstat (limited to '')
-rw-r--r-- | src/output_all.c | 12 | ||||
-rw-r--r-- | src/output_all.h | 11 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/output_all.c b/src/output_all.c index 2e7d3a720..870d8aed3 100644 --- a/src/output_all.c +++ b/src/output_all.c @@ -408,6 +408,18 @@ audio_output_all_check(void) return 0; } +bool +audio_output_all_wait(unsigned threshold) +{ + if (audio_output_all_check() < threshold) + return true; + + /* XXX synchronize in a better way */ + g_usleep(1000); + + return audio_output_all_check() < threshold; +} + void audio_output_all_pause(void) { diff --git a/src/output_all.h b/src/output_all.h index 197a0bfd2..2a09514b2 100644 --- a/src/output_all.h +++ b/src/output_all.h @@ -105,6 +105,17 @@ unsigned audio_output_all_check(void); /** + * Checks if the size of the #music_pipe is below the #threshold. If + * not, it attempts to synchronize with all output threads, and waits + * until another #music_chunk is finished. + * + * @param threshold the maximum number of chunks in the pipe + * @return true if there are less than #threshold chunks in the pipe + */ +bool +audio_output_all_wait(unsigned threshold); + +/** * Puts all audio outputs into pause mode. Most implementations will * simply close it then. */ |