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

Rémi Denis-Courmont git at videolan.org
Sat Jan 31 17:38:09 CET 2015


vlc/vlc-2.2 | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Jan 29 19:15:53 2015 +0200| [321fa90d585b9ebcb317cf6e575edf2bb952b687] | committer: Felix Paul Kühne

stream: handle seek across EOF correctly (hopefully)

(cherry picked from commit 6419254f5bb5ae06b72c93c9b52cd0a3bbbacb94)
Signed-off-by: Felix Paul Kühne <fkuehne at videolan.org>

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

 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 18e77e2..4cceaac 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -1083,15 +1083,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