FS#8977 - Buggy playback behavior in r17109 with rewinding the first song.

Attached to Project: Rockbox
Opened by Akio Idehara (idak) - Saturday, 10 May 2008, 03:48 GMT
Last edited by Nicolas Pennequin (nicolas_p) - Monday, 30 June 2008, 16:25 GMT
Task Type Bugs
Category Music playback
Status Closed
Assigned To Nicolas Pennequin (nicolas_p)
Operating System SW-codec
Severity Critical
Priority Normal
Reported Version Daily build (which?)
Due in Version Version 3.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Description of problem:
Buggy playback behavior occurs in r17430 with rewinding the first song.
This behavior occurs with iPod 5G 60GB (sim and real).
This does not occur in r17108.
So I think that r17109's change is the cause.

Steps to Reproduce:
(0) download "*.flac" file and cover.bmp from the following URL
and put those into the same directory.
(1) change wps theme to cabbiev2
(2) play 01.flac
(3) play 08.flac with the rewind button while playing 01.flac

Actual results:
o real target:
Next song will be 05.flac

o simulator:
Next song will be 02.flac

Expected results:
Next song should be 01.flac
This task depends upon

Closed by  Nicolas Pennequin (nicolas_p)
Monday, 30 June 2008, 16:25 GMT
Reason for closing:  Fixed
Additional comments about closing:  r17891
Comment by Marc Guay (Marc_Guay) - Thursday, 26 June 2008, 13:46 GMT
Could not reproduce on e200, h300 or the iPod Video simulator (r17802).
Comment by Akio Idehara (idak) - Thursday, 26 June 2008, 21:38 GMT
This behavior still occur with r17802 on my iPod Video simulator.
Comment by Marc Guay (Marc_Guay) - Friday, 27 June 2008, 00:43 GMT
Okay, maybe I don't understand step 3 exactly, then. Could you try and explain it another way?
Comment by Rob White (tyke101) - Saturday, 28 June 2008, 10:06 GMT
I'm sure I'm seeing this bug, or at least something related to it.
This is 100% reproducible for me.
I'm using build 17825 on IAudio M5L.
This happens with Cabbie2 WPS, but also other WPS.
A WPS that shows the current and next track number as well as playlist number makes this bug much more visible.

1) From off, begin with the player stopped and no current playlist (eg. after a clean install of r17825):
2) Start playing by selecting first track on an album using Files menu. Wait for disc activity to end.
3) WPS shows playing track 1, next track 2. Track 1 is playing.
4) Fast-forward into first track by approx 60 seconds.
5) Wait 5 seconds then press back to restart track 1. Wait for disc activity to end.
6) WPS shows playing track 1, next track 2. Track 1 is playing.
7) Press next. Player moves to next track.
8) WPS show playing track 2, next track 5. Track 2 is playing.
9) Press next. Player moves to next track.
10) WPS shows playing track 5, next track 6. Track 5 is playing.
11) Go to main menu, select Playlists->View Current Playlist.
12) Current playlist shows track 3 is playing - this conflicts with WPS and what's actually playing.

At step 5 (when restarting track 1), sometimes track 3 is briefly shown in the next track field then quickly replaced by track 2. But this is hard to reproduce because I suspect something happens that's usually too quick to show up on the WPS.

Steps 6-12 aren't really necessary, but they show the bug much more quickly. Instead you can just let Rockbox play through the first two tracks and the same bug occurs (ie. player goes from track 2 to 5).

By the end I expect track 3 to be playing (as shown in the current playlist), however track 5 is playing (as shown in WPS). I expect the current playlist and WPS and to be consistent.

All my music is in OGG format. I reproduced this with a clean install of r17825 and all settings were as their default value.

I often restart the first track after correcting the volume if I wasn't happy with the volume to be begin with. So I often get this bug whenever I start an album, fix the volume, then restart the album.

Hope this helps,
Comment by Nicolas Pennequin (nicolas_p) - Monday, 30 June 2008, 07:10 GMT
Here is a patch which I believe fixes the issue. I haven't been able to commit it yet due to a crappy internet connection at the hotel, so I'm posting it here for now... please try it out :)
Comment by Nicolas Pennequin (nicolas_p) - Monday, 30 June 2008, 09:20 GMT
btw, here is a reliable reproduction recipe I discovered during my attempts to fix this issue:
- resume playback "in the middle" of a track
- let it play until disk activity stops (you can check progress in the buffering debug screen)
- fast forward a bit (I'm 99% sure this isn't needed, as it shouldn't have any effect on what's in the buffer)
- skip back to the beginning of the track. Rebuffering will occur.

Without the patch, the issue should have appeared: the next tracks won't be the right ones (some are skipped). It is easiest to spot with an album where the files are numbered.
Comment by Akio Idehara (idak) - Monday, 30 June 2008, 13:14 GMT
This patch works fine on my iPod Video (real & sim).
Many Thanks! :)
Comment by Marc Guay (Marc_Guay) - Monday, 30 June 2008, 15:57 GMT
Looking good Nico! Couldn't reproduce this bug with the patch and I tried my best to make playback lockup with violent track-skipping and couldn't.