aboutsummaryrefslogtreecommitdiffstats
path: root/Adaptation
diff options
context:
space:
mode:
authorJacques SAMAIN <jsamain+fdio@cisco.com>2018-06-01 19:56:33 +0200
committerJacques SAMAIN <jsamain+fdio@cisco.com>2018-06-04 12:16:30 +0000
commit872b2e96a111d6da5f821a6dc61b923f9913b3f3 (patch)
tree9dbae9fb4cf3ed4a35a0698e0cf7f4b446ffeedb /Adaptation
parent6120adcbd955c072f560ba3918ed566088374fa0 (diff)
Several corrections:
*effectively take into account live MPD *Fix several bugs Change-Id: I9b925f222653d2d196b09b4e96cb15119ec8af44 Signed-off-by: Jacques SAMAIN <jsamain+fdio@cisco.com>
Diffstat (limited to 'Adaptation')
-rw-r--r--Adaptation/AdapTech.cpp44
-rw-r--r--Adaptation/AdapTech.h1
-rw-r--r--Adaptation/Panda.cpp4
3 files changed, 41 insertions, 8 deletions
diff --git a/Adaptation/AdapTech.cpp b/Adaptation/AdapTech.cpp
index dc88fae6..6f248b4d 100644
--- a/Adaptation/AdapTech.cpp
+++ b/Adaptation/AdapTech.cpp
@@ -82,12 +82,6 @@ void AdapTechAdaptation::notifyBitrateChange()
this->multimediaManager->setVideoQuality();
else
this->multimediaManager->setAudioQuality();
- //Should Abort is done here to avoid race condition with DASHReceiver::DoBuffering()
-// if(this->shouldAbort)
-// {
-// this->multimediaManager->shouldAbort((this->type == viper::managers::StreamType::VIDEO));
-// }
-// this->shouldAbort = false;
}
uint64_t AdapTechAdaptation::getBitrate()
@@ -97,6 +91,44 @@ uint64_t AdapTechAdaptation::getBitrate()
void AdapTechAdaptation::setBitrate(uint32_t bufferFill)
{
+ std::vector<IRepresentation *> representations;
+ representations = this->mpdWrapper->getRepresentations(this->type);
+ bool flagIsSet = this->mpdWrapper->getSegmentIsSetFlag(this->type);
+ int mySetQuality = this->mpdWrapper->getSegmentQuality(this->type);
+
+ if(flagIsSet)
+ {
+ Debug("Adaptech:\tFor %s:\tbuffer_level: %f, instantaneousBw: %lu, AverageBW: %lu,already set: %d\n",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio", (double)bufferFill/100, this->instantBw, this->averageBw , this->myQuality);
+
+ if(bufferFill < this->reservoirThreshold)
+ {
+ if(mySetQuality == -1)
+ {
+ mySetQuality = this->myQuality;
+ this->myQuality = 0;
+ this->representation = representations.at(this->myQuality);
+ Debug("Adaptech:\tFor %s: buffer level too low, going to panic mode, old quality: %d\n",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio", mySetQuality);
+ this->mpdWrapper->setSegmentQuality(this->type, mySetQuality);
+ }
+ }
+ else
+ {
+ if(mySetQuality != -1)
+ {
+ this->myQuality = mySetQuality;
+ Debug("AdaptechNA:\tFor %s: buffer level high enough, restoring old computed quality: %d\n",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio", mySetQuality);
+ }
+ this->representation = representations.at(this->myQuality);
+ }
+ }
+ else
+ {
+ this->setBitrateOption1(bufferFill);
+ this->mpdWrapper->setSegmentIsSetFlag(this->type, true);
+ }
+}
+void AdapTechAdaptation::setBitrateOption1(uint32_t bufferFill)
+{
uint32_t phi1, phi2;
std::vector<IRepresentation *> representations;
representations = this->mpdWrapper->getRepresentations(this->type);
diff --git a/Adaptation/AdapTech.h b/Adaptation/AdapTech.h
index c7f4e33c..24ae2231 100644
--- a/Adaptation/AdapTech.h
+++ b/Adaptation/AdapTech.h
@@ -41,6 +41,7 @@ public:
virtual void bufferUpdate(uint32_t bufferFill, int maxC);
virtual void dLTimeUpdate(double time);
void setBitrate(uint32_t bufferFill);
+ void setBitrateOption1(uint32_t bufferFill);
uint64_t getBitrate();
virtual void setMultimediaManager(viper::managers::IMultimediaManagerBase *_mmManager);
void notifyBitrateChange();
diff --git a/Adaptation/Panda.cpp b/Adaptation/Panda.cpp
index e0c19b27..a8c2d887 100644
--- a/Adaptation/Panda.cpp
+++ b/Adaptation/Panda.cpp
@@ -64,7 +64,7 @@ PandaAdaptation::PandaAdaptation(StreamType type, MPDWrapper *mpdWrapper, struct
// Retrieve the available bitrates
this->mpdWrapper->acquireLock();
std::vector<IRepresentation* > representations = this->mpdWrapper->getRepresentations(this->type);
-
+ this->mpdWrapper->releaseLock();
this->availableBitrates.clear();
Debug("PANDA Available Bitrates...\n");
for(size_t i = 0; i < representations.size(); i++)
@@ -76,7 +76,7 @@ PandaAdaptation::PandaAdaptation(StreamType type, MPDWrapper *mpdWrapper, struct
this->representation = representations.at(0);
this->currentBitrate = (uint64_t) this->representation->GetBandwidth();
- Debug("Panda parameters: K= %f, Bmin = %f, alpha = %f, beta = %f, W = %f\n", param_K, param_Bmin, param_Alpha, param_Beta, param_W);
+ Debug("Panda parameters: K= %f, Bmin = %f, alpha = %f, beta = %f, W = %f \n", param_K, param_Bmin, param_Alpha, param_Beta, param_W);
}
PandaAdaptation::~PandaAdaptation() {