mirror of
https://github.com/owntone/owntone-server.git
synced 2025-01-15 00:35:03 -05:00
Move last_active check into the device add case
This commit is contained in:
parent
cd8686be82
commit
01df67ceb6
32
src/player.c
32
src/player.c
@ -2916,22 +2916,6 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||||||
|
|
||||||
DPRINTF(E_DBG, L_PLAYER, "Found AirTunes device %" PRIx64 "/%s (%d)\n", id, at_name, port);
|
DPRINTF(E_DBG, L_PLAYER, "Found AirTunes device %" PRIx64 "/%s (%d)\n", id, at_name, port);
|
||||||
|
|
||||||
/* Check if the device was selected last time */
|
|
||||||
if (time(NULL) < dev_deadline)
|
|
||||||
{
|
|
||||||
player_get_status(&status);
|
|
||||||
|
|
||||||
if (status.status != PLAY_STOPPED)
|
|
||||||
last_active = 0;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ret = db_config_has_tuple_hex64(VAR_ACTIVE_SPK, id);
|
|
||||||
last_active = (ret == 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
last_active = 0;
|
|
||||||
|
|
||||||
if (port < 0)
|
if (port < 0)
|
||||||
{
|
{
|
||||||
/* Device stopped advertising */
|
/* Device stopped advertising */
|
||||||
@ -3071,6 +3055,22 @@ raop_device_cb(const char *name, const char *type, const char *domain, const cha
|
|||||||
encrypt = 0;
|
encrypt = 0;
|
||||||
|
|
||||||
no_am:
|
no_am:
|
||||||
|
/* Check if the device was selected last time */
|
||||||
|
if (time(NULL) < dev_deadline)
|
||||||
|
{
|
||||||
|
player_get_status(&status);
|
||||||
|
|
||||||
|
if (status.status != PLAY_STOPPED)
|
||||||
|
last_active = 0;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret = db_config_has_tuple_hex64(VAR_ACTIVE_SPK, id);
|
||||||
|
last_active = (ret == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
last_active = 0;
|
||||||
|
|
||||||
pthread_mutex_lock(&dev_lck);
|
pthread_mutex_lock(&dev_lck);
|
||||||
|
|
||||||
for (rd = dev_list; rd; rd = rd->next)
|
for (rd = dev_list; rd; rd = rd->next)
|
||||||
|
Loading…
Reference in New Issue
Block a user