flush after loop in sendDataToOutputBuffer()
Since tailChunk() automatically flushes full buffers, we do not have to check this in every iteration of sendDataToOutputBuffer(). git-svn-id: https://svn.musicpd.org/mpd/trunk@7343 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
e4746b82c9
commit
ac0ac9d4d8
@ -209,6 +209,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
|||||||
size_t datalen;
|
size_t datalen;
|
||||||
static char *convBuffer;
|
static char *convBuffer;
|
||||||
static size_t convBufferLen;
|
static size_t convBufferLen;
|
||||||
|
OutputBufferChunk *chunk = NULL;
|
||||||
|
|
||||||
if (cmpAudioFormat(&(cb->audioFormat), &(dc->audioFormat)) == 0) {
|
if (cmpAudioFormat(&(cb->audioFormat), &(dc->audioFormat)) == 0) {
|
||||||
data = dataIn;
|
data = dataIn;
|
||||||
@ -234,7 +235,6 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
|||||||
normalizeData(data, datalen, &cb->audioFormat);
|
normalizeData(data, datalen, &cb->audioFormat);
|
||||||
|
|
||||||
while (datalen) {
|
while (datalen) {
|
||||||
OutputBufferChunk *chunk;
|
|
||||||
int chunk_index = tailChunk(cb, inStream,
|
int chunk_index = tailChunk(cb, inStream,
|
||||||
dc, seekable,
|
dc, seekable,
|
||||||
data_time, bitRate);
|
data_time, bitRate);
|
||||||
@ -251,11 +251,10 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream,
|
|||||||
chunk->chunkSize += dataToSend;
|
chunk->chunkSize += dataToSend;
|
||||||
datalen -= dataToSend;
|
datalen -= dataToSend;
|
||||||
data += dataToSend;
|
data += dataToSend;
|
||||||
|
}
|
||||||
|
|
||||||
if (chunk->chunkSize == sizeof(chunk->data)) {
|
if (chunk != NULL && chunk->chunkSize == sizeof(chunk->data))
|
||||||
flushOutputBuffer(cb);
|
flushOutputBuffer(cb);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user