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:
Max Kellermann 2008-04-12 04:21:34 +00:00 committed by Eric Wong
parent e4746b82c9
commit ac0ac9d4d8

View File

@ -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;
}