]> git.sesse.net Git - vlc/commitdiff
Simplify read timing in stream.c.
authorLaurent Aimar <fenrir@videolan.org>
Thu, 5 Feb 2009 19:38:36 +0000 (20:38 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Thu, 5 Feb 2009 19:39:32 +0000 (20:39 +0100)
src/input/stream.c

index 25053e3181c3da0acb9c72ec7eb6d3aecae62484..1fafc00828e67d3d3958f2b8ffc3876bdeb21f74 100644 (file)
@@ -976,7 +976,6 @@ static int AStreamSeekBlock( stream_t *s, int64_t i_pos )
 static int AStreamRefillBlock( stream_t *s )
 {
     stream_sys_t *p_sys = s->p_sys;
-    int64_t      i_start, i_stop;
     block_t      *b;
 
     /* Release data */
@@ -1000,7 +999,7 @@ static int AStreamRefillBlock( stream_t *s )
     }
 
     /* Now read a new block */
-    i_start = mdate();
+    const int64_t i_start = mdate();
     for( ;; )
     {
         bool b_eof;
@@ -1015,10 +1014,9 @@ static int AStreamRefillBlock( stream_t *s )
             return VLC_EGENERIC;
     }
 
+    p_sys->stat.i_read_time += mdate() - i_start;
     while( b )
     {
-        i_stop = mdate();
-
         /* Append the block */
         p_sys->block.i_size += b->i_buffer;
         *p_sys->block.pp_last = b;
@@ -1030,11 +1028,9 @@ static int AStreamRefillBlock( stream_t *s )
 
         /* Update stat */
         p_sys->stat.i_bytes += b->i_buffer;
-        p_sys->stat.i_read_time += i_stop - i_start;
         p_sys->stat.i_read_count++;
 
         b = b->p_next;
-        i_start = mdate();
     }
     return VLC_SUCCESS;
 }