Commit d5c1b16b authored by Romain Vimont's avatar Romain Vimont Committed by Jean-Baptiste Kempf
Browse files

playlist: update the randomizer on media change



When the player notifies that the current media has changed, it must be
considered "selected" by the randomizer.

Otherwise, when the player requests the next media to play, the playlist
will always "peek" the same next item from the randomizer, which will
never actually "select" it.
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent c1625943
......@@ -48,8 +48,19 @@ player_on_current_media_changed(vlc_player_t *player, input_item_t *new_media,
/* nothing to do */
return;
ssize_t index = new_media ? vlc_playlist_IndexOfMedia(playlist, new_media)
: -1;
ssize_t index;
if (new_media)
{
index = vlc_playlist_IndexOfMedia(playlist, new_media);
if (index != -1)
{
vlc_playlist_item_t *item = playlist->items.data[index];
if (playlist->order == VLC_PLAYLIST_PLAYBACK_ORDER_RANDOM)
randomizer_Select(&playlist->randomizer, item);
}
}
else
index = -1;
struct vlc_playlist_state state;
vlc_playlist_state_Save(playlist, &state);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment