[vlc-commits] demux: adaptive: fix CAN_SEEK and late fail

Francois Cartegnie git at videolan.org
Wed Jun 1 18:02:10 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jun  1 18:00:17 2016 +0200| [dac320e35ff9cf400093dbd214e2e6408c70a43c] | committer: Francois Cartegnie

demux: adaptive: fix CAN_SEEK and late fail

as child demuxers are not created yet when demux
wants seekable capability, CAN_SEEK was always false

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

 modules/demux/adaptive/PlaylistManager.cpp |   16 +---------------
 modules/demux/adaptive/PlaylistManager.h   |    1 -
 modules/demux/adaptive/Streams.cpp         |    2 +-
 modules/demux/adaptive/Streams.hpp         |    2 +-
 4 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 3e91743..8f0ecda 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -260,20 +260,6 @@ bool PlaylistManager::needsUpdate() const
     return playlist->isLive() && (failedupdates < 3);
 }
 
-bool PlaylistManager::seekAble() const
-{
-    if(playlist->isLive())
-        return false;
-
-    std::vector<AbstractStream *>::const_iterator it;
-    for(it=streams.begin(); it!=streams.end(); ++it)
-    {
-        if(!(*it)->seekAble())
-            return false;
-    }
-    return true;
-}
-
 void PlaylistManager::scheduleNextUpdate()
 {
 
@@ -393,7 +379,7 @@ int PlaylistManager::doControl(int i_query, va_list args)
     switch (i_query)
     {
         case DEMUX_CAN_SEEK:
-            *(va_arg (args, bool *)) = seekAble();
+            *(va_arg (args, bool *)) = !playlist->isLive();
             break;
 
         case DEMUX_CAN_CONTROL_PACE:
diff --git a/modules/demux/adaptive/PlaylistManager.h b/modules/demux/adaptive/PlaylistManager.h
index 569c3c9..d30ad0c 100644
--- a/modules/demux/adaptive/PlaylistManager.h
+++ b/modules/demux/adaptive/PlaylistManager.h
@@ -76,7 +76,6 @@ namespace adaptive
             mtime_t getCurrentPlaybackTime() const;
 
             int     esCount() const;
-            bool    seekAble() const;
             void pruneLiveStream();
             virtual bool reactivateStream(AbstractStream *);
             bool setupPeriod();
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index 60a3dcd..d05dd15 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -336,7 +336,7 @@ block_t * AbstractStream::readNextBlock()
 
 bool AbstractStream::setPosition(mtime_t time, bool tryonly)
 {
-    if(!demuxer)
+    if(!seekAble())
         return false;
 
     bool ret = segmentTracker->setPositionByTime(time, demuxer->reinitsOnSeek(), tryonly);
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index 505cebe..6fa20ea 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -65,7 +65,6 @@ namespace adaptive
         mtime_t getMinAheadTime() const;
         mtime_t getFirstDTS() const;
         int esCount() const;
-        bool seekAble() const;
         bool isSelected() const;
         virtual bool reactivate(mtime_t);
         bool isDisabled() const;
@@ -86,6 +85,7 @@ namespace adaptive
         virtual void trackerEvent(const SegmentTrackerEvent &); /* impl */
 
     protected:
+        bool seekAble() const;
         virtual block_t *checkBlock(block_t *, bool) = 0;
         virtual AbstractDemuxer * createDemux(const StreamFormat &) = 0;
         virtual bool startDemux();



More information about the vlc-commits mailing list