[player] Fix autoselect so it also applies when there are no selected devices

Regression in version 27.2. Closes #1091.
This commit is contained in:
ejurgensen 2020-09-06 00:12:15 +02:00
parent 500f57ba1a
commit 2345885f19
1 changed files with 5 additions and 4 deletions

View File

@ -2078,11 +2078,12 @@ playback_start_item(void *arg, int *retval)
// device_shutdown_cb, since the unselected devices shouldn't have sessions.
*retval = outputs_start(device_activate_cb, device_shutdown_cb, false);
if (*retval < 0)
{
DPRINTF(E_LOG, L_PLAYER, "All selected speakers failed to start\n");
DPRINTF(E_LOG, L_PLAYER, "All selected speakers failed to start\n");
// All selected devices failed, autoselect an unselected (if enabled)
for (device = outputs_list(); (*retval < 0) && speaker_autoselect && device; device = device->next)
// autoselect also applies in non-error cases (if no devices were selected)
if (speaker_autoselect && outputs_sessions_count() == 0)
{
for (device = outputs_list(); (*retval < 0) && device; device = device->next)
{
if (!device->selected && outputs_priority(device) != 0 && !device->session)
*retval = outputs_device_start(device, device_activate_cb, false);