Fix FS#11175. playlist_peek() wasn't thread safe (due to a static filename buffer), so frequent calls from the main thread would cause the audio thread to buffer the wrong track.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27773 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Magnus Holmgren 2010-08-11 19:01:50 +00:00
parent de44ae7efc
commit 113764d9c0
5 changed files with 19 additions and 13 deletions

View file

@ -1113,6 +1113,7 @@ static bool audio_loadcodec(bool start_play)
actually loaded by the buffering thread. */
static bool audio_load_track(size_t offset, bool start_play)
{
char name_buf[MAX_PATH + 1];
const char *trackname;
int fd = -1;
@ -1140,7 +1141,8 @@ static bool audio_load_track(size_t offset, bool start_play)
logf("Buffering track: r%d/w%d", track_ridx, track_widx);
/* Get track name from current playlist read position. */
while ((trackname = playlist_peek(last_peek_offset)) != NULL)
while ((trackname = playlist_peek(last_peek_offset, name_buf,
sizeof(name_buf))) != NULL)
{
/* Handle broken playlists. */
fd = open(trackname, O_RDONLY);