This is the bug/patch tracker for Rockbox. Click here for more information.
Quick links: Bugs · Patches · Rockbox frontpage
FS#12093 - Playback hanging after codec/playback rework
Attached to Project:
Rockbox
Opened by Andree Buschmann (Buschel) - Tuesday, 03 May 2011, 08:04 GMT+2
Last edited by Michael Sevakis (MikeS) - Monday, 09 May 2011, 23:20 GMT+2
Opened by Andree Buschmann (Buschel) - Tuesday, 03 May 2011, 08:04 GMT+2
Last edited by Michael Sevakis (MikeS) - Monday, 09 May 2011, 23:20 GMT+2
|
DetailsI experienced several hangups during playback in the middle of tracks. Those hangups appeared nearly each 1h of playback. Seek fwd/rwd or play/pause does not solve the issue. Skipping forward lets the next track play normally. The track that formerly hung up can be played normally after a skip.
Player: iPod nano 2G Tracks: mpc / mp3 Hangups occured with mpc only, but that might just be an effect of my music collection which mostly consists of mpc. Thread states: codec *R 16 16 11% (=> always *R, not alternating *R/T) audio T 15 15 57% buffering T 15 15 25% I will attach the .config file later. |
This task depends upon
Closed by Michael Sevakis (MikeS)
Monday, 09 May 2011, 23:20 GMT+2
Reason for closing: Fixed
Additional comments about closing: Reporter says the last patch provided fixes the problem.
Monday, 09 May 2011, 23:20 GMT+2
Reason for closing: Fixed
Additional comments about closing: Reporter says the last patch provided fixes the problem.
Anyway, I thought about it and it might be a good idea to keep moving nonstop (if you hadn't done that when bringing the backlight up) on the scrollwheel just to be absolutely sure about the codec state. If it really is always *R, the thread is trapped in a loop somewhere of some type that is external to playback itself (not even buffering loops waiting for a handle's data should produce that since they sleep) but obviously yields. Perhaps I forgot about something too. :)
You said it can be played normally after a skip. Is it a reproducable pattern of hang in middle->skip->skip back to track->plays normally? Is the track completely buffered?
I'll probably have more questions too.
OS stack debug screen:
===================
S 16 16 10% scroll
B 18 18 33% usb
T/*R 16 16 17% backlight -> *R only very shortly when scrolling the wheel
S 18 18 26% power
S 16 16 30% nand
B 20 20 48% dircache
T 20 20 8% tagcache
T 20 20 34% playlist cachectrl
*R/S 16 16 11% codec -> S only very shortly when scrolling the wheel
T 15 15 57% audio
B 16 16 12% voice
T 15 15 25% buffering
buffering thread debug screen:
========================
pcm 0/529.200
alloc 29.313.567/29.313.568
real 76.019/29.313.568
usefl 54.187/29.313.568
Doesn't this again show that the hangup might have happened when trying to buffer?
Regarding your other questions I can say that "hang in middle"->skip to next track->skip back to track->"plays normally" worked twice for me. I am pretty sure that when skipping to next track re-buffering took place. "hang in middle"->"seek fwd"->"seek rwd" did not get the device back to playback state, the time position and the bar were updated properly though. "hang in middle"->play/pause did not work too, the WPS kept displaying the "Play"-Icon. So, I guess the state of the playback engine did not change.
Edit: FWIW, my iPod Video did not lock up so far (using r29792).
ETA:
To answer your question, yes, rebuffering seems quite certain. I'm not sure why. A queue overflow is possible and must not happen. alloc: full, real: low and useful: low looks interesting though.
Handle count, track count and watermark in the buffering screen might have been useful too.
buffering thread debug screen:
========================
pcm 0/529.200
alloc 29.406.639/29.406.640
real 62.115/29.406.640
usefl 22.147/29.406.640
data_rem 623.147
track count 6
handlecount 16
pcmbufdesc 0/21
watermark 21.500
OS stack debug screen:
===================
*R 16 16 53% main
S 16 16 10% scroll
B 18 18 4% usb
T/*R 16 16 17% backlight -> *R only very shortly when scrolling the wheel
S 18 18 26% power
S 16 16 36% nand
B 20 20 48% dircache
T 20 20 8% tagcache
T 20 20 34% playlist cachectrl
*R/S 16 16 11% codec -> S only very shortly when scrolling the wheel
T 15 15 57% audio
B 16 16 12% voice
T 15 15 25% buffering
Just happened again:
buffering thread debug screen:
========================
pcm 0/529.200
alloc 29.406.639/29.406.640
real 25.703.947/29.406.640
usefl 35.227/29.406.640
data_rem 6.103.683
track count 4
handlecount 8
pcmbufdesc 0/21
watermark 21.125
It seems like you can force the issue when using the buffering thread debug screen and skipping until there is only a minor buffer left (usefl ) and then the playback continue until it would need to rebuffer.
Edit 1: I could reproduce this issue 4-5 time today. The buffering screen always looks very similar: pcm 0, alloc and real nearly filled, usefl nearly empty, pcmbufdesc 0.
Edit 2: It observed that the watermark is set to 0 during rebuffering. Can this cause any unwanted condition in the pcm buffer handling (like "Decode when PCM buffer is below watermark. watermark is =0, we are fine.")?
In both cases, the usefl is above the watermark, but did it just add a small amount of data or quit just before scheduled rebuffering? (Rhetorical atm; I know you might not know that since you'd have to see it at the right time)
The numbers in the buffering screen don't change but are stuck at those values?
When you said, "...then the playback continue until it would need to rebuffer." Does that mean it quits again at the next rebuffer?
usefl indeed sometimes changed (going up by several 100 KB) before rebuffering -- from few 10 KB to some 100 KB's.
> The numbers in the buffering screen don't change but are stuck at those values?
If the playback hangs the numbers in buffering screen do not change at all.
> Does that mean it quits again at the next rebuffer?
No. Bad english :/ I meant to say that you just skip until usefl is so small, that any further skip would immediately result in rebuffering. Then you just wait until the playback engine wants to rebuffer. In some cases it will lock up, in most cases it will rebuffer normally. I just have the impression that you do not need to wait to play the whole buffered data, you can just skip and wait for rebuffering. This saves a lot of time for reproduction.
Now it locks or you mean just stalls without pcm output? I wouldn't call any state that can be exited normally a "lockup".
Next thing I'll do is to check for queue overflows which are really a very bad thing here should they happen. Every message is precious.
ETA:
The premature stop is what is expected if the buffering didn't yet have enough room to complete and collides with ridx or the next handle. Buffer above the watermark won't trigger a proper clear of old handles yet the request cannot complete because of those handles. It was probably due for a refill but a buffer seek caused a handle reset instead of sending the low buffer event, which after that refill for the handle leaves it too full to rebuffer, then it never gets low enough again to rebuffer inside playback. The codec state being anything other than S has me wondering about there being just one more ingredient.
Really, those low buffer events tend to be a nuissance and I don't want it to fire them (risking queue overflows) just to make sure we beat it hard enough.
This really isn't quite proper but should tell if it's the right thing overall. It also removes buf_request_buffer_handle as a buffering API since that function can be considered a kludge because simply asking for data should be what requests buffering automatically if needed. Also ups the plugin API version.
I would like to have this one submitted to have stable playback in svn. You can then further work on smarter solution. What do you think?