[vlc-commits] demux: adaptive: use mutable keywork on locks
Francois Cartegnie
git at videolan.org
Tue May 21 15:58:23 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue May 21 12:29:20 2019 +0200| [fbb3542c34081091d8f8943d6ffcd244f5efe590] | committer: Francois Cartegnie
demux: adaptive: use mutable keywork on locks
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=fbb3542c34081091d8f8943d6ffcd244f5efe590
---
modules/demux/adaptive/PlaylistManager.cpp | 2 +-
modules/demux/adaptive/PlaylistManager.h | 4 ++--
modules/demux/adaptive/Streams.cpp | 4 ++--
modules/demux/adaptive/Streams.hpp | 2 +-
modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp | 4 ++--
modules/demux/adaptive/logic/RateBasedAdaptationLogic.h | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index 587521998a..6fcf0bbb77 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -321,7 +321,7 @@ void PlaylistManager::drain()
vlc_tick_t PlaylistManager::getResumeTime() const
{
- vlc_mutex_locker locker(const_cast<vlc_mutex_t *>(&demux.lock));
+ vlc_mutex_locker locker(&demux.lock);
return demux.i_nzpcr;
}
diff --git a/modules/demux/adaptive/PlaylistManager.h b/modules/demux/adaptive/PlaylistManager.h
index 43261ef9b2..c324204672 100644
--- a/modules/demux/adaptive/PlaylistManager.h
+++ b/modules/demux/adaptive/PlaylistManager.h
@@ -109,7 +109,7 @@ namespace adaptive
{
vlc_tick_t i_nzpcr;
vlc_tick_t i_firstpcr;
- vlc_mutex_t lock;
+ mutable vlc_mutex_t lock;
vlc_cond_t cond;
} demux;
@@ -124,7 +124,7 @@ namespace adaptive
vlc_tick_t i_length;
vlc_tick_t i_time;
double f_position;
- vlc_mutex_t lock;
+ mutable vlc_mutex_t lock;
} cached;
private:
diff --git a/modules/demux/adaptive/Streams.cpp b/modules/demux/adaptive/Streams.cpp
index 1fc3e1ed4c..26710e3338 100644
--- a/modules/demux/adaptive/Streams.cpp
+++ b/modules/demux/adaptive/Streams.cpp
@@ -154,7 +154,7 @@ void AbstractStream::setDescription(const std::string &desc)
vlc_tick_t AbstractStream::getPCR() const
{
- vlc_mutex_locker locker(const_cast<vlc_mutex_t *>(&lock));
+ vlc_mutex_locker locker(&lock);
if(!valid || disabled)
return VLC_TICK_INVALID;
return fakeEsOut()->commandsQueue()->getPCR();
@@ -169,7 +169,7 @@ vlc_tick_t AbstractStream::getMinAheadTime() const
vlc_tick_t AbstractStream::getFirstDTS() const
{
- vlc_mutex_locker locker(const_cast<vlc_mutex_t *>(&lock));
+ vlc_mutex_locker locker(&lock);
if(!valid || disabled)
return VLC_TICK_INVALID;
diff --git a/modules/demux/adaptive/Streams.hpp b/modules/demux/adaptive/Streams.hpp
index 22989c9729..919a65dfc9 100644
--- a/modules/demux/adaptive/Streams.hpp
+++ b/modules/demux/adaptive/Streams.hpp
@@ -132,7 +132,7 @@ namespace adaptive
FakeESOut::LockedFakeEsOut fakeEsOut();
FakeESOut::LockedFakeEsOut fakeEsOut() const;
FakeESOut *fakeesout; /* to intercept/proxy what is sent from demuxstream */
- vlc_mutex_t lock; /* lock for everything accessed by dequeuing */
+ mutable vlc_mutex_t lock; /* lock for everything accessed by dequeuing */
private:
void declaredCodecs();
diff --git a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
index dc639e1c9d..bb7b6e9f73 100644
--- a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
@@ -57,9 +57,9 @@ BaseRepresentation *RateBasedAdaptationLogic::getNextRepresentation(BaseAdaptati
if(adaptSet == NULL)
return NULL;
- vlc_mutex_lock(const_cast<vlc_mutex_t *>(&lock));
+ vlc_mutex_lock(&lock);
size_t availBps = currentBps + ((currep) ? currep->getBandwidth() : 0);
- vlc_mutex_unlock(const_cast<vlc_mutex_t *>(&lock));
+ vlc_mutex_unlock(&lock);
if(availBps > usedBps)
availBps -= usedBps;
else
diff --git a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.h b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.h
index d0d25927cc..929226eb39 100644
--- a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.h
+++ b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.h
@@ -53,7 +53,7 @@ namespace adaptive
size_t dlsize;
vlc_tick_t dllength;
- vlc_mutex_t lock;
+ mutable vlc_mutex_t lock;
};
class FixedRateAdaptationLogic : public AbstractAdaptationLogic
More information about the vlc-commits
mailing list