[vlc-commits] stream: handle seek across EOF correctly (hopefully)

Rémi Denis-Courmont git at videolan.org
Thu Jan 29 18:16:53 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jan 29 19:15:53 2015 +0200| [6419254f5bb5ae06b72c93c9b52cd0a3bbbacb94] | committer: Rémi Denis-Courmont

stream: handle seek across EOF correctly (hopefully)

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

 src/input/stream.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/input/stream.c b/src/input/stream.c
index ba7bcee..a5e3c22 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -1102,15 +1102,15 @@ static int AStreamPeekStream( stream_t *s, const uint8_t **pp_peek, unsigned int
             /* Be sure we will read something */
             p_sys->stream.i_used += tk->i_start + p_sys->stream.i_offset + i_read - tk->i_end;
         }
-        if( AStreamRefillStream( s ) ) break;
-    }
-
-    if( tk->i_end < tk->i_start + p_sys->stream.i_offset + i_read )
-    {
-        i_read = tk->i_end - tk->i_start - p_sys->stream.i_offset;
+        if( AStreamRefillStream( s ) )
+        {
+            if( tk->i_end < tk->i_start + p_sys->stream.i_offset )
+                return 0; /* EOF */
+            i_read = tk->i_end - tk->i_start - p_sys->stream.i_offset;
+            break;
+        }
     }
 
-
     /* Now, direct pointer or a copy ? */
     i_off = (tk->i_start + p_sys->stream.i_offset) % STREAM_CACHE_TRACK_SIZE;
     if( i_off + i_read <= STREAM_CACHE_TRACK_SIZE )



More information about the vlc-commits mailing list