stream_encoder.c : Give the encoder a larger stdio buffer.

Windows in particular can experience slow encoding speeds on highly
fragmented disks. Using setvbuf to increase the size of the buffer to
10Meg.

This is probably not needed on Linux/Unix, but is very unlikely to
to cause any negative effects.

Patch-from: Janne Hyvärinen <cse@sci.fi>
This commit is contained in:
Erik de Castro Lopo 2014-09-24 06:35:14 +10:00
parent 142cc51cc7
commit 6a6207b52a
1 changed files with 2 additions and 0 deletions

View File

@ -1288,6 +1288,8 @@ static FLAC__StreamEncoderInitStatus init_FILE_internal_(
if(file == stdout)
file = get_binary_stdout_(); /* just to be safe */
setvbuf(file, NULL, _IOFBF, 10*1024*1024); /* 10MB output buffer to help reduce disk fragmentation */
encoder->private_->file = file;
encoder->private_->progress_callback = progress_callback;