summaryrefslogtreecommitdiff
path: root/libavformat/file.c
diff options
context:
space:
mode:
authorMarton Balint <cus@passwd.hu>2017-06-04 04:25:43 +0200
committerMarton Balint <cus@passwd.hu>2017-06-24 18:51:29 +0200
commitdb9e87dd8c1ce11d37edc16f9380ee8dee68891b (patch)
tree2d81eb275e3b51f205b8d846b55020febdfbfc16 /libavformat/file.c
parenteeeb595c7f1c78764a1a670b763fa837ab3db2bd (diff)
avformat/file: increase min/max packet size to 256k for written files
Buffering more than one packet can be a huge performance improvement for encoding files with small packets (e.g. wav) over SMB/CIFS. Acked-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/file.c')
-rw-r--r--libavformat/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavformat/file.c b/libavformat/file.c
index 3db9cd0b9e..1d321c4205 100644
--- a/libavformat/file.c
+++ b/libavformat/file.c
@@ -229,6 +229,11 @@ static int file_open(URLContext *h, const char *filename, int flags)
h->is_streamed = !fstat(fd, &st) && S_ISFIFO(st.st_mode);
+ /* Buffer writes more than the default 32k to improve throughput especially
+ * with networked file systems */
+ if (!h->is_streamed && flags & AVIO_FLAG_WRITE)
+ h->min_packet_size = h->max_packet_size = 262144;
+
return 0;
}