[vlc-commits] Currently, Read() might returns less than i_len bytes, while not at the

Frédéric Yhuel git at videolan.org
Fri Mar 23 14:26:20 CET 2012


vlc | branch: master | Frédéric Yhuel <fyhuel at viotech.net> | Fri Mar 23 14:06:59 2012 +0100| [101d9834f5fcb3b71edfb7f5c89c7fbfe6dd716c] | committer: Hugo Beauzée-Luyssen

Currently, Read() might returns less than i_len bytes, while not at the
end of the stream. This is wrong and the patch fix that.

Signed-off-by: Hugo Beauzée-Luyssen <beauze.h at gmail.com>

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

 modules/stream_filter/dash/dash.cpp |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/stream_filter/dash/dash.cpp b/modules/stream_filter/dash/dash.cpp
index d1ca988..98123c0 100644
--- a/modules/stream_filter/dash/dash.cpp
+++ b/modules/stream_filter/dash/dash.cpp
@@ -165,10 +165,20 @@ static int  Read            (stream_t *p_stream, void *p_buffer, unsigned int i_
     stream_sys_t        *p_sys          = (stream_sys_t *) p_stream->p_sys;
     dash::DASHManager   *p_dashManager  = p_sys->p_dashManager;
     int                 i_ret           = 0;
+    int                 i_read          = 0;
 
-    i_ret = p_dashManager->read(p_buffer, i_len );
+    while( i_len > 0 )
+    {
+        i_read = p_dashManager->read( p_buffer, i_len );
+        if( i_read < 0 )
+            break;
+        p_buffer += i_read;
+        i_ret += i_read;
+        i_len -= i_read;
+    }
+    p_buffer -= i_ret;
 
-    if (i_ret < 0)
+    if (i_read < 0)
     {
         switch (errno)
         {



More information about the vlc-commits mailing list