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

Zhao Zhili quinkblack at foxmail.com
Wed Nov 15 12:42:31 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 | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp 
b/modules/demux/adaptive/PlaylistManager.cpp
index 95c8177..4ae451c 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,7 +354,11 @@ bool PlaylistManager::setPosition(mtime_t time)
          {
              AbstractStream *st = *it;
              if(!st->isDisabled())
-                ret &= st->setPosition(time, !real);
+            {
+                ret = st->setPosition(time, !real);
+                if(!ret)
+                    break;
+            }
          }
          if(!ret)
              break;
-- 
2.7.4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux-adaptive-fix-setPosition.patch
Type: text/x-patch
Size: 1395 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20171115/289d9cd8/attachment.bin>


More information about the vlc-devel mailing list