aboutsummaryrefslogtreecommitdiffstats
path: root/src/player.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2007-09-06 01:07:49 +0000
committerEric Wong <normalperson@yhbt.net>2007-09-06 01:07:49 +0000
commit56274fd016faf5ddd9fb0e1d8ec470e4d2070721 (patch)
treeb8a8e9d230f5c31ea124cc55cafd180e46e1b726 /src/player.c
parent7024700cc51914c3b93e0fd3747f2c3c99ac484a (diff)
downloadmpd-56274fd016faf5ddd9fb0e1d8ec470e4d2070721.tar.gz
mpd-56274fd016faf5ddd9fb0e1d8ec470e4d2070721.tar.xz
mpd-56274fd016faf5ddd9fb0e1d8ec470e4d2070721.zip
Once again get rid of busy waiting and use SIGSTOP for pause
The problems I had were related to the OSS driver and USB device I was using. The problems existed even with the old busy-waiting scheme enabled. OSS - Bithead USB => bad ALSA - Bithead USB => OK OSS - Onboard i8x0 => OK ALSA - Onboard i8x0 => OK bad - slow shutdown, pauses, dropped audio after pause/resume git-svn-id: https://svn.musicpd.org/mpd/trunk@6861 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/player.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/player.c b/src/player.c
index c53a6ae1d..d73b0a0e1 100644
--- a/src/player.c
+++ b/src/player.c
@@ -231,6 +231,8 @@ int playerPlay(int fd, Song * song)
}
resetPlayerMetadata();
+ if (player_pid > 0 && pc->state == PLAYER_STATE_PAUSE)
+ kill(player_pid, SIGCONT);
while (player_pid > 0 && pc->play)
my_usleep(1000);
@@ -243,6 +245,8 @@ int playerStop(int fd)
if (player_pid > 0 && pc->state != PLAYER_STATE_STOP) {
pc->stop = 1;
+ if (pc->state == PLAYER_STATE_PAUSE)
+ kill(player_pid, SIGCONT);
while (player_pid > 0 && pc->stop)
my_usleep(1000);
}
@@ -270,6 +274,8 @@ int playerPause(int fd)
if (player_pid > 0 && pc->state != PLAYER_STATE_STOP) {
pc->pause = 1;
+ if (player_pid > 0 && pc->state == PLAYER_STATE_PAUSE)
+ kill(player_pid, SIGCONT);
while (player_pid > 0 && pc->pause)
my_usleep(1000);
}
@@ -377,6 +383,8 @@ void playerCloseAudio(void)
if (playerStop(STDERR_FILENO) < 0)
return;
pc->closeAudio = 1;
+ if (pc->state == PLAYER_STATE_PAUSE)
+ kill(player_pid, SIGCONT);
while (player_pid > 0 && pc->closeAudio)
my_usleep(1000);
}
@@ -422,6 +430,8 @@ void playerQueueLock(void)
PlayerControl *pc = &(getPlayerData()->playerControl);
if (player_pid > 0 && pc->queueLockState == PLAYER_QUEUE_UNLOCKED) {
+ if (pc->state == PLAYER_STATE_PAUSE)
+ kill(player_pid, SIGCONT);
pc->lockQueue = 1;
while (player_pid > 0 && pc->lockQueue)
my_usleep(1000);
@@ -433,6 +443,8 @@ void playerQueueUnlock(void)
PlayerControl *pc = &(getPlayerData()->playerControl);
if (player_pid > 0 && pc->queueLockState == PLAYER_QUEUE_LOCKED) {
+ if (pc->state == PLAYER_STATE_PAUSE)
+ kill(player_pid, SIGCONT);
pc->unlockQueue = 1;
while (player_pid > 0 && pc->unlockQueue)
my_usleep(1000);
@@ -464,6 +476,8 @@ int playerSeek(int fd, Song * song, float time)
resetPlayerMetadata();
pc->seekWhere = time;
pc->seek = 1;
+ if (player_pid > 0 && pc->state == PLAYER_STATE_PAUSE)
+ kill(player_pid, SIGCONT);
while (player_pid > 0 && pc->seek)
my_usleep(1000);
}