[vlc-devel] commit: Fixed AStreamSeekBlock. When skipping data, the position may not be the (Laurent Aimar )

git version control git at videolan.org
Thu Jul 3 22:49:06 CEST 2008


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Thu Jul  3 20:49:44 2008 +0000| [ac217da0399df26771fec3005f4faaa65a2eb34b]

Fixed AStreamSeekBlock. When skipping data, the position may not be the
requested one. (Breaking at least mapped file input).

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

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

diff --git a/src/input/stream.c b/src/input/stream.c
index 567c115..d21eeb7 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -995,19 +995,21 @@ static int AStreamSeekBlock( stream_t *s, int64_t i_pos )
     }
     else
     {
-        /* Read enough data */
-        while( p_sys->block.i_start + p_sys->block.i_size < i_pos )
+        do
         {
+            /* Read and skip enough data */
             if( AStreamRefillBlock( s ) )
                 return VLC_EGENERIC;
 
             while( p_sys->block.p_current &&
-                   p_sys->i_pos + p_sys->block.p_current->i_buffer < i_pos )
+                   p_sys->i_pos + p_sys->block.p_current->i_buffer - p_sys->block.i_offset < i_pos )
             {
-                p_sys->i_pos += p_sys->block.p_current->i_buffer;
+                p_sys->i_pos += p_sys->block.p_current->i_buffer - p_sys->block.i_offset;
                 p_sys->block.p_current = p_sys->block.p_current->p_next;
+                p_sys->block.i_offset = 0;
             }
         }
+        while( p_sys->block.i_start + p_sys->block.i_size < i_pos );
 
         p_sys->block.i_offset = i_pos - p_sys->i_pos;
         p_sys->i_pos = i_pos;




More information about the vlc-devel mailing list