[vlc-devel] [PATCH] demux: adaptive: fix setPosition

Zhao Zhili quinkblack at foxmail.com
Sat Nov 11 21:24:47 CET 2017


If there is no valid streams, setPosition should not return
true/success. This can happen when DEMUX_SET_TIME failed which lead to
all streams disabled, and then try DEMUX_SET_POSITION.
---
 modules/demux/adaptive/PlaylistManager.cpp | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 95c817715e..7f5e2f5bdc 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -345,7 +345,7 @@ mtime_t PlaylistManager::getDuration() const
 
 bool PlaylistManager::setPosition(mtime_t time)
 {
-    bool ret = true;
+    bool ret = false;
     for(int real = 0; real < 2; real++)
     {
         /* Always probe if we can seek first */
@@ -354,10 +354,12 @@ bool PlaylistManager::setPosition(mtime_t time)
         {
             AbstractStream *st = *it;
             if(!st->isDisabled())
-                ret &= st->setPosition(time, !real);
+            {
+                ret = st->setPosition(time, !real);
+                if(!ret)
+                    return ret;
+            }
         }
-        if(!ret)
-            break;
     }
     return ret;
 }
-- 
2.14.2
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux-adaptive-fix-setPosition.patch
Type: application/octet-stream
Size: 1437 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20171112/d830cbd7/attachment-0001.obj>


More information about the vlc-devel mailing list