vlc | branch: master | Romain Vimont <[email protected]> | Thu May 16 13:02:52 2019 +0200| [d5c1b16b557ed657541ce7aa664b4ba8a87c510c] | committer: Jean-Baptiste Kempf
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 <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d5c1b16b557ed657541ce7aa664b4ba8a87c510c --- src/playlist/player.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/playlist/player.c b/src/playlist/player.c index bbdc39ba0e..6ca6ea0636 100644 --- a/src/playlist/player.c +++ b/src/playlist/player.c @@ -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); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
