[vlc-commits] demux: adaptive: fix missing obj for logic debug
Francois Cartegnie
git at videolan.org
Sun May 12 20:00:23 CEST 2019
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 10 18:19:41 2019 +0200| [4a2f9f28259ebecbf51ac06f349e3fbd78f055ba] | committer: Francois Cartegnie
demux: adaptive: fix missing obj for logic debug
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4a2f9f28259ebecbf51ac06f349e3fbd78f055ba
---
modules/demux/adaptive/PlaylistManager.cpp | 13 +++++++------
modules/demux/adaptive/logic/AbstractAdaptationLogic.cpp | 3 ++-
modules/demux/adaptive/logic/AbstractAdaptationLogic.h | 3 ++-
modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.cpp | 4 ++--
modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.h | 2 +-
.../demux/adaptive/logic/AlwaysLowestAdaptationLogic.cpp | 4 ++--
.../demux/adaptive/logic/AlwaysLowestAdaptationLogic.hpp | 2 +-
modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp | 4 ++--
modules/demux/adaptive/logic/NearOptimalAdaptationLogic.hpp | 2 +-
modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp | 5 ++---
modules/demux/adaptive/logic/PredictiveAdaptationLogic.hpp | 1 -
modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp | 9 ++++-----
modules/demux/adaptive/logic/RateBasedAdaptationLogic.h | 3 +--
13 files changed, 27 insertions(+), 28 deletions(-)
diff --git a/modules/demux/adaptive/PlaylistManager.cpp b/modules/demux/adaptive/PlaylistManager.cpp
index b8cc7f23f1..e1def52518 100644
--- a/modules/demux/adaptive/PlaylistManager.cpp
+++ b/modules/demux/adaptive/PlaylistManager.cpp
@@ -716,25 +716,26 @@ void PlaylistManager::updateControlsContentType()
AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::LogicType type, AbstractConnectionManager *conn)
{
+ vlc_object_t *obj = VLC_OBJECT(p_demux);
AbstractAdaptationLogic *logic = NULL;
switch(type)
{
case AbstractAdaptationLogic::FixedRate:
{
size_t bps = var_InheritInteger(p_demux, "adaptive-bw") * 8192;
- logic = new (std::nothrow) FixedRateAdaptationLogic(bps);
+ logic = new (std::nothrow) FixedRateAdaptationLogic(obj, bps);
break;
}
case AbstractAdaptationLogic::AlwaysLowest:
- logic = new (std::nothrow) AlwaysLowestAdaptationLogic();
+ logic = new (std::nothrow) AlwaysLowestAdaptationLogic(obj);
break;
case AbstractAdaptationLogic::AlwaysBest:
- logic = new (std::nothrow) AlwaysBestAdaptationLogic();
+ logic = new (std::nothrow) AlwaysBestAdaptationLogic(obj);
break;
case AbstractAdaptationLogic::RateBased:
{
RateBasedAdaptationLogic *ratelogic =
- new (std::nothrow) RateBasedAdaptationLogic(VLC_OBJECT(p_demux));
+ new (std::nothrow) RateBasedAdaptationLogic(obj);
if(ratelogic)
conn->setDownloadRateObserver(ratelogic);
logic = ratelogic;
@@ -744,7 +745,7 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
case AbstractAdaptationLogic::NearOptimal:
{
NearOptimalAdaptationLogic *noplogic =
- new (std::nothrow) NearOptimalAdaptationLogic();
+ new (std::nothrow) NearOptimalAdaptationLogic(obj);
if(noplogic)
conn->setDownloadRateObserver(noplogic);
logic = noplogic;
@@ -753,7 +754,7 @@ AbstractAdaptationLogic *PlaylistManager::createLogic(AbstractAdaptationLogic::L
case AbstractAdaptationLogic::Predictive:
{
AbstractAdaptationLogic *predictivelogic =
- new (std::nothrow) PredictiveAdaptationLogic(VLC_OBJECT(p_demux));
+ new (std::nothrow) PredictiveAdaptationLogic(obj);
if(predictivelogic)
conn->setDownloadRateObserver(predictivelogic);
logic = predictivelogic;
diff --git a/modules/demux/adaptive/logic/AbstractAdaptationLogic.cpp b/modules/demux/adaptive/logic/AbstractAdaptationLogic.cpp
index 3f53b396be..22efc19db1 100644
--- a/modules/demux/adaptive/logic/AbstractAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/AbstractAdaptationLogic.cpp
@@ -31,8 +31,9 @@
using namespace adaptive::logic;
-AbstractAdaptationLogic::AbstractAdaptationLogic ()
+AbstractAdaptationLogic::AbstractAdaptationLogic (vlc_object_t *obj)
{
+ p_obj = obj;
maxwidth = std::numeric_limits<int>::max();
maxheight = std::numeric_limits<int>::max();
}
diff --git a/modules/demux/adaptive/logic/AbstractAdaptationLogic.h b/modules/demux/adaptive/logic/AbstractAdaptationLogic.h
index 53e43b7bae..8db5ded177 100644
--- a/modules/demux/adaptive/logic/AbstractAdaptationLogic.h
+++ b/modules/demux/adaptive/logic/AbstractAdaptationLogic.h
@@ -44,7 +44,7 @@ namespace adaptive
public SegmentTrackerListenerInterface
{
public:
- AbstractAdaptationLogic ();
+ AbstractAdaptationLogic (vlc_object_t *);
virtual ~AbstractAdaptationLogic ();
virtual BaseRepresentation* getNextRepresentation(BaseAdaptationSet *, BaseRepresentation *) = 0;
@@ -64,6 +64,7 @@ namespace adaptive
};
protected:
+ vlc_object_t *p_obj;
int maxwidth;
int maxheight;
};
diff --git a/modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.cpp b/modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.cpp
index 78bf15cfe8..938c27c2b8 100644
--- a/modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.cpp
@@ -31,8 +31,8 @@
using namespace adaptive::logic;
using namespace adaptive::playlist;
-AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic () :
- AbstractAdaptationLogic ()
+AlwaysBestAdaptationLogic::AlwaysBestAdaptationLogic (vlc_object_t *obj) :
+ AbstractAdaptationLogic (obj)
{
}
diff --git a/modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.h b/modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.h
index 7610948a7e..a841936fce 100644
--- a/modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.h
+++ b/modules/demux/adaptive/logic/AlwaysBestAdaptationLogic.h
@@ -34,7 +34,7 @@ namespace adaptive
class AlwaysBestAdaptationLogic : public AbstractAdaptationLogic
{
public:
- AlwaysBestAdaptationLogic ();
+ AlwaysBestAdaptationLogic (vlc_object_t *);
virtual BaseRepresentation *getNextRepresentation(BaseAdaptationSet *, BaseRepresentation *);
};
diff --git a/modules/demux/adaptive/logic/AlwaysLowestAdaptationLogic.cpp b/modules/demux/adaptive/logic/AlwaysLowestAdaptationLogic.cpp
index 0849467265..5af1532574 100644
--- a/modules/demux/adaptive/logic/AlwaysLowestAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/AlwaysLowestAdaptationLogic.cpp
@@ -27,8 +27,8 @@
using namespace adaptive::logic;
using namespace adaptive::playlist;
-AlwaysLowestAdaptationLogic::AlwaysLowestAdaptationLogic():
- AbstractAdaptationLogic()
+AlwaysLowestAdaptationLogic::AlwaysLowestAdaptationLogic(vlc_object_t *obj):
+ AbstractAdaptationLogic(obj)
{
}
diff --git a/modules/demux/adaptive/logic/AlwaysLowestAdaptationLogic.hpp b/modules/demux/adaptive/logic/AlwaysLowestAdaptationLogic.hpp
index f965c43f79..435cb03b9a 100644
--- a/modules/demux/adaptive/logic/AlwaysLowestAdaptationLogic.hpp
+++ b/modules/demux/adaptive/logic/AlwaysLowestAdaptationLogic.hpp
@@ -29,7 +29,7 @@ namespace adaptive
class AlwaysLowestAdaptationLogic : public AbstractAdaptationLogic
{
public:
- AlwaysLowestAdaptationLogic();
+ AlwaysLowestAdaptationLogic(vlc_object_t *);
virtual BaseRepresentation* getNextRepresentation(BaseAdaptationSet *, BaseRepresentation *);
};
diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
index 1c99538375..ff4f7a7821 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.cpp
@@ -50,8 +50,8 @@ NearOptimalContext::NearOptimalContext()
, last_download_rate( 0 )
{ }
-NearOptimalAdaptationLogic::NearOptimalAdaptationLogic()
- : AbstractAdaptationLogic()
+NearOptimalAdaptationLogic::NearOptimalAdaptationLogic(vlc_object_t *obj)
+ : AbstractAdaptationLogic(obj)
, currentBps( 0 )
, usedBps( 0 )
{
diff --git a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.hpp b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.hpp
index 27ec175541..639641ab80 100644
--- a/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.hpp
+++ b/modules/demux/adaptive/logic/NearOptimalAdaptationLogic.hpp
@@ -47,7 +47,7 @@ namespace adaptive
class NearOptimalAdaptationLogic : public AbstractAdaptationLogic
{
public:
- NearOptimalAdaptationLogic();
+ NearOptimalAdaptationLogic(vlc_object_t *);
virtual ~NearOptimalAdaptationLogic();
virtual BaseRepresentation* getNextRepresentation(BaseAdaptationSet *, BaseRepresentation *);
diff --git a/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp b/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
index 4e85f16886..c81b40b59c 100644
--- a/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/PredictiveAdaptationLogic.cpp
@@ -54,10 +54,9 @@ bool PredictiveStats::starting() const
return (segments_count < 3) || !last_download_rate;
}
-PredictiveAdaptationLogic::PredictiveAdaptationLogic(vlc_object_t *p_obj_)
- : AbstractAdaptationLogic()
+PredictiveAdaptationLogic::PredictiveAdaptationLogic(vlc_object_t *obj)
+ : AbstractAdaptationLogic(obj)
{
- p_obj = p_obj_;
usedBps = 0;
vlc_mutex_init(&lock);
}
diff --git a/modules/demux/adaptive/logic/PredictiveAdaptationLogic.hpp b/modules/demux/adaptive/logic/PredictiveAdaptationLogic.hpp
index b7acfdc257..958e25dcfe 100644
--- a/modules/demux/adaptive/logic/PredictiveAdaptationLogic.hpp
+++ b/modules/demux/adaptive/logic/PredictiveAdaptationLogic.hpp
@@ -59,7 +59,6 @@ namespace adaptive
unsigned getAvailableBw(unsigned, const BaseRepresentation *) const;
std::map<adaptive::ID, PredictiveStats> streams;
unsigned usedBps;
- vlc_object_t * p_obj;
vlc_mutex_t lock;
};
}
diff --git a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
index 1b10eaf33a..dc639e1c9d 100644
--- a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
+++ b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.cpp
@@ -36,14 +36,13 @@
using namespace adaptive::logic;
using namespace adaptive;
-RateBasedAdaptationLogic::RateBasedAdaptationLogic (vlc_object_t *p_obj_) :
- AbstractAdaptationLogic (),
+RateBasedAdaptationLogic::RateBasedAdaptationLogic (vlc_object_t *obj) :
+ AbstractAdaptationLogic (obj),
bpsAvg(0),
currentBps(0)
{
usedBps = 0;
dllength = 0;
- p_obj = p_obj_;
dlsize = 0;
vlc_mutex_init(&lock);
}
@@ -123,8 +122,8 @@ void RateBasedAdaptationLogic::trackerEvent(const SegmentTrackerEvent &event)
}
}
-FixedRateAdaptationLogic::FixedRateAdaptationLogic(size_t bps) :
- AbstractAdaptationLogic()
+FixedRateAdaptationLogic::FixedRateAdaptationLogic(vlc_object_t *obj, size_t bps) :
+ AbstractAdaptationLogic(obj)
{
currentBps = bps;
}
diff --git a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.h b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.h
index e2823d37ee..d0d25927cc 100644
--- a/modules/demux/adaptive/logic/RateBasedAdaptationLogic.h
+++ b/modules/demux/adaptive/logic/RateBasedAdaptationLogic.h
@@ -47,7 +47,6 @@ namespace adaptive
size_t bpsAvg;
size_t currentBps;
size_t usedBps;
- vlc_object_t * p_obj;
MovingAverage<size_t> average;
@@ -60,7 +59,7 @@ namespace adaptive
class FixedRateAdaptationLogic : public AbstractAdaptationLogic
{
public:
- FixedRateAdaptationLogic(size_t);
+ FixedRateAdaptationLogic(vlc_object_t *, size_t);
BaseRepresentation *getNextRepresentation(BaseAdaptationSet *, BaseRepresentation *);
More information about the vlc-commits
mailing list