[vlc-commits] input: remove INPUT_FSTAT_NB_READS

Rémi Denis-Courmont git at videolan.org
Wed Apr 17 22:23:29 CEST 2013


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Apr 17 23:22:59 2013 +0300| [1ed365b8436c798b8e51e23cffd9d7be6bf0330e] | committer: Rémi Denis-Courmont

input: remove INPUT_FSTAT_NB_READS

This was only used for INPUT_UPDATE_SIZE.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1ed365b8436c798b8e51e23cffd9d7be6bf0330e
---

 include/vlc_config.h      |    4 ----
 modules/access/file.c     |    9 +--------
 modules/access/gnomevfs.c |   38 ++++++++++----------------------------
 3 files changed, 11 insertions(+), 40 deletions(-)

diff --git a/include/vlc_config.h b/include/vlc_config.h
index de36a93..c1cf96c 100644
--- a/include/vlc_config.h
+++ b/include/vlc_config.h
@@ -59,10 +59,6 @@
 /* Used in ErrorThread */
 #define INPUT_IDLE_SLEEP                (CLOCK_FREQ/10)
 
-/* Number of read() calls needed until we check the file size through
- * fstat() */
-#define INPUT_FSTAT_NB_READS            16
-
 /*
  * General limitations
  */
diff --git a/modules/access/file.c b/modules/access/file.c
index 37c1a2b..72ee567 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -66,8 +66,6 @@
 
 struct access_sys_t
 {
-    unsigned int i_nb_reads;
-
     int fd;
 
     /* */
@@ -222,7 +220,6 @@ int FileOpen( vlc_object_t *p_this )
     p_access->pf_block = NULL;
     p_access->pf_control = FileControl;
     p_access->p_sys = p_sys;
-    p_sys->i_nb_reads = 0;
     p_sys->fd = fd;
 
     if (S_ISREG (st.st_mode) || S_ISBLK (st.st_mode))
@@ -305,11 +302,7 @@ static ssize_t FileRead (access_t *p_access, uint8_t *p_buffer, size_t i_len)
 
     p_access->info.i_pos += val;
     p_access->info.b_eof = !val;
-
-    p_sys->i_nb_reads++;
-
-    if (!(p_sys->i_nb_reads % INPUT_FSTAT_NB_READS)
-     || (p_access->info.i_pos > p_access->info.i_size))
+    if (p_access->info.i_pos >= p_access->info.i_size)
     {
         struct stat st;
 
diff --git a/modules/access/gnomevfs.c b/modules/access/gnomevfs.c
index 0516836..4b63ee4 100644
--- a/modules/access/gnomevfs.c
+++ b/modules/access/gnomevfs.c
@@ -63,7 +63,6 @@ static int     Control( access_t *, int, va_list );
 
 struct access_sys_t
 {
-    unsigned int i_nb_reads;
     char *psz_name;
 
     GnomeVFSHandle *p_handle;
@@ -105,7 +104,6 @@ static int Open( vlc_object_t *p_this )
     STANDARD_READ_ACCESS_INIT;
 
     p_sys->p_handle = p_handle;
-    p_sys->i_nb_reads = 0;
     p_sys->b_pace_control = true;
 
     if( strcmp( "gnomevfs", p_access->psz_access ) &&
@@ -288,35 +286,19 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
                                     gnome_vfs_result_to_string( i_ret ) );
         }
     }
-    else
-    {
-        p_sys->i_nb_reads++;
-        if( p_access->info.i_size != 0 &&
-            (p_sys->i_nb_reads % INPUT_FSTAT_NB_READS) == 0 &&
-            p_sys->b_local )
-        {
-            gnome_vfs_file_info_clear( p_sys->p_file_info );
-            i_ret = gnome_vfs_get_file_info_from_handle( p_sys->p_handle,
-                                                p_sys->p_file_info, 8 );
-            if( i_ret )
-            {
-                msg_Warn( p_access, "couldn't get file properties again (%s)",
-                                        gnome_vfs_result_to_string( i_ret ) );
-            }
-            else
-            {
-                p_access->info.i_size = (int64_t)(p_sys->p_file_info->size);
-            }
-        }
-    }
 
     p_access->info.i_pos += (int64_t)i_read_len;
-
-    /* Some Acces (http) never return EOF and loop on the file */
-    if( p_access->info.i_pos > p_access->info.i_size )
+    if( p_access->info.i_pos >= p_access->info.i_size
+     && p_access->info.i_size != 0 && p_sys->b_local )
     {
-        p_access->info.b_eof = true;
-        return 0;
+        gnome_vfs_file_info_clear( p_sys->p_file_info );
+        i_ret = gnome_vfs_get_file_info_from_handle( p_sys->p_handle,
+                                                     p_sys->p_file_info, 8 );
+        if( i_ret )
+            msg_Warn( p_access, "couldn't get file properties again (%s)",
+                      gnome_vfs_result_to_string( i_ret ) );
+        else
+            p_access->info.i_size = (int64_t)(p_sys->p_file_info->size);
     }
     return (int)i_read_len;
 }



More information about the vlc-commits mailing list