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:
11
src/decode.c
11
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) {
|
||||
|
||||
Reference in New Issue
Block a user