Rockbox

Tasklist

FS#10288 - Resume after "Insert Shuffled" incorrect.

Attached to Project: Rockbox
Opened by Paul Louden (Llorean) - Saturday, 06 June 2009, 18:17 GMT
Last edited by Jonathan Gordon (jdgordon) - Thursday, 21 January 2010, 07:28 GMT
Task Type Bugs
Category Playlists
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

Details

This one's easy to reproduce. With music stopped, do "Insert Shuffled" on a folder. You're in playlist position 1 at this point (first song out of however many you just inserted). Stop playback. Resume playback. You'll be in the same song, but it will now be in an entirely different location in the playlist.

Still occurs as of 21199
This task depends upon

Closed by  Jonathan Gordon (jdgordon)
Thursday, 21 January 2010, 07:28 GMT
Reason for closing:  Accepted
Additional comments about closing:  thanks! in r24303.
Comment by Paul Louden (Llorean) - Saturday, 06 June 2009, 19:43 GMT
To clarify: the playlist is apparently rotated. The order is the same, but the playlist positions are rotated.
Comment by Dave Hooper (stripwax) - Sunday, 12 July 2009, 12:32 GMT
I can't reproduce this on ipod5g sim. The dynamic playlist appears to be the same after folder insert shuffled, as it does after subsequently stopping and resuming.
Comment by Tomasz Kowalczyk (mitk) - Saturday, 16 January 2010, 11:10 GMT
I can reproduce it on real fuze and on fuze sim as well.
Comment by Jonathan Gordon (jdgordon) - Monday, 18 January 2010, 07:49 GMT
Right, well im confused tired and wondering WTF?

guarenteed repro:
stop playback, "insert shuffled" on a folder. not the playlist order. stop playback, resume playback, not the order.

recreating the playlist by hand from the .playlist_control gives me the correct order (unsurprising really) which means I think the issue is that the files arnt being inserted where the playlist_control thinks they are.

edit: well creation looks correct also :(
Comment by Tomasz Kowalczyk (mitk) - Monday, 18 January 2010, 08:26 GMT
Order is disturbed during playback stop before resume. Please take a look at playlist after playback stop.

Other observation based on inserting directory with 3 songs and .playlist_control |position| value after directory insertion:
000, 001, 010, 002 - error after playback stop
011, 012 - everything ok
It's looks like error happens only when any song is inserted before first song in playlist.

Is there any .doc about playlist concept and implementation? I've found only few lines in playlist.c but nothing in deep.
Can playlist->index and playlist->first_index have negative value?
Comment by Jonathan Gordon (jdgordon) - Monday, 18 January 2010, 08:35 GMT
what gives you the idea that its breaking between stop and resume? (and on which side of the "no audio" gap?)

I dont think there is any docs for this, its all pretty old code :/

I *think* playlist->index is the index of the current tack, and first_index is the index of the first track in the playlist. neither should be <0 if thats correct.
Comment by Tomasz Kowalczyk (mitk) - Monday, 18 January 2010, 09:14 GMT
I think it happens during stopping playback. Test it as follows:
1. turn on sim/device
2. insert_shuffled directory
3. Take a look at: Main_Menu->Playlists->View_Current_Playlist - everything is ok and in line with .playlist_control content
4. Turn back to Main_Menu->Playlists
5. Stop playback pressing Home for fuze/fuze sim or something else for other players
6. Again take a look at: Main_Menu->Playlists->View_Current_Playlist - you will see rolled playlist not in sync with .playlist_control

I agree with playlist->index and first index meaning but concerning negative values i found following code

playlist.c
797 : if (insert_position < playlist->last_insert_pos ||
798 : (insert_position == playlist->last_insert_pos && position < 0))
799 : playlist->last_insert_pos++;

Position can be negative?

Comment by Jonathan Gordon (jdgordon) - Monday, 18 January 2010, 18:04 GMT
if position is still negative at 798 then its a bug... I don't tihnk it should be able to be.
position can be negative (PLAYLIST_INSERT* are defined to negative values)
Comment by Tomasz Kowalczyk (mitk) - Wednesday, 20 January 2010, 16:52 GMT
Got it and here is the patch.
Comment by Jonathan Gordon (jdgordon) - Wednesday, 20 January 2010, 17:07 GMT
sweet!

Loading...