summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2016-12-09 13:02:26 +0100
committerMax Kellermann <max@musicpd.org>2016-12-09 13:02:26 +0100
commite7353ec7e7d15848ef021b0975b74034e7ed62e9 (patch)
treeaa3e42ae3f39b0da58df5e5e035bbd2f0279e00b
parente3237f057dac679a5f2dd4fe6d020e98a5dfab44 (diff)
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
-rw-r--r--NEWS2
-rw-r--r--src/queue/Queue.cxx7
2 files changed, 6 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 28ba89c4d..4fcedd287 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,6 @@
ver 0.19.20 (not yet released)
+* protocol
+ - "setprio" re-enqueues old song if priority has been raised
* decoder
- ffmpeg: ignore empty packets
- pcm: fix corruption bug with partial frames (after short read)
diff --git a/src/queue/Queue.cxx b/src/queue/Queue.cxx
index 99b545ab1..2011b2c13 100644
--- a/src/queue/Queue.cxx
+++ b/src/queue/Queue.cxx
@@ -426,14 +426,15 @@ Queue::SetPriority(unsigned position, uint8_t priority, int after_order)
if (_order < (unsigned)after_order) {
/* the specified song has been played already
- - enqueue it only if its priority has just
- become bigger than the current one's */
+ - enqueue it only if its priority has been
+ increased and is now bigger than the
+ current one's */
const unsigned after_position =
OrderToPosition(after_order);
const Item *after_item =
&items[after_position];
- if (old_priority > after_item->priority ||
+ if (priority <= old_priority ||
priority <= after_item->priority)
/* priority hasn't become bigger */
return true;