Merge pull request #477 from chme/player

[player] Check player state in stop and pause commands
This commit is contained in:
ejurgensen 2017-12-30 12:53:43 +01:00 committed by GitHub
commit f71028b25d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
{