]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
Attempt to open files with O_DIRECT
authorMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 29 Nov 2009 13:19:20 +0000 (14:19 +0100)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Sun, 29 Nov 2009 13:19:20 +0000 (14:19 +0100)
To better exploit BFQ scheduling.

libavformat/aviobuf.c
libavformat/file.c

index f270139a9ba4bfcbd3cc9be36b908580e146b3ed..690ac9aac8e3ebf345956e38c4a407fcc8de3778 100644 (file)
@@ -24,6 +24,8 @@
 #include "avformat.h"
 #include "avio.h"
 #include <stdarg.h>
+#include <malloc.h>
+#include <unistd.h>
 
 #define IO_BUFFER_SIZE 32768
 
@@ -538,7 +540,7 @@ int url_fdopen(ByteIOContext **s, URLContext *h)
     } else {
         buffer_size = IO_BUFFER_SIZE;
     }
-    buffer = av_malloc(buffer_size);
+    buffer = memalign(sysconf(_SC_PAGESIZE), buffer_size);
     if (!buffer)
         return AVERROR(ENOMEM);
 
index da0ce150947bfb9b1671b740fbb581b3613dfdb3..402a58e79aaf485aa1a962f109e89aa36dcf754c 100644 (file)
@@ -18,7 +18,7 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-
+#define _GNU_SOURCE
 #include "libavutil/avstring.h"
 #include "avformat.h"
 #include <fcntl.h>
@@ -43,7 +43,7 @@ static int file_open(URLContext *h, const char *filename, int flags)
     if (flags & URL_RDWR) {
         access = O_CREAT | O_TRUNC | O_RDWR;
     } else if (flags & URL_WRONLY) {
-        access = O_CREAT | O_TRUNC | O_WRONLY;
+        access = O_CREAT | O_TRUNC | O_WRONLY | O_DIRECT;
     } else {
         access = O_RDONLY;
     }