diff options
Diffstat (limited to '')
-rw-r--r-- | src/decode.c | 11 | ||||
-rw-r--r-- | src/outputBuffer.c | 7 | ||||
-rw-r--r-- | src/player.c | 2 |
3 files changed, 11 insertions, 9 deletions
diff --git a/src/decode.c b/src/decode.c index 2d4b137f5..656b7313a 100644 --- a/src/decode.c +++ b/src/decode.c @@ -481,10 +481,10 @@ static void advanceOutputBufferTo(OutputBuffer * cb, PlayerControl * pc, while (cb->begin != to) { handleMetadata(cb, pc, previous, currentChunkSent, currentChunk); - cb->begin++; - if (cb->begin >= buffered_chunks) { + if (cb->begin + 1 >= buffered_chunks) { cb->begin = 0; } + else cb->begin++; } } @@ -517,7 +517,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * pc->play = 0; kill(getppid(), SIGUSR1); - while (decode_pid > 0 && cb->end - cb->begin < bbp && + while (decode_pid > 0 && + cb->end - cb->begin < bbp && cb->end != buffered_chunks - 1 && dc->state != DECODE_STATE_STOP) { processDecodeInput(); @@ -618,10 +619,10 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb->begin = 0; } else cb->begin++; - } else if (next == cb->begin) { + } else if (cb->begin != end && cb->begin == next) { if (doCrossFade == 1 && nextChunk >= 0) { nextChunk = cb->begin + crossFadeChunks; - test = cb->end; + test = end; if (end < cb->begin) test += buffered_chunks; if (nextChunk < test) { diff --git a/src/outputBuffer.c b/src/outputBuffer.c index c27a8e671..3011505bf 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -58,11 +58,10 @@ void clearOutputBuffer(OutputBuffer * cb) void flushOutputBuffer(OutputBuffer * cb) { if (currentChunk == cb->end) { - int next = cb->end + 1; - if (next >= buffered_chunks) { - next = 0; + if ((cb->end + 1) >= buffered_chunks) { + cb->end = 0; } - cb->end = next; + else cb->end++; currentChunk = -1; } } diff --git a/src/player.c b/src/player.c index b976dce7f..57ed1f2ef 100644 --- a/src/player.c +++ b/src/player.c @@ -138,6 +138,8 @@ int playerInit(void) decode(); else if (pc->stop) pc->stop = 0; + else if (pc->seek) + pc->seek = 0; else if (pc->pause) pc->pause = 0; else if (pc->closeAudio) { |