mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 13:12:37 -05:00
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:
parent
de44ae7efc
commit
113764d9c0
5 changed files with 19 additions and 13 deletions
|
|
@ -144,7 +144,6 @@ struct directory_search_context {
|
|||
};
|
||||
|
||||
static struct playlist_info current_playlist;
|
||||
static char now_playing[MAX_PATH+1];
|
||||
|
||||
static void empty_playlist(struct playlist_info* playlist, bool resume);
|
||||
static void new_playlist(struct playlist_info* playlist, const char *dir,
|
||||
|
|
@ -2456,7 +2455,7 @@ bool playlist_check(int steps)
|
|||
|
||||
/* get trackname of track that is "steps" away from current playing track.
|
||||
NULL is used to identify end of playlist */
|
||||
const char* playlist_peek(int steps)
|
||||
const char* playlist_peek(int steps, char* buf, size_t buf_size)
|
||||
{
|
||||
struct playlist_info* playlist = ¤t_playlist;
|
||||
int seek;
|
||||
|
|
@ -2471,11 +2470,11 @@ const char* playlist_peek(int steps)
|
|||
control_file = playlist->indices[index] & PLAYLIST_INSERT_TYPE_MASK;
|
||||
seek = playlist->indices[index] & PLAYLIST_SEEK_MASK;
|
||||
|
||||
if (get_filename(playlist, index, seek, control_file, now_playing,
|
||||
MAX_PATH+1) < 0)
|
||||
if (get_filename(playlist, index, seek, control_file, buf,
|
||||
buf_size) < 0)
|
||||
return NULL;
|
||||
|
||||
temp_ptr = now_playing;
|
||||
temp_ptr = buf;
|
||||
|
||||
if (!playlist->in_ram || control_file)
|
||||
{
|
||||
|
|
@ -2494,7 +2493,7 @@ const char* playlist_peek(int steps)
|
|||
/* Even though this is an invalid file, we still need to pass a
|
||||
file name to the caller because NULL is used to indicate end
|
||||
of playlist */
|
||||
return now_playing;
|
||||
return buf;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue