FS#11495 - playback of atrac3_rm files sometimes fails.

Attached to Project: Rockbox
Opened by Nils Wallménius (nls) - Saturday, 24 July 2010, 09:33 GMT
Last edited by Andree Buschmann (Buschel) - Wednesday, 27 April 2011, 20:14 GMT
Task Type Bugs
Category Codecs
Status Closed
Assigned To No-one
Operating System SW-codec
Severity Low
Priority Normal
Reported Version Release 3.6
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


If i start playback of a track and then swithc to a atrac3_rm file i sometimes get "codec failure" on my h300. Starting to play the file when playback is stopped seems to work fine all the time. I could not reproduce this on the simulator or on my gigabeat S.

logf prints "parsing packets failed" from librm/rm.c:520
and then "rm_get_packet failed" from atrac3_rm.c:114

Edit again:
this is the file
This task depends upon

Closed by  Andree Buschmann (Buschel)
Wednesday, 27 April 2011, 20:14 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed with submission of playback engine rework (r29785).
Comment by Andree Buschmann (Buschel) - Saturday, 24 July 2010, 20:09 GMT
This may be an endianess issue. When taking a look at the read functions there are "be" and "le" defined to read from the given buffer. Those are used the same way for all targets (even though targets differ in their endianess)... For a single target "be" and "le" version are used... Maybe Mohamed Tarek can give more input here.

Edit: On the other hand endianess issues should show such error always and not only sometimes...
Comment by Andree Buschmann (Buschel) - Thursday, 03 February 2011, 13:01 GMT
I have similar issues on my iPod Video. The failure cannot be reproduced in sim.

Have a folder with the following files:
1) DearJohn.rm
2) FUN_RM_132.rm
3) GoodbyeCaroline.rm
4) KingOfTheJailHouse.rm

A) When playing 1) and then start to play 2) vie directly selecting 2) from the filebrowser, track 2) is not played. Playback skips to 3)
B) When playing 1) and then skip to 2), track 2) plays fine.
C) When coming from another codec (e.g. mp3) and directly selecting track 2) from the file browser it plays fine.
D) Track 4) behaves exactly like track 2).

To me this looks like a re-initialization error.
Question i: What is the difference between skip fwd and selecting from file browser?
Question ii: What happens when rentering the codec?
Comment by Andree Buschmann (Buschel) - Thursday, 03 February 2011, 16:25 GMT
After lots of code changes the best way to work around this issue is to add a sleep() (see patch). With this patch I could only very rarely reproduce the issue.

To me this looks like some timing thing (the CPU load for atrac3 is really high on PP502x!). Is it possible that the id3v2 metadata which is parsed by the decoder is not filled in time? This could explain why this only happens when