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

Zhao Zhili quinkblack at foxmail.com
Sat Nov 11 13:11:27 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 | 9 +++++++++
  1 file changed, 9 insertions(+)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp 
b/modules/demux/adaptive/PlaylistManager.cpp
index 95c8177..700fa3a 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -346,6 +346,7 @@ mtime_t PlaylistManager::getDuration() const
  bool PlaylistManager::setPosition(mtime_t time)
  {
      bool ret = true;
+    bool hasValidStream = false;
      for(int real = 0; real < 2; real++)
      {
          /* Always probe if we can seek first */
@@ -354,11 +355,19 @@ bool PlaylistManager::setPosition(mtime_t time)
          {
              AbstractStream *st = *it;
              if(!st->isDisabled())
+            {
+                hasValidStream = true;
                  ret &= st->setPosition(time, !real);
+            }
          }
          if(!ret)
              break;
      }
+    if(!hasValidStream)
+    {
+        msg_Warn(p_demux, "there is no valid streams");
+        ret = false;
+    }
      return ret;
  }

-- 
2.7.4

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


More information about the vlc-devel mailing list