aboutsummaryrefslogtreecommitdiffstats
path: root/src/outputBuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/outputBuffer.c')
-rw-r--r--src/outputBuffer.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/outputBuffer.c b/src/outputBuffer.c
index daf03d4b0..bc25bbf3f 100644
--- a/src/outputBuffer.c
+++ b/src/outputBuffer.c
@@ -209,6 +209,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
size_t datalen;
static char *convBuffer;
static size_t convBufferLen;
+ OutputBufferChunk *chunk = NULL;
if (cmpAudioFormat(&(cb->audioFormat), &(dc->audioFormat)) == 0) {
data = dataIn;
@@ -234,7 +235,6 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
normalizeData(data, datalen, &cb->audioFormat);
while (datalen) {
- OutputBufferChunk *chunk;
int chunk_index = tailChunk(cb, inStream,
dc, seekable,
data_time, bitRate);
@@ -251,12 +251,11 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
chunk->chunkSize += dataToSend;
datalen -= dataToSend;
data += dataToSend;
-
- if (chunk->chunkSize == sizeof(chunk->data)) {
- flushOutputBuffer(cb);
- }
}
+ if (chunk != NULL && chunk->chunkSize == sizeof(chunk->data))
+ flushOutputBuffer(cb);
+
return 0;
}