summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-04-14 17:31:19 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-04-14 17:31:19 +0000
commit7c986a91a64cd88833a2ebfabf0f1e7e505844ed (patch)
tree499695e9b09d04feae9652401902dd1909660446 /apps
parent348d9ece4b9b9f57c5ee0201106bfb19d7efa758 (diff)
downloadrockbox-7c986a91a64cd88833a2ebfabf0f1e7e505844ed.tar.gz
rockbox-7c986a91a64cd88833a2ebfabf0f1e7e505844ed.zip
Work around the bug with buffer wrapping. Serious performance penalty, and a lot of buffering is discarded to achieve this, but it doesn't crash while I find the real cause
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9664 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/playback.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/playback.c b/apps/playback.c
index d9a9673e2b..9d700a6fc9 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -677,6 +677,9 @@ static bool buffer_wind_forward(bool require_codec,
logf("bwf:%ldB",amount);
+ if (amount > filebufused)
+ return false;
+
/* Wind the buffer to the beginning of the target track or its codec */
buf_ridx += amount;
filebufused -= amount;
@@ -959,6 +962,7 @@ void codec_advance_buffer_callback(size_t amount)
codec_set_offset_callback(ci.curpos);
}
+/* Unused as of today 2006, 04/14, will be removed for 3.0 */
void codec_advance_buffer_loc_callback(void *ptr)
{
size_t amount;
@@ -1174,7 +1178,7 @@ static void audio_read_file(void)
/* If we're called and no file is open, this is an error */
if (current_fd < 0) {
- logf("audio_read_file fd < 0");
+ logf("Zero fd in arf");
/* Stop this buffer cycle immediately */
fill_bytesleft = 0;
/* Give some hope of miraculous recovery by forcing a track reload */
@@ -1189,6 +1193,7 @@ static void audio_read_file(void)
/* copy_n is the largest chunk that is safe to read */
copy_n = MIN(conf_filechunk, filebuflen - buf_widx);
copy_n = MIN(copy_n, fill_bytesleft);
+
/* rc is the actual amount read */
rc = read(current_fd, &filebuf[buf_widx], copy_n);