FS#8037 - Playback stops when playing mp3 followed by ogg

Attached to Project: Rockbox
Opened by Bertrik Sikken (bertrik) - Sunday, 28 October 2007, 08:52 GMT
Last edited by Steve Bavin (pondlife) - Monday, 05 November 2007, 08:40 GMT
Task Type Bugs
Category Music playback
Status Closed
Assigned To Nicolas Pennequin (nicolas_p)
Operating System Sansa e200
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


With official build 15338, when I have an mp3 playing and select an ogg for playback, music playback continues a few seconds playing the mp3, then stops (not playing the ogg). The e200 seems to be in some kind of confused state now, it still responds to user input, but for example shutting it down results in a 'shutting down...' splash but it doesn't actually shut down.

Playing two oggs after another or two mp3s after another works fine. Playing an mp3 after an ogg works fine too.

In the debug menu, the OS stacks screen shows 89% for the codec thread and 74% for the audio thread. The buffering thread menu shows pcm:0/52900, alloc 29703516/29745984, real 42496/29745984, usefl 8512/29745984.
This task depends upon

Closed by  Steve Bavin (pondlife)
Monday, 05 November 2007, 08:40 GMT
Reason for closing:  Fixed
Additional comments about closing:  Fixed, and Brandon's reworked his code nicely now.
Comment by Bertrik Sikken (bertrik) - Sunday, 28 October 2007, 10:28 GMT
This looks like it's related to MoB.

I tried various versions between 15200 and 15338. It turns out that with 15305 switching from mp3 to ogg still worked, but with 15306 it stopped working. SVN commit 15306 was the MoB commit.
Comment by Nicolas Pennequin (nicolas_p) - Sunday, 28 October 2007, 13:39 GMT
Is this failure consistent? I've been unable to reproduce, so I would be interested in a reproduction recipe.
Comment by Bertrik Sikken (bertrik) - Sunday, 28 October 2007, 13:56 GMT
Yes, it is very reproducible.
In fact, of all the random weirdness I've seen in recent versions since the MoB commit, this can be reproduced every time.

* wipe .rockbox dir on the sansa, install a fresh zip, reboot
* initialize database, reboot when done
* use database menu to select an mp3 and play it
* press select, select an ogg from the music database and play it
-> result: mp3 keeps on playing for a few seconds, ogg never starts, sansa is in confused state now

The oggs and mp3's were tagged using tag&rename 3.0.1
Comment by Nicolas Pennequin (nicolas_p) - Sunday, 28 October 2007, 13:59 GMT
Are you capable of reproducing on the sim? that would be more useful for me as I don't have a sansa. I'll try doing what you say on my gigabeat though.
Comment by Bertrik Sikken (bertrik) - Sunday, 28 October 2007, 14:13 GMT
Correction, the mp3 has a ID3v2.3 written by tag&rename, the ogg has a "Vorbis comment". I tried several mp3's and oggs (with and without genre tags) and the problem does not seem to be limited to any particular mp3/ogg combination.
Comment by Nils Wallménius (nls) - Sunday, 28 October 2007, 22:01 GMT
Does this happen if you play them from the file browser too, or only from database?
Comment by Bertrik Sikken (bertrik) - Sunday, 28 October 2007, 23:03 GMT
Yes, this also happens when playing from the file browser. It does not happen when transitioning from the mp3 to the ogg when they are in the same playlist.
Comment by Thomas Martitz (kugel.) - Monday, 29 October 2007, 11:36 GMT
I've similar problems, just with .m4a files.

(In that order)
-I initialize the database
-I play a m4a or mp3 file --> plays fine
-I switch from mp3 to mp3 or m4a to m4a --> plays fine
-I switch to from m4a to mp3 --> loads but doesn't play (aka shows tags)
-I switch from mp3 to m4a --> loads but doesn't play

When I now switch to mp3 or m4a neither one plays.

Two other things I've noticed:
-When a song doesn't play, and I hold play button for stopping playback, the play freezes, hard shutdown/player reset needed.
-Sometimes (not allways) when a file doesn't play, and I shut down the player normally, it freezes at shutdown.

Sansa e200 and r15353
Comment by Ian Shirey (Joe zip) - Tuesday, 30 October 2007, 03:33 GMT
I noticed this last night (second night I ever ran Rockbox). I'm currently using a e250 running r15370 and was running r15312 when I first noticed it. The formats I try to play are MP3, Flac, NSF, SPC, and SID. I first notcied when I would play a FLAC file then try to play an MP3 file and the unit would lock up. I thought it was the format change, but the play will go from MP3 to FLAC. When it does lock, it will let you change files, but not play any audio. Sometimes if I select the FM tuner when its in this state, the whole player freezes up and needs to be reset by holding the power button for 15sec. When I changed to r15370, the problem eased up a little, although this could have been due to the files too. I've also been having problems with FLAC playback halting randomly, but this seems to be unrelated since this problem seems related with the format change.
Comment by nanok (nanok) - Tuesday, 30 October 2007, 12:07 GMT
i confirm, it is reproducible for me also. thanks bertrik for the receipe. one note: i confirm hanging with the shutdown splash on the screen, but shutdown does occur, only after a much longer time than expected (without having to hold the power botton)

r15331-071027 (so within bertrik's discovered range)
Comment by Steve Bavin (pondlife) - Wednesday, 31 October 2007, 09:19 GMT
I still can't repro this; could somebody who can please attach their config.cfg.

Is it important that the ogg is in a seperate folder to the mp3 (or somewhere where it won't have been pre-buffered)?
Comment by nanok (nanok) - Wednesday, 31 October 2007, 11:43 GMT
hi steve.

update: same behaviour with 15381 build (downloaded this morning)

steve: it seems so, but i will confirm this evening, when i get home and have some time to test.
if the ogg is in the playlist it goes okay (probably because it is buffered in advance). it is on
manual selection that this happens. i do have the ogg in a different dir, everytime. i will test
this evening to see if it really matters/what really matters. i will also attach the cfg, but it
is the one that comes with the build, i do have some themes, but it doesn't seem to matter.

btw: i think it is specific to the sansa target (e200 series, maybe, even)
Comment by Steve Bavin (pondlife) - Wednesday, 31 October 2007, 13:57 GMT
I certainly can't repro on H340, with default settings.

I'd suspect it's only a problem on Flash-based players, rather than just Sansa, but that's a guess.
Comment by Nicolas Pennequin (nicolas_p) - Wednesday, 31 October 2007, 14:23 GMT
I just unsuccessfully tried to make this issue appear on the sim. I think the best thing to do would be for someone to send me a logf dump of the issue. You'd have to enable logf in playback.c and buffering.c by adding or uncommenting #define LOGF_ENABLE, and compile a logf build. Then reproduce the problem, dump the logf buffer to a file (debug > logfdump), and send me the .rockbox/logf.txt file.
Comment by Steve Bavin (pondlife) - Wednesday, 31 October 2007, 14:30 GMT
Clutching at straws a bit, perhaps there's more to this than codec (e.g. bitrate). Perhaps someone who's got the problem could try to reproduce it in the simulator?
Comment by Thomas Martitz (kugel.) - Wednesday, 31 October 2007, 14:41 GMT
I can't repoduce reproduce it on the sim.
Comment by nanok (nanok) - Wednesday, 31 October 2007, 19:08 GMT
update: ogg prebuffered or not: not relevant, behaviour is the same
bitrate of ogg: not relevant, i have various bitrate ones, most variable anyway (not sure if constant also, must check)
bitrate of mp3: not relevant
ogg in same dir as mp3: not relevant
wma instead of mp3: all seems fine (though the playing does continue for a few seconds, like switching from mp3 to ogg, but
the ogg does play fine eventually)
(allready known, but for an overview)
ogg to ogg: works fine
ogg to mp3: works fine

anybody else managed to reproduce on anything that is not a sansa (or even sansa e200)? if not, maybe we should rename this to not confuse developers trying to help into testing on something else?
Comment by nanok (nanok) - Wednesday, 31 October 2007, 19:21 GMT
one more note: seeking in the song, after the breakage occurs, seems to work, surprisingly enough, but playing never actually starts
Comment by Bertrik Sikken (bertrik) - Wednesday, 31 October 2007, 21:35 GMT
Here a logf, produced as follows:
* installed svn 15386 on a sansa e200, rebooted
* used database to start playback of an mp3 song (part of an album)
* used database to start playback of an ogg song (part of an album, in a different directory)
* (mp3 kept playing for some seconds, ogg didn't start)
* went straight to debug menu to dump logf
   logf.txt (2.4 KiB)
Comment by Bertrik Sikken (bertrik) - Wednesday, 31 October 2007, 23:26 GMT
Disregard that logf.txt file. It's an old one and wasn't made with SVN 15386. I'll make a new one tomorrow.
Comment by nanok (nanok) - Wednesday, 31 October 2007, 23:49 GMT
further findings (which might help or not):

- stoping the playback of the mp3 (pause really. don't know how to "stop") and selecting an ogg
afterwards yelds the same result
- after the playback breaks, trying to switch to fm radio brings the player in the state where a
"hard" poweroff is needed
Comment by Thomas Martitz (kugel.) - Thursday, 01 November 2007, 13:24 GMT
I think r15390 fixed it (or at least works around). I cannot reproduce the error anymore.

However I cannot test with FM radio, as I have a EU Sansa.
Comment by nanok (nanok) - Thursday, 01 November 2007, 14:08 GMT
great. the fm issue was just a result of the state the sansa was allready in, i think.

but i will test this evening and let you know. can't wait ;)

ps: mine is bought in eu also. it seems vendors don;t really do what sandisk tells them,
or maybe the rule is not set in stone..
Comment by nanok (nanok) - Thursday, 01 November 2007, 18:52 GMT
i confirm, i cannot reproduce the issue either with the latest build. there is still that "lag" (mp3 continues playing for a second or two), but ogg plays fine after

ps: really sorry about the duplicate posts, the behaviour on refresh is very strange. can somebody help deleting those? :(
Comment by Nicolas Pennequin (nicolas_p) - Thursday, 01 November 2007, 18:57 GMT
I deleted the duplicate posts.
About the bug, I need to look closely at Brandon's commit and come up with a clean way of implementing it, so I'm leaving the task open for now :)
Comment by Bertrik Sikken (bertrik) - Sunday, 04 November 2007, 16:55 GMT
I cannot reproduce this anymore with SVN 15460 (thanks to lostlogic who did a lot of bugfixing this weekend).