summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2014-09-24 06:35:14 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2014-09-24 06:35:17 +1000
commit6a6207b52a86b1d7980a5233e297c0fc948bed7d (patch)
treebde1e79b06fa96f607de03775a5f716bb8c61d08 /src
parent142cc51cc71fb8f47a5f1cda9c0feae6d2226c3f (diff)
downloadflac-6a6207b52a86b1d7980a5233e297c0fc948bed7d.tar.gz
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>
Diffstat (limited to 'src')
-rw-r--r--src/libFLAC/stream_encoder.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c
index 6f46d784..bd956340 100644
--- a/src/libFLAC/stream_encoder.c
+++ b/src/libFLAC/stream_encoder.c
@@ -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;