[httpd_dacp] New fix attempt for issue #423 - revision number handling

Commit 190e37e was wrong, we can't just update revision number every time, we
should not do it when we are called with 0 or 1 as revision-number. In those
cases we must return the revision number the client should use, which should
either be the current pending (if other clients are waiting) or the number
following what was used last time we were called with > 1 rev num.

Hopefully this fixes Hyperfine issues.
This commit is contained in:
ejurgensen 2017-10-30 20:16:34 +01:00
parent 79b2cf4fd7
commit b7f5070ad3

View File

@ -146,7 +146,7 @@ static int update_pipe[2];
#endif
static struct event *updateev;
/* Next revision number the client should call with */
static int next_rev;
static int current_rev;
/* Play status update requests */
static struct dacp_update_request *update_requests;
@ -266,8 +266,7 @@ make_playstatusupdate(struct evbuffer *evbuf)
dmap_add_int(psu, "mstt", 200); /* 12 */
next_rev++;
dmap_add_int(psu, "cmsr", next_rev); /* 12 */
dmap_add_int(psu, "cmsr", current_rev); /* 12 */
dmap_add_char(psu, "caps", status.status); /* 9 */ /* play status, 2 = stopped, 3 = paused, 4 = playing */
dmap_add_char(psu, "cash", status.shuffle); /* 9 */ /* shuffle, true/false */
@ -358,6 +357,8 @@ playstatusupdate_cb(int fd, short what, void *arg)
goto out_free_evbuf;
}
current_rev++;
ret = make_playstatusupdate(update);
if (ret < 0)
goto out_free_update;
@ -2750,7 +2751,7 @@ dacp_init(void)
int i;
int ret;
next_rev = 1;
current_rev = 2;
update_requests = NULL;
#ifdef HAVE_EVENTFD