mirror of
https://github.com/owntone/owntone-server.git
synced 2025-04-24 12:30:38 -04:00
[player] Clear up return value of outputs_start()
Should return 0 if no devices at all, or if none selected. Should not return negative from failure to stop unselected devices.
This commit is contained in:
parent
7040382688
commit
500f57ba1a
@ -1018,19 +1018,27 @@ outputs_start(output_status_cb started_cb, output_status_cb stopped_cb, bool onl
|
|||||||
{
|
{
|
||||||
struct output_device *device;
|
struct output_device *device;
|
||||||
int pending = 0;
|
int pending = 0;
|
||||||
int ret = -1;
|
int ret;
|
||||||
|
|
||||||
for (device = outputs_device_list; device; device = device->next)
|
for (device = outputs_device_list; device; device = device->next)
|
||||||
{
|
{
|
||||||
if (device->selected)
|
if (device->selected)
|
||||||
ret = outputs_device_start(device, started_cb, only_probe);
|
|
||||||
else
|
|
||||||
ret = outputs_device_stop(device, stopped_cb);
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pending += ret;
|
ret = outputs_device_stop(device, stopped_cb);
|
||||||
|
if (ret > 0)
|
||||||
|
pending += ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = 0; // We don't care about devices that returned an error on stop
|
||||||
|
for (device = outputs_device_list; device; device = device->next)
|
||||||
|
{
|
||||||
|
if (!device->selected)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ret = outputs_device_start(device, started_cb, only_probe);
|
||||||
|
if (ret > 0)
|
||||||
|
pending += ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (pending > 0) ? pending : ret;
|
return (pending > 0) ? pending : ret;
|
||||||
@ -1045,9 +1053,6 @@ outputs_stop(output_status_cb cb)
|
|||||||
|
|
||||||
for (device = outputs_device_list; device; device = device->next)
|
for (device = outputs_device_list; device; device = device->next)
|
||||||
{
|
{
|
||||||
if (!device->session)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ret = outputs_device_stop(device, cb);
|
ret = outputs_device_stop(device, cb);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user