FS#9137 - Rewinding after rebuffering causes early skipping or noise

Attached to Project: Rockbox
Opened by PaulJam (PaulJam) - Monday, 30 June 2008, 22:59 GMT
Last edited by Nicolas Pennequin (nicolas_p) - Friday, 18 July 2008, 23:33 GMT
Task Type Bugs
Category Music playback
Status Closed
Assigned To Nicolas Pennequin (nicolas_p)
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Version 3.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Reproduction (doesn't seem to be 100% reliable but with a high chance of success):

DON'T TRY TO REPRODUCE WITH HEADPHONES (the noise can be very loud compared to the music level)

Reset settings, start playing a (flac?) file that is larger than the audiobuffer (smaller than 2x audoibuffer?) and to speed up the process fast forward to a position *before* rebuffering. After rebuffering happens rewind to a position before rebuffering happened and let the song play. After some time either playback skips to the next song before the current has ended or there is horrible noise (a very short piece that is constantly repeated).

Fast forwarding beyond the position where the "natural" rebuffering happens and then rewinding doesn't seem to lead to a reliable reproduction (but i managed to completely freeze the uisim once that way).

Attached is the console output of the uisimulator with the LOGF_ENABLE define uncommented in buffering.c and playback.c.

H300 (r19876) and H300 uisim (r17898M) with flac files.
This task depends upon

Closed by  Nicolas Pennequin (nicolas_p)
Friday, 18 July 2008, 23:33 GMT
Reason for closing:  Fixed
Additional comments about closing:  Same as  FS#8194  . Fixed in r18090. The scrambled sound is a separate issue (see FS#9186).
Comment by Nicolas Pennequin (nicolas_p) - Tuesday, 01 July 2008, 13:36 GMT
So far my attempts to reproduce this issue have been unsuccessful (no flac though, maybe that matters?).
Comment by PaulJam (PaulJam) - Tuesday, 01 July 2008, 19:10 GMT
Unfortunately i have no idea why you can't reproduce it.

I was able to reproduce at least the problem with the too early track change with other file formats too (wav and mp3).
The problem with the noise seems to be restricted to flac (at least i never get it when using other file formats).

The problem is also reproducible in the 64MiB ipod video simulator.

By the way, there is a typo in the first post: it should of course be r17896 for the H300 (and not r19876).
Comment by Magnus Holmgren (learman) - Friday, 11 July 2008, 07:54 GMT
I've seen it too (not the noise bit, but the early skipping), though it was a while ago now. I'd suspect it can happen for any format except MP3 and WavPack (i.e., formats that don't set file_offset towards the end of audio_finish_load_track). It's like it doesn't do a full rebuffer when needed; look at the "buf alloc short" messages in the log.
Comment by PaulJam (PaulJam) - Friday, 11 July 2008, 10:35 GMT
But i'm able to reproduce the early skipping with mp3 too.
It seems as if you are right and it doesn't buffer the entire song when rebuffering. I have been looking at the buffering debug screen and when the skip happens then the usefl buffer does not jump to a lower value. It decrease smoothly during the skip. So it seems as if the end of the song is already missing after rebuffering.
Comment by PaulJam (PaulJam) - Friday, 11 July 2008, 16:08 GMT
the issue with the noise on flac files seems to be a different problem, that only gets triggered by this bug. So i have opened a separate task for that FS#9186.
Comment by Nicolas Pennequin (nicolas_p) - Sunday, 13 July 2008, 11:04 GMT
The recently closed  FS#8194  looks very similar to this issue.