[vlc-devel] commit: file: When loading a non-local file, raise the caching with 700ms. (Derk-Jan Hartman )
git version control
git at videolan.org
Thu Jun 25 18:41:24 CEST 2009
vlc | branch: master | Derk-Jan Hartman <hartman at videolan.org> | Thu Jun 25 18:40:37 2009 +0200| [6ef7fa723116ec7efddf6d2154e7e17df0f6e704] | committer: Derk-Jan Hartman
file: When loading a non-local file, raise the caching with 700ms.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6ef7fa723116ec7efddf6d2154e7e17df0f6e704
---
configure.ac | 4 ++--
modules/access/file.c | 12 ++++++++++++
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 7d25e70..3c822c4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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], [], [],
[
diff --git a/modules/access/file.c b/modules/access/file.c
index 0889f1c..65978ff 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -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;
More information about the vlc-devel
mailing list