[player] Check player state in stop and pause commands

This commit is contained in:
chme 2017-12-22 08:21:54 +01:00
parent 4274653624
commit 183ac17fd5

View File

@ -1890,6 +1890,12 @@ playback_stop(void *arg, int *retval)
{
struct player_source *ps_playing;
if (player_state == PLAY_STOPPED)
{
*retval = 0;
return COMMAND_END;
}
// We may be restarting very soon, so we don't bring the devices to a full
// stop just yet; this saves time when restarting, which is nicer for the user
*retval = outputs_flush(device_command_cb, last_rtptime + AIRTUNES_V2_PACKET_SAMPLES);
@ -2335,6 +2341,18 @@ playback_pause(void *arg, int *retval)
{
uint64_t pos;
if (player_state == PLAY_STOPPED)
{
*retval = -1;
return COMMAND_END;
}
if (player_state == PLAY_PAUSED)
{
*retval = 0;
return COMMAND_END;
}
pos = source_check();
if (pos == 0)
{