aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/decode.c')
-rw-r--r--src/decode.c11
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) {