summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik de Castro Lopo <erikd@mega-nerd.com>2014-09-28 08:43:24 +1000
committerErik de Castro Lopo <erikd@mega-nerd.com>2014-09-29 09:06:37 +1000
commite8632477774f56b4fe7ccab525cad2ceab244b8a (patch)
tree99f3cc987574819baffee865df6acc83aa1f60d9
parent25db9b2cce84db62a4689e7e69d5ed14b517da7a (diff)
downloadflac-e8632477774f56b4fe7ccab525cad2ceab244b8a.tar.gz
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.
-rw-r--r--src/libFLAC/stream_encoder.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libFLAC/stream_encoder.c b/src/libFLAC/stream_encoder.c
index bd956340..029bfc64 100644
--- a/src/libFLAC/stream_encoder.c
+++ b/src/libFLAC/stream_encoder.c
@@ -1288,8 +1288,13 @@ 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 */
-
+#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_->progress_callback = progress_callback;