diff options
author | Angelo Mantellini <angelo.mantellini@cisco.com> | 2020-02-10 14:24:20 +0100 |
---|---|---|
committer | Angelo Mantellini <angelo.mantellini@cisco.com> | 2020-02-10 14:40:21 +0100 |
commit | d1f1d938930b6b473bedf3736fc675d5c4c3ee9a (patch) | |
tree | 8695f5d9105fad8f08f39ecb7ce7046d8e85ccb9 /Adaptation | |
parent | 0b2f5c75cfeb33b233c02866e848e3d94de48ee7 (diff) |
Correction adaptech and minor corrections + remove memory leak libdash
Signed-off-by: Angelo Mantellini <angelo.mantellini@cisco.com>
Change-Id: I83161f19385a5ed739e9fd280925abca8009dc71
Change-Id: If394f999b7325a6b07ddff57201f7657e58a493c
Signed-off-by: Angelo Mantellini <angelo.mantellini@cisco.com>
Diffstat (limited to 'Adaptation')
-rw-r--r-- | Adaptation/AdapTech.cpp | 18 | ||||
-rw-r--r-- | Adaptation/AdaptationLogicFactory.cpp | 16 | ||||
-rw-r--r-- | Adaptation/Bola.cpp | 6 | ||||
-rw-r--r-- | Adaptation/BufferBasedAdaptation.cpp | 6 | ||||
-rw-r--r-- | Adaptation/BufferBasedThreeThresholdAdaptation.cpp | 6 | ||||
-rw-r--r-- | Adaptation/Panda.cpp | 36 | ||||
-rw-r--r-- | Adaptation/RateBasedAdaptation.cpp | 6 |
7 files changed, 47 insertions, 47 deletions
diff --git a/Adaptation/AdapTech.cpp b/Adaptation/AdapTech.cpp index 6f248b4d..7c5883e1 100644 --- a/Adaptation/AdapTech.cpp +++ b/Adaptation/AdapTech.cpp @@ -42,8 +42,8 @@ AdapTechAdaptation::AdapTechAdaptation(viper::managers::StreamType type, MPDWrap this->isCheckedForReceiver = false; this->myQuality = 0; this->currentBitrate = 0; - Debug("BufferRateBasedParams:\talpha:%f\tfirst threshold: %f\tsecond threshold: %f\tswitch-up margin: %d\tSlack: %f\n",this->alphaRate, (double)reservoirThreshold/100, (double)maxThreshold/100, this->switchUpThreshold, this->slackParam); - Debug("Buffer Adaptation: STARTED\n"); + qDebug("BufferRateBasedParams:\talpha:%f\tfirst threshold: %f\tsecond threshold: %f\tswitch-up margin: %d\tSlack: %f",this->alphaRate, (double)reservoirThreshold/100, (double)maxThreshold/100, this->switchUpThreshold, this->slackParam); + qDebug("Buffer Adaptation: STARTED"); } AdapTechAdaptation::~AdapTechAdaptation() { @@ -98,7 +98,7 @@ void AdapTechAdaptation::setBitrate(uint32_t bufferFill) 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); + qDebug("Adaptech:\tFor %s:\tbuffer_level: %f, instantaneousBw: %lu, AverageBW: %lu,already set: %d",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio", (double)bufferFill/100, this->instantBw, this->averageBw , this->myQuality); if(bufferFill < this->reservoirThreshold) { @@ -107,7 +107,7 @@ void AdapTechAdaptation::setBitrate(uint32_t bufferFill) 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); + qDebug("Adaptech:\tFor %s: buffer level too low, going to panic mode, old quality: %d",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio", mySetQuality); this->mpdWrapper->setSegmentQuality(this->type, mySetQuality); } } @@ -116,7 +116,7 @@ void AdapTechAdaptation::setBitrate(uint32_t bufferFill) 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); + qDebug("AdaptechNA:\tFor %s: buffer level high enough, restoring old computed quality: %d",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio", mySetQuality); } this->representation = representations.at(this->myQuality); } @@ -134,7 +134,7 @@ void AdapTechAdaptation::setBitrateOption1(uint32_t bufferFill) representations = this->mpdWrapper->getRepresentations(this->type); size_t i = 0; - Debug("bufferlevel: %u, instant rate %lu, average rate %lu\n", bufferFill, this->instantBw, this->averageBw); + qDebug("bufferlevel: %u, instant rate %lu, average rate %lu", bufferFill, this->instantBw, this->averageBw); phi1 = 0; phi2 = 0; while(i < representations.size()) @@ -200,12 +200,12 @@ void AdapTechAdaptation::setBitrateOption1(uint32_t bufferFill) } this->representation = representations.at(this->myQuality); this->currentBitrate = (uint64_t) this->representation->GetBandwidth(); - Debug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, instantaneousBw: %lu, AverageBW: %lu, choice: %d\n",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferFill/100 , (double)bufferFill/100, this->instantBw, this->averageBw , this->myQuality); + qDebug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, instantaneousBw: %lu, AverageBW: %lu, choice: %d",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferFill/100 , (double)bufferFill/100, this->instantBw, this->averageBw , this->myQuality); } void AdapTechAdaptation::bitrateUpdate(uint64_t bps, uint32_t segNum) { - Debug("rate estimation: %lu\n", bps); + qDebug("rate estimation: %lu", bps); this->instantBw = bps; if(this->averageBw == 0) { @@ -228,7 +228,7 @@ void AdapTechAdaptation::checkedByDASHReceiver() } void AdapTechAdaptation::bufferUpdate(uint32_t bufferFill, int maxC) { - Debug("buffer update: %u\n", bufferFill); + qDebug("buffer update: %u", bufferFill); EnterCriticalSection(&this->monitorLock); this->setBitrate(bufferFill); this->notifyBitrateChange(); diff --git a/Adaptation/AdaptationLogicFactory.cpp b/Adaptation/AdaptationLogicFactory.cpp index f2029b5d..b7772516 100644 --- a/Adaptation/AdaptationLogicFactory.cpp +++ b/Adaptation/AdaptationLogicFactory.cpp @@ -21,28 +21,28 @@ IAdaptationLogic* AdaptationLogicFactory::create(LogicType logic, viper::manager switch(logic) { case AlwaysLowest: - Debug("Always lowest\n"); + qDebug("Always lowest"); return new AlwaysLowestLogic(type, mpdWrapper, paramsForAdaptation); case RateBased: - Debug("Rate based\n"); + qDebug("Rate based"); return new RateBasedAdaptation(type, mpdWrapper, paramsForAdaptation); case BufferBased: - Debug("Buffer based\n"); + qDebug("Buffer based"); return new BufferBasedAdaptation(type, mpdWrapper, paramsForAdaptation); case AdapTech: - Debug("AdapTech\n"); + qDebug("AdapTech"); return new AdapTechAdaptation(type, mpdWrapper, paramsForAdaptation); case BufferBasedThreeThreshold: - Debug("Buffer based 3 threshold\n"); + qDebug("Buffer based 3 threshold"); return new BufferBasedThreeThresholdAdaptation(type, mpdWrapper, paramsForAdaptation); case Panda: - Debug("Panda\n"); + qDebug("Panda"); return new PandaAdaptation(type, mpdWrapper, paramsForAdaptation); case Bola: - Debug("Bola\n"); + qDebug("Bola"); return new BolaAdaptation(type, mpdWrapper, paramsForAdaptation); default: - Debug("default => return Always Lowest\n"); + qDebug("default => return Always Lowest"); return new AlwaysLowestLogic(type, mpdWrapper, paramsForAdaptation); } } diff --git a/Adaptation/Bola.cpp b/Adaptation/Bola.cpp index 470d22e8..bc37dca5 100644 --- a/Adaptation/Bola.cpp +++ b/Adaptation/Bola.cpp @@ -310,7 +310,7 @@ void BolaAdaptation::setBitrate(uint32_t bufferFill) //double timeSinceLastDownload = getDelayFromLastFragmentInSeconds(); // Define function double timeSinceLastDownload = this->currentDownloadTimeInstant - this->lastDownloadTimeInstant; - Debug("VirtualBuffer - Time Since Last Download:\t%f\n", timeSinceLastDownload); + qDebug("VirtualBuffer - Time Since Last Download:\t%f", timeSinceLastDownload); if (timeSinceLastDownload > 0.0) { this->virtualBuffer += timeSinceLastDownload; @@ -322,7 +322,7 @@ void BolaAdaptation::setBitrate(uint32_t bufferFill) this->virtualBuffer = 0.0; } - Debug("VirtualBuffer - Virtual Buffer Value:\t%f\n", this->virtualBuffer); + qDebug("VirtualBuffer - Virtual Buffer Value:\t%f", this->virtualBuffer); // Update currentDownloadTimeInstant this->lastDownloadTimeInstant = this->currentDownloadTimeInstant; @@ -330,7 +330,7 @@ void BolaAdaptation::setBitrate(uint32_t bufferFill) // Update bolaQuality using virtualBuffer: bufferLevel might be artificially low because of lack of availability int bolaQualityVirtual = getQualityFromBufferLevel(bufferLevelSeconds + this->virtualBuffer); - Debug("VirtualBuffer - Bola Quality Virtual:\t%d\n", bolaQualityVirtual); + qDebug("VirtualBuffer - Bola Quality Virtual:\t%d", bolaQualityVirtual); if (bolaQualityVirtual > bolaQuality) { // May use quality higher than that indicated by real buffer level. // In this case, make sure there is enough throughput to download a fragment before real buffer runs out. diff --git a/Adaptation/BufferBasedAdaptation.cpp b/Adaptation/BufferBasedAdaptation.cpp index 480b7a38..21aafe85 100644 --- a/Adaptation/BufferBasedAdaptation.cpp +++ b/Adaptation/BufferBasedAdaptation.cpp @@ -33,8 +33,8 @@ BufferBasedAdaptation::BufferBasedAdaptation (viper::managers::StreamTy this->lastBufferFill = 0; this->bufferEOS = false; this->shouldAbort = false; - Debug("BufferBasedParams:\t%f\t%f\n", (double)reservoirThreshold/100, (double)maxThreshold/100); - Debug("Buffer Adaptation: STARTED\n"); + qDebug("BufferBasedParams:\t%f\t%f", (double)reservoirThreshold/100, (double)maxThreshold/100); + qDebug("Buffer Adaptation: STARTED"); } BufferBasedAdaptation::~BufferBasedAdaptation () @@ -111,7 +111,7 @@ void BufferBasedAdaptation::setBitrate(uint32_t bufferFill) { this->shouldAbort = true; } - Debug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, choice: %lu, should_trigger_abort: %s\n", (this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferFill/100 , (double)bufferFill/100, i, this->shouldAbort ? "YES" : "NO"); + qDebug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, choice: %lu, should_trigger_abort: %s", (this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferFill/100 , (double)bufferFill/100, i, this->shouldAbort ? "YES" : "NO"); this->lastBufferFill = bufferFill; } diff --git a/Adaptation/BufferBasedThreeThresholdAdaptation.cpp b/Adaptation/BufferBasedThreeThresholdAdaptation.cpp index 7efab53a..c1398c15 100644 --- a/Adaptation/BufferBasedThreeThresholdAdaptation.cpp +++ b/Adaptation/BufferBasedThreeThresholdAdaptation.cpp @@ -36,8 +36,8 @@ BufferBasedThreeThresholdAdaptation::BufferBasedThreeThresholdAdaptation(viper:: this->shouldAbort = false; this->isCheckedForReceiver = false; this->currentBitrate = 0; - Debug("BufferRateBasedParams:\t%f\t%f\t%f\n",(double)this->firstThreshold/100, (double)secondThreshold/100, (double)thirdThreshold/100); - Debug("Buffer Adaptation: STARTED\n"); + qDebug("BufferRateBasedParams:\t%f\t%f\t%f",(double)this->firstThreshold/100, (double)secondThreshold/100, (double)thirdThreshold/100); + qDebug("Buffer Adaptation: STARTED"); } BufferBasedThreeThresholdAdaptation::~BufferBasedThreeThresholdAdaptation() @@ -139,7 +139,7 @@ void BufferBasedThreeThresholdAdaptation::setBitrate(uint32_t bufferFill) } this->representation = representations.at(this->myQuality); this->currentBitrate = (uint64_t) this->representation->GetBandwidth(); - Debug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, instantaneousBw: %lu, choice: %d\n",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferFill/100 , (double)bufferFill/100, this->instantBw, this->myQuality); + qDebug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, instantaneousBw: %lu, choice: %d",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferFill/100 , (double)bufferFill/100, this->instantBw, this->myQuality); } void BufferBasedThreeThresholdAdaptation::bitrateUpdate(uint64_t bps, uint32_t segNum) diff --git a/Adaptation/Panda.cpp b/Adaptation/Panda.cpp index a8c2d887..ca0c1f7d 100644 --- a/Adaptation/Panda.cpp +++ b/Adaptation/Panda.cpp @@ -66,17 +66,17 @@ PandaAdaptation::PandaAdaptation(StreamType type, MPDWrapper *mpdWrapper, struct std::vector<IRepresentation* > representations = this->mpdWrapper->getRepresentations(this->type); this->mpdWrapper->releaseLock(); this->availableBitrates.clear(); - Debug("PANDA Available Bitrates...\n"); + qDebug("PANDA Available Bitrates..."); for(size_t i = 0; i < representations.size(); i++) { this->availableBitrates.push_back((uint64_t)(representations.at(i)->GetBandwidth())); - Debug("%d - %I64u bps\n", i+1, this->availableBitrates[i]); + qDebug("%d - %I64u bps", i+1, this->availableBitrates[i]); } 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); + qDebug("Panda parameters: K= %f, Bmin = %f, alpha = %f, beta = %f, W = %f ", param_K, param_Bmin, param_Alpha, param_Beta, param_W); } PandaAdaptation::~PandaAdaptation() { @@ -127,12 +127,12 @@ void PandaAdaptation::quantizer() this->deltaUp = this->param_Epsilon * (double)this->smoothBw; this->deltaDown = 0.0; - Debug("** DELTA UP:\t%f\n", this->deltaUp); + qDebug("** DELTA UP:\t%f", this->deltaUp); uint64_t smoothBw_UP = this->smoothBw - this->deltaUp; uint64_t smoothBw_DOWN = this->smoothBw - this->deltaDown; - Debug("** Smooth-BW UP:\t%d\t Smooth-BW DOWN:\t%d\n", smoothBw_UP, smoothBw_DOWN); + qDebug("** Smooth-BW UP:\t%d\t Smooth-BW DOWN:\t%d", smoothBw_UP, smoothBw_DOWN); std::vector<IRepresentation *> representations; representations = this->mpdWrapper->getRepresentations(this->type); @@ -155,7 +155,7 @@ void PandaAdaptation::quantizer() iDown = 0; bitrateDown = (uint64_t) representations.at(iDown)->GetBandwidth(); - Debug("** Bitrate DOWN:\t%d\t at Quality:\t%d\n", bitrateDown, iDown); + qDebug("** Bitrate DOWN:\t%d\t at Quality:\t%d", bitrateDown, iDown); // UP uint32_t iUp = 0; @@ -170,9 +170,9 @@ void PandaAdaptation::quantizer() iUp = 0; bitrateUp = (uint64_t) representations.at(iUp)->GetBandwidth(); - Debug("** Bitrate UP:\t%d\t at Quality:\t%d\n", bitrateUp, iUp); + qDebug("** Bitrate UP:\t%d\t at Quality:\t%d", bitrateUp, iUp); - Debug("** Current RATE:\t%d\n Current QUALITY:\t%d\n", this->currentBitrate, this->current); + qDebug("** Current RATE:\t%d Current QUALITY:\t%d\n", this->currentBitrate, this->current); // Next bitrate computation @@ -183,7 +183,7 @@ void PandaAdaptation::quantizer() } else if(this->currentBitrate <= bitrateDown && this->currentBitrate >= bitrateUp) { - Debug("** CURRENT UNCHANGED **\n"); + qDebug("** CURRENT UNCHANGED **"); } else { @@ -208,9 +208,9 @@ void PandaAdaptation::setBitrate(uint64_t bps) else this->targetBw = bps; - Debug("** INSTANTANEOUS BW:\t%d\n", bps); - Debug("** CLASSIC EWMA BW:\t%d\n", this->averageBw); - Debug("** PANDA TARGET BW:\t%d\n", this->targetBw); + qDebug("** INSTANTANEOUS BW:\t%d", bps); + qDebug("** CLASSIC EWMA BW:\t%d", this->averageBw); + qDebug("** PANDA TARGET BW:\t%d", this->targetBw); // 2. Calculating the smoothBW if(this->interTime) @@ -218,23 +218,23 @@ void PandaAdaptation::setBitrate(uint64_t bps) else this->smoothBw = this->targetBw; - Debug("** PANDA SMOOTH BW:\t%d\n", this->smoothBw); + qDebug("** PANDA SMOOTH BW:\t%d", this->smoothBw); // 3. Quantization this->quantizer(); - Debug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, instantaneousBw: %lu, AverageBW: %lu, choice: %d\n",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferLevel/100 , (double)bufferLevel/100, this->instantBw, this->averageBw , this->current); + qDebug("ADAPTATION_LOGIC:\tFor %s:\tlast_buffer: %f\tbuffer_level: %f, instantaneousBw: %lu, AverageBW: %lu, choice: %d",(this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio",(double)lastBufferLevel/100 , (double)bufferLevel/100, this->instantBw, this->averageBw , this->current); this->lastBufferLevel = this->bufferLevel; // 4. Computing the "actual inter time" this->bufferLevelSeconds = (double)((this->bufferLevel * this->bufferMaxSizeSeconds) *1./100); this->targetInterTime = ((double)this->currentBitrate * segmentDuration) * 1./this->smoothBw + param_Beta * (this->bufferLevelSeconds - param_Bmin); - Debug("** TARGET INTER TIME:\t%f\n", this->targetInterTime); - Debug("** DOWNLOAD TIME:\t%f\n", this->downloadTime); + qDebug("** TARGET INTER TIME:\t%f", this->targetInterTime); + qDebug("** DOWNLOAD TIME:\t%f", this->downloadTime); this->targetInterTime = (this->targetInterTime > 0) ? this->targetInterTime : 0.0; this->interTime = this->targetInterTime > this->downloadTime ? this->targetInterTime : this->downloadTime; this->interTime = this->interTime > 3 ? 3 : this->interTime; - Debug("** ACTUAL INTER TIME:\t%f\n", this->interTime); + qDebug("** ACTUAL INTER TIME:\t%f", this->interTime); this->multimediaManager->setTargetDownloadingTime((this->type == viper::managers::StreamType::VIDEO), interTime); } @@ -264,7 +264,7 @@ void PandaAdaptation::dLTimeUpdate(double time) void PandaAdaptation::bufferUpdate(uint32_t bufferfill, int maxC) { - Debug("bufferlvl: %d\n", bufferfill); + qDebug("bufferlvl: %d", bufferfill); this->bufferLevel = bufferfill; } diff --git a/Adaptation/RateBasedAdaptation.cpp b/Adaptation/RateBasedAdaptation.cpp index 14b3f3d6..8fe0aad6 100644 --- a/Adaptation/RateBasedAdaptation.cpp +++ b/Adaptation/RateBasedAdaptation.cpp @@ -37,7 +37,7 @@ RateBasedAdaptation::RateBasedAdaptation(StreamType type, MPDWrapper *mpdWrapper this->mpdWrapper->releaseLock(); this->multimediaManager = NULL; this->alpha = params->Rate_Alpha; - Debug("RateBasedParams:\t%f\n",alpha); + qDebug("RateBasedParams:\t%f",alpha); this->averageBw = 0; } @@ -103,14 +103,14 @@ void RateBasedAdaptation::setBitrate(uint64_t bps) if((size_t)i == (size_t)(representations.size())) i = i-1; - Debug("ADAPTATION_LOGIC:\tFor %s:\tBW_estimation(ewma): %lu, choice: %lu\n", ((this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio"), this->averageBw, i); + qDebug("ADAPTATION_LOGIC:\tFor %s:\tBW_estimation(ewma): %lu, choice: %lu", ((this->type == viper::managers::StreamType::VIDEO) ? "video" : "audio"), this->averageBw, i); this->representation = representations.at(i); this->currentBitrate = this->representation->GetBandwidth(); } void RateBasedAdaptation::bitrateUpdate(uint64_t bps, uint32_t segNum) { - Debug("Rate Based adaptation: speed received: %lu\n", bps); + qDebug("Rate Based adaptation: speed received: %lu", bps); this->mpdWrapper->acquireLock(); this->setBitrate(bps); this->notifyBitrateChange(); |