diff options
Diffstat (limited to 'Adaptation')
-rw-r--r-- | Adaptation/AdapTech.cpp | 44 | ||||
-rw-r--r-- | Adaptation/AdapTech.h | 1 | ||||
-rw-r--r-- | Adaptation/Panda.cpp | 4 |
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() { |