summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Pennequin <nicolas.pennequin@free.fr>2008-06-29 11:50:41 +0000
committerNicolas Pennequin <nicolas.pennequin@free.fr>2008-06-29 11:50:41 +0000
commit0441afecd7ecb7024609224fc6ab39b7bedab273 (patch)
tree90728c0e11e3158516bd93b543f7f26fd47e1bb9
parent4e15aead43c9bbecf8a13c146ac38685afa0d200 (diff)
downloadrockbox-0441afecd7ecb7024609224fc6ab39b7bedab273.zip
rockbox-0441afecd7ecb7024609224fc6ab39b7bedab273.tar.gz
rockbox-0441afecd7ecb7024609224fc6ab39b7bedab273.tar.bz2
rockbox-0441afecd7ecb7024609224fc6ab39b7bedab273.tar.xz
Fix FS#9110 and its maybe-dupes.
The issue happened when the value of 'filling' was STATE_FINISHED: the low_buffer_callback wouldn't do anything even when there would still be data remaining to be buffered, leading to a shortage of audio data. Only making the callback act even when filling is STATE_FINISHED (the simple fix) isn't right because of cases when the last track in the playlist is fully buffered. Therefore I added a new state to distinguish between when the last track is fully buffered (STATE_FINISHED) and when it isn't (STATE_END_OF_PLAYLIST). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17875 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/playback.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/apps/playback.c b/apps/playback.c
index d85bdcb..aee06b0 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -151,7 +151,8 @@ enum filling_state {
STATE_IDLE, /* audio is stopped: nothing to do */
STATE_FILLING, /* adding tracks to the buffer */
STATE_FULL, /* can't add any more tracks */
- STATE_FINISHED, /* all remaining tracks have been added */
+ STATE_END_OF_PLAYLIST, /* all remaining tracks have been added */
+ STATE_FINISHED, /* all remaining tracks are fully buffered */
};
#if MEM > 1
@@ -1413,7 +1414,7 @@ static void buffering_low_buffer_callback(void *data)
(void)data;
logf("low buffer callback");
- if (filling == STATE_FULL) {
+ if (filling == STATE_FULL || filling == STATE_END_OF_PLAYLIST) {
/* force a refill */
LOGFQUEUE("buffering > audio Q_AUDIO_FILL_BUFFER");
queue_post(&audio_queue, Q_AUDIO_FILL_BUFFER, 0);
@@ -1443,6 +1444,15 @@ static void buffering_handle_finished_callback(int *data)
/* This is most likely an audio handle, so we strip the useless
trailing tags that are left. */
strip_tags(*data);
+
+ if (*data == tracks[track_widx-1].audio_hid
+ && filling == STATE_END_OF_PLAYLIST)
+ {
+ /* This was the last track in the playlist.
+ We now have all the data we need. */
+ logf("last track finished buffering");
+ filling = STATE_FINISHED;
+ }
}
}
@@ -1634,7 +1644,7 @@ static bool audio_load_track(size_t offset, bool start_play)
{
logf("End-of-playlist");
memset(&lasttrack_id3, 0, sizeof(struct mp3entry));
- filling = STATE_FINISHED;
+ filling = STATE_END_OF_PLAYLIST;
return false;
}