]> git.sesse.net Git - ffmpeg/commitdiff
avformat/file: increase min/max packet size to 256k for written files
authorMarton Balint <cus@passwd.hu>
Sun, 4 Jun 2017 02:25:43 +0000 (04:25 +0200)
committerMarton Balint <cus@passwd.hu>
Sat, 24 Jun 2017 16:51:29 +0000 (18:51 +0200)
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>
libavformat/file.c

index 3db9cd0b9e409e27f048b1b54b3309f99631e17a..1d321c42050e31588a411583c4f9578254460ac0 100644 (file)
@@ -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;
 }