Set a flag if we've sent the player process SIGSTOP so that we know not to
wait for it to complete an action which it never will. git-svn-id: https://svn.musicpd.org/mpd/trunk@6488 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
10860b33d4
commit
01faa6f4e3
12
src/player.c
12
src/player.c
@ -110,11 +110,13 @@ void player_sigChldHandler(int pid, int status)
|
|||||||
|
|
||||||
int playerInit(void)
|
int playerInit(void)
|
||||||
{
|
{
|
||||||
|
PlayerControl *pc = &(getPlayerData()->playerControl);
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
pid = player_pid;
|
pid = player_pid;
|
||||||
if (pid > 0) {
|
if (pid > 0) {
|
||||||
kill(pid, SIGCONT);
|
kill(pid, SIGCONT);
|
||||||
|
pc->wait = 0;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,8 +126,6 @@ int playerInit(void)
|
|||||||
{
|
{
|
||||||
clock_t start = clock();
|
clock_t start = clock();
|
||||||
|
|
||||||
PlayerControl *pc = &(getPlayerData()->playerControl);
|
|
||||||
|
|
||||||
unblockSignals();
|
unblockSignals();
|
||||||
|
|
||||||
setSigHandlersForDecoder();
|
setSigHandlersForDecoder();
|
||||||
@ -184,16 +184,22 @@ int playerInit(void)
|
|||||||
|
|
||||||
int playerWait(int fd)
|
int playerWait(int fd)
|
||||||
{
|
{
|
||||||
|
PlayerControl *pc = &(getPlayerData()->playerControl);
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
|
if (pc->wait)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (playerStop(fd) < 0)
|
if (playerStop(fd) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
playerCloseAudio();
|
playerCloseAudio();
|
||||||
|
|
||||||
pid = player_pid;
|
pid = player_pid;
|
||||||
if (pid > 0)
|
if (pid > 0) {
|
||||||
|
pc->wait = 1;
|
||||||
kill(pid, SIGSTOP);
|
kill(pid, SIGSTOP);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@
|
|||||||
#define PLAYER_METADATA_STATE_WRITE 2
|
#define PLAYER_METADATA_STATE_WRITE 2
|
||||||
|
|
||||||
typedef struct _PlayerControl {
|
typedef struct _PlayerControl {
|
||||||
|
volatile mpd_sint8 wait;
|
||||||
volatile mpd_sint8 stop;
|
volatile mpd_sint8 stop;
|
||||||
volatile mpd_sint8 play;
|
volatile mpd_sint8 play;
|
||||||
volatile mpd_sint8 pause;
|
volatile mpd_sint8 pause;
|
||||||
|
@ -118,6 +118,7 @@ void initPlayerData(void)
|
|||||||
buffered_chunks * sizeof(mpd_sint8));
|
buffered_chunks * sizeof(mpd_sint8));
|
||||||
buffer->acceptMetadata = 0;
|
buffer->acceptMetadata = 0;
|
||||||
|
|
||||||
|
playerData_pd->playerControl.wait = 0;
|
||||||
playerData_pd->playerControl.stop = 0;
|
playerData_pd->playerControl.stop = 0;
|
||||||
playerData_pd->playerControl.pause = 0;
|
playerData_pd->playerControl.pause = 0;
|
||||||
playerData_pd->playerControl.play = 0;
|
playerData_pd->playerControl.play = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user