[vlc-commits] demux: adaptive: get state through methods

Francois Cartegnie git at videolan.org
Wed Sep 21 18:52:31 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Sep 16 13:52:02 2016 +0200| [341a106e772350d044ca600d907f870f7a70c5ed] | committer: Francois Cartegnie

demux: adaptive: get state through methods

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

 modules/demux/adaptive/Streams.cpp | 15 ++++++++++-----
 modules/demux/adaptive/Streams.hpp |  7 +++++--
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index f8e7b8b..27098dd 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -144,7 +144,7 @@ bool AbstractStream::isDead() const
 mtime_t AbstractStream::getPCR() const
 {
     vlc_mutex_lock(const_cast<vlc_mutex_t *>(&lock));
-    mtime_t pcr = (dead || disabled) ? VLC_TS_INVALID : commandsqueue->getPCR();
+    mtime_t pcr = (isDead() || isDisabled()) ? VLC_TS_INVALID : commandsqueue->getPCR();
     vlc_mutex_unlock(const_cast<vlc_mutex_t *>(&lock));
     return pcr;
 }
@@ -160,7 +160,7 @@ mtime_t AbstractStream::getFirstDTS() const
 {
     mtime_t dts;
     vlc_mutex_lock(const_cast<vlc_mutex_t *>(&lock));
-    if(dead || disabled)
+    if(isDead() || isDisabled())
     {
         dts = VLC_TS_INVALID;
     }
@@ -196,7 +196,7 @@ bool AbstractStream::reactivate(mtime_t basetime)
 {
     if(setPosition(basetime, false))
     {
-        disabled = false;
+        setDisabled(false);
         return true;
     }
     else
@@ -236,6 +236,11 @@ bool AbstractStream::restartDemux()
     return true;
 }
 
+void AbstractStream::setDisabled(bool b)
+{
+    disabled = b;
+}
+
 bool AbstractStream::isDisabled() const
 {
     return disabled;
@@ -261,7 +266,7 @@ AbstractStream::buffering_status AbstractStream::bufferize(mtime_t nz_deadline,
     /* Disable streams that are not selected (alternate streams) */
     if(esCount() && !isSelected() && !fakeesout->restarting())
     {
-        disabled = true;
+        setDisabled(true);
         segmentTracker->reset();
         commandsqueue->Abort(false);
         msg_Dbg(p_realdemux, "deactivating stream %s", format.str().c_str());
@@ -354,7 +359,7 @@ AbstractStream::status AbstractStream::dequeue(mtime_t nz_deadline, mtime_t *pi_
 
     *pi_pcr = nz_deadline;
 
-    if (disabled || dead)
+    if (isDisabled() || isDead())
         return AbstractStream::status_eof;
 
     if(commandsqueue->isFlushing())
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index 6c84cda..c2671c4 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -67,6 +67,7 @@ namespace adaptive
         int esCount() const;
         bool isSelected() const;
         virtual bool reactivate(mtime_t);
+        void setDisabled(bool);
         bool isDisabled() const;
         typedef enum {
             status_eof = 0, /* prioritized */
@@ -113,9 +114,7 @@ namespace adaptive
         SegmentTracker *segmentTracker;
 
         SegmentChunk *currentChunk;
-        bool disabled;
         bool eof;
-        bool dead;
         std::string language;
         std::string description;
 
@@ -124,6 +123,10 @@ namespace adaptive
         AbstractSourceStream *demuxersource;
         FakeESOut *fakeesout; /* to intercept/proxy what is sent from demuxstream */
         vlc_mutex_t lock; /* lock for everything accessed by dequeuing */
+
+    private:
+        bool dead;
+        bool disabled;
     };
 
     class AbstractStreamFactory



More information about the vlc-commits mailing list