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
This commit is contained in:
Warren Dukes
2004-06-19 22:27:29 +00:00
parent 7f15536683
commit dbd79a6b47
5 changed files with 20 additions and 10 deletions

View File

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