summaryrefslogtreecommitdiff
path: root/apps/playback.c
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/playback.c
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/playback.c')
-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)
2569 2569
2570static void audio_fill_file_buffer(bool start_play, size_t offset) 2570static void audio_fill_file_buffer(bool start_play, size_t offset)
2571{ 2571{
2572 struct queue_event ev;
2572 bool had_next_track = audio_next_track() != NULL; 2573 bool had_next_track = audio_next_track() != NULL;
2573 bool continue_buffering; 2574 bool continue_buffering;
2574 2575
@@ -2591,9 +2592,14 @@ static void audio_fill_file_buffer(bool start_play, size_t offset)
2591 start_play = false; 2592 start_play = false;
2592 offset = 0; 2593 offset = 0;
2593 sleep(1); 2594 sleep(1);
2594 if (!queue_empty(&audio_queue)) { 2595 if (queue_peek(&audio_queue, &ev)) {
2595 /* There's a message in the queue. break the loop to treat it, 2596 if (ev.id != Q_AUDIO_FILL_BUFFER)
2596 and go back to filling after that. */ 2597 {
2598 /* There's a message in the queue. break the loop to treat it,
2599 and go back to filling after that. */
2600 LOGFQUEUE("buffering > audio Q_AUDIO_FILL_BUFFER");
2601 queue_post(&audio_queue, Q_AUDIO_FILL_BUFFER, 0);
2602 }
2597 break; 2603 break;
2598 } 2604 }
2599 } while (continue_buffering); 2605 } while (continue_buffering);