aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/decode.c6
-rw-r--r--src/outputBuffer.c7
-rw-r--r--src/outputBuffer.h2
3 files changed, 11 insertions, 4 deletions
diff --git a/src/decode.c b/src/decode.c
index 3a73d9ef2..8650184c6 100644
--- a/src/decode.c
+++ b/src/decode.c
@@ -506,10 +506,8 @@ static void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer *
}
nextChunk = outputBufferAbsolute(cb, crossFadeChunks);
if (nextChunk >= 0) {
- pcm_mix(cb->chunks +
- cb->begin * CHUNK_SIZE,
- cb->chunks +
- nextChunk * CHUNK_SIZE,
+ pcm_mix(outputBufferChunkData(cb, cb->begin),
+ outputBufferChunkData(cb, nextChunk),
cb->chunkSize[cb->begin],
cb->chunkSize[nextChunk],
&(cb->audioFormat),
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index aadd5e379..157e36374 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -92,6 +92,13 @@ int outputBufferAbsolute(const OutputBuffer * cb, unsigned relative)
return (int)i;
}
+char * outputBufferChunkData(const OutputBuffer * cb, unsigned i)
+{
+ assert(i < buffered_chunks);
+
+ return cb->chunks + i * CHUNK_SIZE;
+}
+
/**
* Return the tail chunk has room for additional data. If there is no
* room in the queue, this function blocks until the player thread has
diff --git a/src/outputBuffer.h b/src/outputBuffer.h
index 0af264c14..f2a1c8734 100644
--- a/src/outputBuffer.h
+++ b/src/outputBuffer.h
@@ -73,6 +73,8 @@ unsigned availableOutputBuffer(const OutputBuffer * cb);
*/
int outputBufferAbsolute(const OutputBuffer * cb, unsigned relative);
+char * outputBufferChunkData(const OutputBuffer * cb, unsigned i);
+
/* we send inStream for buffering the inputStream while waiting to
send the next chunk */
int sendDataToOutputBuffer(OutputBuffer * cb,