FS#10477 - flac_seek may fail after 10 frame_sync attempts

Attached to Project: Rockbox
Opened by Boris Gjenero (dreamlayers) - Friday, 31 July 2009, 05:06 GMT
Last edited by Andrew Ryabinin (mortalis) - Monday, 18 November 2013, 07:00 GMT
Task Type Bugs
Category Codecs
Status Closed
Assigned To No-one
Operating System SW-codec
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


With one particular FLAC/CUE combination, if I try to seek to track 2 in the CUE, I end up in the next file in the playlist. This happens because flac_sync fails to sync in 10 tries at one point. Then, flac_seek fails, flac_decode_frame fails, and the codec returns CODEC_ERROR.

I am attaching "frame_sync problem.flac", which consists of two frames cut from the FLAC file. The file seek gets to what corresponds to offset 0x5F9, a place inside the first frame. The code ought to find the second frame, but it gives up after 10 tries in the "for(unparseable_count" loop. Increasing the limit to 20 ("unparseable_count < 20") causes the seek to succeed, but that is probably a workaround, and not an ideal fix.

The same file also triggered  FS#10476 . However, I think that bug is not related.

I noticed the problem on my 5G iPod running r22076, and I performed debugging on the r22076 5G iPod sim.
This task depends upon

Closed by  Andrew Ryabinin (mortalis)
Monday, 18 November 2013, 07:00 GMT
Reason for closing:  Fixed
Additional comments about closing:  Commited as b770f63.