stream_encoder.c : Only set 10MB output buffer on _WIN32.

Commig 6a6207b52a set the size of the encoder output buffer to 10MB
but this fix is really only needed on Windows, so wrap it in an #ifdef.
This commit is contained in:
Erik de Castro Lopo 2014-09-28 08:43:24 +10:00
parent 25db9b2cce
commit e863247777
1 changed files with 7 additions and 2 deletions

View File

@ -1288,8 +1288,13 @@ static FLAC__StreamEncoderInitStatus init_FILE_internal_(
if(file == stdout) if(file == stdout)
file = get_binary_stdout_(); /* just to be safe */ file = get_binary_stdout_(); /* just to be safe */
setvbuf(file, NULL, _IOFBF, 10*1024*1024); /* 10MB output buffer to help reduce disk fragmentation */ #ifdef _WIN32
/*
* Windows can suffer quite badly from disk fragmentation. This can be
* reduced significantly by setting the output buffer size to be 10MB.
*/
setvbuf(file, NULL, _IOFBF, 10*1024*1024);
#endif
encoder->private_->file = file; encoder->private_->file = file;
encoder->private_->progress_callback = progress_callback; encoder->private_->progress_callback = progress_callback;