summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-07-30 17:53:56 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-07-30 17:53:56 +0000
commit7e58bd7cb8ed27943723c85083a69519c40798ee (patch)
tree4960582dc3b9a9e6692a4bf501a9980f7715c868 /apps
parent4633d01eafdc5a4fd61511a6968fa88dda03e1bd (diff)
Correctly setting the last_index to prevent playback stuttering.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7264 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/apps/playback.c b/apps/playback.c
index a14b8dcb4e..01d4f7a87d 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -779,6 +779,7 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
off_t size;
int rc, i;
int copy_n;
+ int playlist_index;
/* Stop buffer filling if there is no free track entries.
Don't fill up the last track entry (we wan't to store next track
@@ -794,10 +795,11 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
if (tracks[track_widx].filesize != 0)
return false;
- last_index = playlist_get_display_index() - 1
- + playlist_get_first_index(NULL) + peek_offset;
- if (last_index >= playlist_amount())
- last_index -= playlist_amount();
+ last_index = playlist_get_display_index();
+ playlist_index = playlist_get_display_index() - 1
+ + playlist_get_first_index(NULL) + peek_offset;
+ if (playlist_index >= playlist_amount())
+ playlist_index -= playlist_amount();
peek_again:
/* Get track name from current playlist read position. */
@@ -808,7 +810,7 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
if (fd < 0) {
logf("Open failed");
/* Delete invalid entry from playlist. */
- playlist_delete(NULL, last_index);
+ playlist_delete(NULL, playlist_index);
continue ;
}
break ;
@@ -855,7 +857,7 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
/* Try skipping to next track. */
if (fill_bytesleft > 0) {
/* Delete invalid entry from playlist. */
- playlist_delete(NULL, last_index);
+ playlist_delete(NULL, playlist_index);
goto peek_again;
}
return false;
@@ -870,7 +872,7 @@ bool audio_load_track(int offset, bool start_play, int peek_offset)
tracks[track_widx].filesize = 0;
close(fd);
/* Delete invalid entry from playlist. */
- playlist_delete(NULL, last_index);
+ playlist_delete(NULL, playlist_index);
goto peek_again;
}
}