diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-06-19 22:27:29 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-06-19 22:27:29 +0000 |
commit | dbd79a6b47d1cf09f3ccc8df5ef1a8e1dfedd853 (patch) | |
tree | efa08ce06db6b210c91d8f2bf82d21a89975efa2 /src/decode.c | |
parent | 7f1553668329eb155629ef5a07b9161a26267d80 (diff) | |
download | mpd-dbd79a6b47d1cf09f3ccc8df5ef1a8e1dfedd853.tar.gz mpd-dbd79a6b47d1cf09f3ccc8df5ef1a8e1dfedd853.tar.xz mpd-dbd79a6b47d1cf09f3ccc8df5ef1a8e1dfedd853.zip |
fix a few bugs in mp3_decode and minimize alsa underruns by playing silence when switch songs
git-svn-id: https://svn.musicpd.org/mpd/trunk@1572 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/decode.c')
-rw-r--r-- | src/decode.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/decode.c b/src/decode.c index b7ded74da..e81cddb76 100644 --- a/src/decode.c +++ b/src/decode.c @@ -98,6 +98,12 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) { return (int)chunks; } +#define playSilenceOrSleep() \ + if(isAudioDeviceOpen()) { \ + playAudio(silence, CHUNK_SIZE); \ + } \ + else my_usleep(10000); + #define handleDecodeStart() \ if(decodeWaitedOn) { \ if(dc->state!=DECODE_STATE_START && *decode_pid > 0 && \ @@ -128,7 +134,7 @@ int calculateCrossFadeChunks(PlayerControl * pc, AudioFormat * af) { return; \ } \ else { \ - my_usleep(10000); \ + my_usleep(10000); \ continue; \ } \ } @@ -462,9 +468,8 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) { dc->state!=DECODE_STATE_STOP) { processDecodeInput(); - handleDecodeStart(); if(quit) return; - my_usleep(10000); + playSilenceOrSleep(); } while(!quit) { |