Queue: "setprio" re-enqueues old song if priority has been raised

This commit changes a minor queue priority design to something which
makes a little bit more sense.

Previously, a song that had already been played would only be
re-enqueued if its priority had just been raised above the current
song's.  This means that if it was already above, it was not
re-enqueued.  That is a surprising behavior, because users expect a
song to be played when its priority is raised.

Now the song is always re-enqueued if its priority is raised (and
above the current song's - no matter if it has already been above
before).

 https://bugs.musicpd.org/view.php?id=4592
This commit is contained in:
Max Kellermann 2016-12-09 13:02:26 +01:00
parent e3237f057d
commit e7353ec7e7
2 changed files with 6 additions and 3 deletions

2
NEWS
View File

@ -1,4 +1,6 @@
ver 0.19.20 (not yet released) ver 0.19.20 (not yet released)
* protocol
- "setprio" re-enqueues old song if priority has been raised
* decoder * decoder
- ffmpeg: ignore empty packets - ffmpeg: ignore empty packets
- pcm: fix corruption bug with partial frames (after short read) - pcm: fix corruption bug with partial frames (after short read)

View File

@ -426,14 +426,15 @@ Queue::SetPriority(unsigned position, uint8_t priority, int after_order)
if (_order < (unsigned)after_order) { if (_order < (unsigned)after_order) {
/* the specified song has been played already /* the specified song has been played already
- enqueue it only if its priority has just - enqueue it only if its priority has been
become bigger than the current one's */ increased and is now bigger than the
current one's */
const unsigned after_position = const unsigned after_position =
OrderToPosition(after_order); OrderToPosition(after_order);
const Item *after_item = const Item *after_item =
&items[after_position]; &items[after_position];
if (old_priority > after_item->priority || if (priority <= old_priority ||
priority <= after_item->priority) priority <= after_item->priority)
/* priority hasn't become bigger */ /* priority hasn't become bigger */
return true; return true;