[vlc-commits] demux: adaptative: handle peek error code (fix #15819)

Francois Cartegnie git at videolan.org
Thu Nov 5 14:56:55 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Nov  5 14:54:08 2015 +0100| [b7d2d2a8ce271a60a519629928f62544128e3048] | committer: Francois Cartegnie

demux: adaptative: handle peek error code (fix #15819)

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

 modules/demux/adaptative/adaptative.cpp |   25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/modules/demux/adaptative/adaptative.cpp b/modules/demux/adaptative/adaptative.cpp
index 8f91a06..be12c05 100644
--- a/modules/demux/adaptative/adaptative.cpp
+++ b/modules/demux/adaptative/adaptative.cpp
@@ -161,22 +161,25 @@ static int Open(vlc_object_t *p_obj)
         {
             /* We need to probe content */
             const uint8_t *p_peek;
-            const size_t i_peek = stream_Peek(p_demux->s, &p_peek, 2048);
-            stream_t *peekstream = stream_MemoryNew(p_demux, const_cast<uint8_t *>(p_peek), i_peek, true);
-            if(peekstream)
+            const ssize_t i_peek = stream_Peek(p_demux->s, &p_peek, 2048);
+            if(i_peek > 0)
             {
-                if(xmlParser.reset(peekstream) && xmlParser.parse(false))
+                stream_t *peekstream = stream_MemoryNew(p_demux, const_cast<uint8_t *>(p_peek), (size_t)i_peek, true);
+                if(peekstream)
                 {
-                    if(DASHManager::isDASH(xmlParser.getRootNode()))
+                    if(xmlParser.reset(peekstream) && xmlParser.parse(false))
                     {
-                        p_manager = HandleDash(p_demux, xmlParser, playlisturl, logic);
-                    }
-                    else if(SmoothManager::isSmoothStreaming(xmlParser.getRootNode()))
-                    {
-                        p_manager = HandleSmooth(p_demux, xmlParser, playlisturl, logic);
+                        if(DASHManager::isDASH(xmlParser.getRootNode()))
+                        {
+                            p_manager = HandleDash(p_demux, xmlParser, playlisturl, logic);
+                        }
+                        else if(SmoothManager::isSmoothStreaming(xmlParser.getRootNode()))
+                        {
+                            p_manager = HandleSmooth(p_demux, xmlParser, playlisturl, logic);
+                        }
                     }
+                    stream_Delete(peekstream);
                 }
-                stream_Delete(peekstream);
             }
         }
     }



More information about the vlc-commits mailing list