summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2007-10-27 18:08:18 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2007-10-27 18:08:18 +0000
commit1839edf64ad0a4b6d96a5dd5ce24ab8075954dc6 (patch)
tree6b31c67e9168ae2c47eba9f3205f69bdd1328d42 /apps
parent41add08c5edb9d3de7e223e860cef035b41a3b01 (diff)
downloadrockbox-1839edf64ad0a4b6d96a5dd5ce24ab8075954dc6.tar.gz
rockbox-1839edf64ad0a4b6d96a5dd5ce24ab8075954dc6.zip
Add queue_peek to the kernel (written by Mike Sevakis), and use it to improve upon my previous commit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15336 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/playback.c b/apps/playback.c
index 2ac54e7d74..3c1dd37d3f 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -2569,6 +2569,7 @@ static void low_buffer_callback(void)
static void audio_fill_file_buffer(bool start_play, size_t offset)
{
+ struct queue_event ev;
bool had_next_track = audio_next_track() != NULL;
bool continue_buffering;
@@ -2591,9 +2592,14 @@ static void audio_fill_file_buffer(bool start_play, size_t offset)
start_play = false;
offset = 0;
sleep(1);
- if (!queue_empty(&audio_queue)) {
- /* There's a message in the queue. break the loop to treat it,
- and go back to filling after that. */
+ if (queue_peek(&audio_queue, &ev)) {
+ if (ev.id != Q_AUDIO_FILL_BUFFER)
+ {
+ /* There's a message in the queue. break the loop to treat it,
+ and go back to filling after that. */
+ LOGFQUEUE("buffering > audio Q_AUDIO_FILL_BUFFER");
+ queue_post(&audio_queue, Q_AUDIO_FILL_BUFFER, 0);
+ }
break;
}
} while (continue_buffering);