diff options
author | Eric Wong <normalperson@yhbt.net> | 2007-09-06 01:07:49 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2007-09-06 01:07:49 +0000 |
commit | 56274fd016faf5ddd9fb0e1d8ec470e4d2070721 (patch) | |
tree | b8a8e9d230f5c31ea124cc55cafd180e46e1b726 /src/decode.c | |
parent | 7024700cc51914c3b93e0fd3747f2c3c99ac484a (diff) | |
download | mpd-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 'src/decode.c')
-rw-r--r-- | src/decode.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/decode.c b/src/decode.c index c66d67fe0..bf3e1cb25 100644 --- a/src/decode.c +++ b/src/decode.c @@ -71,6 +71,7 @@ static void stopDecode(DecoderControl * dc) { if (decode_pid > 0 && (dc->start || dc->state != DECODE_STATE_STOP)) { dc->stop = 1; + kill(decode_pid, SIGCONT); while (decode_pid > 0 && dc->stop) my_usleep(10000); } @@ -126,7 +127,8 @@ static int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) ERROR("problems opening audio device while playing \"%s\"\n", pc->utf8url); \ quitDecode(pc,dc); \ return; \ - } \ + } else if (decode_pid > 0) { \ + kill(decode_pid, SIGCONT); }\ if (pause) { \ dropBufferedAudio(); \ closeAudioDevice(); \ @@ -238,6 +240,8 @@ static int decodeSeek(PlayerControl * pc, DecoderControl * dc, pc->state = PLAYER_STATE_PAUSE; \ } else { \ if (openAudioDevice(NULL) >= 0) { \ + if (decode_pid > 0) \ + kill(decode_pid, SIGCONT); \ pc->state = PLAYER_STATE_PLAY; \ } else { \ pathcpy_trunc(pc->erroredUrl, pc->utf8url); \ @@ -579,9 +583,11 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * race conditions and weirdness */ end = cb->end; - if (pause) - my_usleep(10000); - else if (cb->begin != end && cb->begin != next) { + if (pause) { + if (decode_pid) + kill(decode_pid, SIGSTOP); + kill(getpid(), SIGSTOP); + } else if (cb->begin != end && cb->begin != next) { if (doCrossFade == 1 && next >= 0 && ((next > cb->begin && (fadePosition = next - cb->begin) |