[PATCH] mms/tcp: hanging or unexpected seeking after the end of stream

bl4 bl4 at playker.info
Sat May 24 20:17:49 CEST 2008


---
 modules/access/mms/mmstu.c |    5 +++++
 src/input/stream.c         |   15 ++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/modules/access/mms/mmstu.c b/modules/access/mms/mmstu.c
index 7b41745..776f0c2 100644
--- a/modules/access/mms/mmstu.c
+++ b/modules/access/mms/mmstu.c
@@ -400,6 +400,11 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
     size_t      i_data;
     size_t      i_copy;
 
+    if( p_access->info.b_eof )
+    {
+        return 0;
+    }
+
     i_data = 0;
 
     /* *** now send data if needed *** */
diff --git a/src/input/stream.c b/src/input/stream.c
index 228fb87..8a96908 100644
--- a/src/input/stream.c
+++ b/src/input/stream.c
@@ -1025,10 +1025,15 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read )
         /* seek within this stream if possible, else use plain old read and discard */
         stream_sys_t *p_sys = s->p_sys;
         access_t     *p_access = p_sys->p_access;
-        bool   b_aseek;
-        access_Control( p_access, ACCESS_CAN_SEEK, &b_aseek );
-        if( b_aseek )
-            return AStreamSeekStream( s, p_sys->i_pos + i_read ) ? 0 : i_read;
+
+        /* seeking after EOF is not what we want */
+        if( !( p_access->info.b_eof ) )
+        {
+            bool   b_aseek;
+            access_Control( p_access, ACCESS_CAN_SEEK, &b_aseek );
+            if( b_aseek )
+                return AStreamSeekStream( s, p_sys->i_pos + i_read ) ? 0 : i_read;
+        }
     }
 
 #ifdef STREAM_DEBUG
@@ -1070,7 +1075,7 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read )
             if( AStreamRefillStream( s ) )
             {
                 /* EOF */
-                if( tk->i_start >= tk->i_end ) break;
+                if( tk->i_start >= tk->i_end ) return 0;
             }
         }
     }
-- 
1.5.3.7


--------------010604090901060009030804--


More information about the vlc-devel mailing list