FS#7879 - Anti-skip buffer doesn't work correctly on read errors

Attached to Project: Rockbox
Opened by Gwen Roelants (Adion) - Monday, 01 October 2007, 20:03 GMT
Task Type Bugs
Category Music playback
Status Unconfirmed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
Private No


I use my iHP-120 harddisk player with rockbox while jogging regularly, but sometimes the track just stops and the player instantly skips to the next track, presumably due to a read error.

I have the anti-skip buffer set to 10 minutes already, but I doubt it has actually been trying to read for that long because it can switch to the next track so fast.

In the rockbox code, I found out that when the buffer runs out, audio_read_file in playback.c is called. For disk access it calls read() and if that fails it seems to skip to the next track (the log it does is "File ended %ldB early")

In ata.c I found that the read is performed by ata_read_sectors, which does indeed have some mechanism to retry on errors, but only for READ_TIMEOUT time, which is only 5 seconds. After that an error is returned, and from what I understand, no retry is attempted after that, even though there may still be 9 minutes and 55 seconds left in the buffer.

I think playback.c should know what was the cause of the read error to decide if it should try again or indeed skip to the next file.
This task depends upon

Comment by Peter D'Hoye (petur) - Wednesday, 03 October 2007, 11:35 GMT
tip 1: DO NOT USE A HARDDISK BASED PLAYER FOR SPORTS like jogging. Seriously. Get a flash based player for that stuff....
Comment by Linus Nielsen Feltzing (linusnielsen) - Wednesday, 03 October 2007, 11:52 GMT
I still think that rockbox should play the entire buffer before skipping to the next file.
Comment by Gwen Roelants (Adion) - Wednesday, 03 October 2007, 17:29 GMT
I've been using it for 3 years while jogging now, and the hard disk is still perfectly fine without bad sectors.
Comment by harry tu (bookshare) - Friday, 05 October 2007, 23:08 GMT
My ipod4g has been my jogging companion. It is rocking the country just fine.
Comment by Boris Gjenero (dreamlayers) - Tuesday, 17 March 2009, 06:33 GMT
READ_TIMEOUT in firmware/drivers/ata.c is always 5 seconds. If a read operation cannot succeed in 5 seconds, no further retries are made and failure is reported. The anti-skip buffer only helps if operations keep succeeding but are slow.