Don't bother seeking when using mmap
authorRémi Denis-Courmont <rem@videolan.org>
Mon, 26 Nov 2007 21:02:27 +0000 (21:02 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Mon, 26 Nov 2007 21:02:27 +0000 (21:02 +0000)
modules/access/file.c

index 616f31d..ccaf3e8 100644 (file)
@@ -434,8 +434,10 @@ static int Seek (access_t *p_access, int64_t i_pos)
     p_access->info.i_pos = i_pos;
     p_access->info.b_eof = VLC_FALSE;
 
-    /* Determine which file we need to access */
-    lseek (p_access->p_sys->fd, i_pos, SEEK_SET);
+#ifdef HAVE_MMAP
+    if (p_access->pf_block == NULL)
+        lseek (p_access->p_sys->fd, i_pos, SEEK_SET);
+#endif
     return VLC_SUCCESS;
 }