summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/decode.c5
-rw-r--r--src/outputBuffer.c7
2 files changed, 7 insertions, 5 deletions
diff --git a/src/decode.c b/src/decode.c
index eeaf74ba4..b7ded74da 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -462,6 +462,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
dc->state!=DECODE_STATE_STOP)
{
processDecodeInput();
+ handleDecodeStart();
if(quit) return;
my_usleep(10000);
}
@@ -561,10 +562,10 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
quit = 1;
}
pc->totalPlayTime+= sizeToTime*cb->chunkSize[cb->begin];
- cb->begin++;
- if(cb->begin>=buffered_chunks) {
+ if( cb->begin+1 >= buffered_chunks ) {
cb->begin = 0;
}
+ else cb->begin++;
}
else if(next==cb->begin) {
if(doCrossFade==1 && nextChunk>=0) {
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index bde118ff8..3620f826b 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -57,10 +57,11 @@ void clearOutputBuffer(OutputBuffer * cb) {
void flushOutputBuffer(OutputBuffer * cb) {
if(currentChunk == cb->end) {
- cb->end++;
- if(cb->end>=buffered_chunks) {
- cb->end = 0;
+ int next = cb->end+1;
+ if(next>=buffered_chunks) {
+ next = 0;
}
+ cb->end = next;
currentChunk = -1;
}
}