No need to force a sync of control file until playlist has started. This should improve tagcache playlist creation performance on Archos devices (esp. Ondio). Also fixed a small bug in playlist_set_current.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9735 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Hardeep Sidhu 2006-04-20 01:43:16 +00:00
parent 3215ed2e85
commit 195a9f2766

View file

@ -1771,9 +1771,12 @@ static int update_control(struct playlist_info* playlist,
*/ */
static void sync_control(struct playlist_info* playlist, bool force) static void sync_control(struct playlist_info* playlist, bool force)
{ {
(void) force;
#ifdef HAVE_DIRCACHE #ifdef HAVE_DIRCACHE
if (force) if (playlist->started && force)
#else
(void) force;
if (playlist->started)
#endif #endif
{ {
if (playlist->pending_control_sync) if (playlist->pending_control_sync)
@ -2310,12 +2313,14 @@ int playlist_start(int start_index, int offset)
struct playlist_info* playlist = &current_playlist; struct playlist_info* playlist = &current_playlist;
playlist->index = start_index; playlist->index = start_index;
#if CONFIG_CODEC != SWCODEC #if CONFIG_CODEC != SWCODEC
talk_buffer_steal(); /* will use the mp3 buffer */ talk_buffer_steal(); /* will use the mp3 buffer */
#endif #endif
audio_play(offset);
playlist->started = true; playlist->started = true;
sync_control(playlist, false);
audio_play(offset);
return 0; return 0;
} }
@ -2701,6 +2706,7 @@ int playlist_set_current(struct playlist_info* playlist)
current_playlist.fd = playlist->fd; current_playlist.fd = playlist->fd;
close(playlist->control_fd); close(playlist->control_fd);
close(current_playlist.control_fd);
remove(current_playlist.control_filename); remove(current_playlist.control_filename);
if (rename(playlist->control_filename, if (rename(playlist->control_filename,
current_playlist.control_filename) < 0) current_playlist.control_filename) < 0)