1
0
Fork 0
forked from len0rd/rockbox

Fix FS 6205: id3v1 stripping messed up rebuffer_and_seeks. Add an assurance check JinC other things mess it up, more graceful recovery.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11318 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Brandon Low 2006-10-23 16:47:48 +00:00
parent 5825b2c84f
commit 97f2af2553

View file

@ -2166,6 +2166,13 @@ static bool audio_read_file(size_t minimum)
else
overlap = RINGBUF_ADD_CROSS(buf_widx,rc,CUR_TI->buf_idx);
if ((unsigned)rc > tracks[track_widx].filerem)
{
logf("Bad: rc-filerem=%d, fixing", rc-tracks[track_widx].filerem);
tracks[track_widx].filesize += rc - tracks[track_widx].filerem;
tracks[track_widx].filerem = rc;
}
/* Advance buffer */
buf_widx = RINGBUF_ADD(buf_widx, rc);
tracks[track_widx].available += rc;
@ -2883,9 +2890,12 @@ static void audio_rebuffer_and_seek(size_t newpos)
filling = false;
audio_initialize_buffer_fill(true);
/* This may have been tweaked by the id3v1 code */
CUR_TI->filesize=filesize(fd);
if (newpos > conf_preseek)
{
CUR_TI->start_pos = newpos - conf_preseek;
lseek(current_fd, CUR_TI->start_pos, SEEK_SET);
CUR_TI->filerem = CUR_TI->filesize - CUR_TI->start_pos;
real_preseek = conf_preseek;
}
@ -2898,8 +2908,6 @@ static void audio_rebuffer_and_seek(size_t newpos)
CUR_TI->available = 0;
lseek(current_fd, CUR_TI->start_pos, SEEK_SET);
audio_read_file(real_preseek);
/* Account for the data we just read that is 'behind' us now */