[vlc-devel] commit: Simplify read timing in stream.c. (Laurent Aimar )

git version control git at videolan.org
Thu Feb 5 20:40:20 CET 2009


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Feb  5 20:38:36 2009 +0100| [08b5947d023486b6dc81526d395cc4d9320757f1] | committer: Laurent Aimar 

Simplify read timing in stream.c.

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

 src/input/stream.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index 25053e3..1fafc00 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -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;
 }




More information about the vlc-devel mailing list