]> git.sesse.net Git - vlc/commitdiff
file: When loading a non-local file, raise the caching with 700ms.
authorDerk-Jan Hartman <hartman@videolan.org>
Thu, 25 Jun 2009 16:40:37 +0000 (18:40 +0200)
committerDerk-Jan Hartman <hartman@videolan.org>
Thu, 25 Jun 2009 16:41:20 +0000 (18:41 +0200)
configure.ac
modules/access/file.c

index 7d25e70084d556ac69ea4a793a87074bc0212409..3c822c46ce60350e4a3615389eb3b5214f57f69e 100644 (file)
@@ -856,8 +856,8 @@ AC_EGREP_HEADER(strncasecmp,strings.h,[
   AC_MSG_RESULT(no)])
 
 dnl Check for headers
-AC_CHECK_HEADERS(getopt.h strings.h locale.h)
-AC_CHECK_HEADERS(fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h xlocale.h)
+AC_CHECK_HEADERS(getopt.h strings.h locale.h xlocale.h)
+AC_CHECK_HEADERS(fcntl.h sys/types.h sys/time.h sys/times.h sys/ioctl.h sys/stat.h sys/mount.h)
 AC_CHECK_HEADERS([arpa/inet.h netinet/in.h netinet/udplite.h sys/eventfd.h])
 AC_CHECK_HEADERS([net/if.h], [], [],
   [
index 0889f1cd266515efc038b0fb36b9da15b01212ad..65978ff00a90aeabe24c7f51a815d0ba09b32c69 100644 (file)
@@ -47,6 +47,9 @@
 #ifdef HAVE_FCNTL_H
 #   include <fcntl.h>
 #endif
+#if HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
 
 #if defined( WIN32 )
 #   include <io.h>
@@ -171,6 +174,15 @@ static int Open( vlc_object_t *p_this )
 # warning File size not known!
 #endif
 
+#if defined(HAVE_SYS_MOUNT_H) && defined(MNT_LOCAL)
+    struct statfs stat;
+    if ((fstatfs (fd, &stat) == 0) && !(stat.f_flags & MNT_LOCAL) ) {
+        int i_cache = var_GetInteger (p_access, "file-caching") + 700;
+        var_SetInteger (p_access, "file-caching", i_cache);
+        msg_Warn (p_access, "Opening non-local file, use more caching: %d", i_cache);
+    }
+#endif
+
     p_sys->fd = fd;
     return VLC_SUCCESS;