Correction adaptech and minor corrections + remove memory leak libdash 99/24899/3
authorAngelo Mantellini <[email protected]>
Mon, 10 Feb 2020 13:24:20 +0000 (14:24 +0100)
committerAngelo Mantellini <[email protected]>
Mon, 10 Feb 2020 13:40:21 +0000 (14:40 +0100)
Signed-off-by: Angelo Mantellini <[email protected]>
Change-Id: I83161f19385a5ed739e9fd280925abca8009dc71

Change-Id: If394f999b7325a6b07ddff57201f7657e58a493c
Signed-off-by: Angelo Mantellini <[email protected]>
21 files changed:
Adaptation/AdapTech.cpp
Adaptation/AdaptationLogicFactory.cpp
Adaptation/Bola.cpp
Adaptation/BufferBasedAdaptation.cpp
Adaptation/BufferBasedThreeThresholdAdaptation.cpp
Adaptation/Panda.cpp
Adaptation/RateBasedAdaptation.cpp
Common/Config.cpp
Input/DASHManager.cpp
Input/DASHReceiver.cpp
Input/ICNConnectionConsumerApi.cpp
Managers/MultimediaManager.cpp
Managers/MultimediaStream.cpp
UI/DASHPlayer.cpp
UI/DASHPlayer.h
UI/DASHPlayerNoGUI.cpp
UI/ViperGui.cpp
libdash/source/mpd/MPD.cpp
libdash/source/xml/DOMParser.cpp
main.cpp
qml/Viper/ControlPanel.qml

index 6f248b4..7c5883e 100644 (file)
@@ -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();
index f2029b5..b777251 100644 (file)
@@ -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);
     }
 }
index 470d22e..bc37dca 100644 (file)
@@ -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.
index 480b7a3..21aafe8 100644 (file)
@@ -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;
 
 }
index 7efab53..c1398c1 100644 (file)
@@ -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)
index a8c2d88..ca0c1f7 100644 (file)
@@ -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;
 }
 
index 14b3f3d..8fe0aad 100644 (file)
@@ -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();
index b1a2ddf..441db83 100644 (file)
@@ -523,14 +523,14 @@ void Config::reload()
     settings.endGroup();
 
     settings.beginGroup(QString::fromLatin1("backend"));
-    setVideoURI(settings.value(QString::fromLatin1("video_uri"), QString::fromLatin1("http://webserver/sintel/mpd")).toString());
+    setVideoURI(settings.value(QString::fromLatin1("video_uri"), QString::fromLatin1("http://httpserver/sintel/mpd")).toString());
     setV6FirstWord(settings.value(QString::fromLatin1("v6FirstWord"), QString::fromLatin1("b001")).toString());
 
     setSegmentBufferSize(settings.value(QString::fromLatin1("segment_buffer_size"), 20).toReal());
     settings.endGroup();
 
     settings.beginGroup(QString::fromLatin1("playback"));
-    setAdaptationLogic(settings.value(QString::fromLatin1("adaptation_logic"), QString::fromLatin1("Buffer Based")).toString());
+    setAdaptationLogic(settings.value(QString::fromLatin1("adaptation_logic"), QString::fromLatin1("AdapTech")).toString());
     setIcn(settings.value(QString::fromLatin1("icn"), true).toBool());
     settings.endGroup();
 
index 5317b20..5985dfe 100644 (file)
@@ -54,7 +54,7 @@ bool DASHManager::isICN()
 
 void           DASHManager::shouldAbort()
 {
-    Debug("DASH MANAGER: ABORT REQUEST\n");
+    qDebug("DASH MANAGER: ABORT REQUEST");
     this->receiver->ShouldAbort();
 }
 
index c5769b1..9781972 100644 (file)
@@ -313,7 +313,7 @@ void*                       DASHReceiver::DoBuffering               (void *recei
         if(dashReceiver->isScheduledPaced)
         {
             double delay = std::chrono::duration_cast<duration_in_seconds>(std::chrono::system_clock::now() - m_start_time).count();
-            Debug("delay: %f, target: %f\n", delay, dashReceiver->targetDownload);
+            qDebug("delay: %f, target: %f", delay, dashReceiver->targetDownload);
             if(delay < dashReceiver->targetDownload)
             {
                 sleep(dashReceiver->targetDownload - delay);
@@ -372,9 +372,9 @@ bool                                        DASHReceiver::CanPush                                   ()
 }
 void                                   DASHReceiver::ShouldAbort                               ()
 {
-    Debug("DASH RECEIVER SEGMENT --\n");
+    qDebug("DASH RECEIVER SEGMENT --");
     this->segmentNumber--;
-    Debug("DASH RECEIVER ABORT REQUEST\n");
+    qDebug("DASH RECEIVER ABORT REQUEST");
 }
 
 void                                   DASHReceiver::SetTargetDownloadingTime  (double target)
index 5933085..362c849 100644 (file)
@@ -94,7 +94,7 @@ ICNConnectionConsumerApi::ICNConnectionConsumerApi(double alpha, float beta, flo
 #else
     this->icnRateBased = true;
 #endif
-    Debug("ICN class created\n");
+    qDebug("ICN class created");
 
 }
 
@@ -110,15 +110,15 @@ ICNConnectionConsumerApi::~ICNConnectionConsumerApi() {
 }
 
 void ICNConnectionConsumerApi::Init(IChunk *chunk) {
-    Debug("ICN Connection:     STARTING\n");
+    qDebug("ICN Connection:    STARTING");
     m_first = 1;
     sizeDownloaded = 0;
     m_name = chunk->AbsoluteURI().c_str();
     m_isFinished = false;
 
     res = false;
-    Debug("ICN_Connection:\tINTIATED_to_name %s\n", m_name.c_str());
-    Debug("ICN_Connection:\tSTARTING DOWNLOAD %s\n", m_name.c_str());
+    qDebug("ICN_Connection:\tINTIATED_to_name %s", m_name.c_str());
+    qDebug("ICN_Connection:\tSTARTING DOWNLOAD %s", m_name.c_str());
 }
 
 void ICNConnectionConsumerApi::InitForMPD(const std::string& url)
@@ -131,7 +131,7 @@ void ICNConnectionConsumerApi::InitForMPD(const std::string& url)
     res = false;
     dataPos = 0;
     datSize = 0;
-    Debug("ICN_Connection:\tINTIATED_for_mpd %s\n", m_name.c_str());
+    qDebug("ICN_Connection:\tINTIATED_for_mpd %s", m_name.c_str());
 }
 
 int    ICNConnectionConsumerApi::Read(uint8_t* data, size_t len, IChunk *chunk)
@@ -177,13 +177,13 @@ int             ICNConnectionConsumerApi::Peek(uint8_t *data, size_t len, IChunk
 
 double ICNConnectionConsumerApi::GetAverageDownloadingSpeed()
 {
-    Debug("ICNConnection:      DL speed is %f\n", this->speed);
+    qDebug("ICNConnection:     DL speed is %f", this->speed);
     return this->speed;
 }
 
 double ICNConnectionConsumerApi::GetDownloadingTime()
 {
-    Debug("ICNConnection:      DL time is %f\n", this->dnltime);
+    qDebug("ICNConnection:     DL time is %f", this->dnltime);
     return this->dnltime;
 }
 
@@ -198,7 +198,7 @@ const std::vector<IHTTPTransaction *> &ICNConnectionConsumerApi::GetHTTPTransact
 void ICNConnectionConsumerApi::notifyStats(double winSize)
 {
     this->speed = (winSize); // * 1000000 * 1400 * 8;
-    Debug("ICNConnection:\tNotificationICPDL\t%f\t%f\n", winSize, speed);
+    qDebug("ICNConnection:\tNotificationICPDL\t%f\t%f", winSize, speed);
 }
 
 void ICNConnectionConsumerApi::notifyDownloadTime(double downloadingTime)
index 1bbb2c6..8cde471 100644 (file)
@@ -80,13 +80,13 @@ bool    MultimediaManager::init(const std::string& url)
     this->url = url;
     EnterCriticalSection(&this->monitorMutex);
     IMPD* mpd = this->manager->Open((char *)url.c_str());
-    Debug("url : %s\n", url.c_str());
+    qDebug("url : %s", url.c_str());
     if(mpd == NULL)
     {
         LeaveCriticalSection(&this->monitorMutex);
         return false;
     }
-    Debug("Done DL the mpd\n");
+    qDebug("Done DL the mpd");
     this->mpdWrapper->setIsStopping(false);
     this->mpdWrapper->updateMPD(mpd);
     for (size_t i = 0; i < this->managerObservers.size(); i++)
@@ -220,10 +220,10 @@ void MultimediaManager::start(bool icnEnabled, double icnAlpha, uint32_t nextOff
         this->stop();
     if(icnAlpha <= 1 && icnAlpha >=0)
     {
-        qDebug("ICN-enhanced rate estimation: alpha = %f\n",icnAlpha);
+        qDebug("ICN-enhanced rate estimation: alpha = %f",icnAlpha);
 
     } else {
-        qDebug("normal rate estimation\n");
+        qDebug("normal rate estimation");
     }
     EnterCriticalSection(&this->monitorMutex);
     if(this->mpdWrapper->hasVideoAdaptationSetAndVideoRepresentation())
@@ -252,7 +252,7 @@ void MultimediaManager::stop()
     this->stopping = false;
     this->started = false;
     LeaveCriticalSection(&this->monitorMutex);
-    Debug("VIDEO STOPPED\n");
+    qDebug("VIDEO STOPPED");
     this->mpdWrapper->reInit(viper::managers::StreamType::VIDEO);
     this->mpdWrapper->reInit(viper::managers::StreamType::AUDIO);
 }
@@ -303,6 +303,7 @@ bool MultimediaManager::isUserDependent()
 
 bool MultimediaManager::setVideoAdaptationLogic(libdash::framework::adaptation::LogicType type, struct libdash::framework::adaptation::AdaptationParameters *params)
 {
+
     if(this->mpdWrapper->hasVideoAdaptationSetAndVideoRepresentation())
     {
         if(this->videoLogic)
@@ -485,6 +486,7 @@ bool MultimediaManager::startVideoRenderingThread()
     if(this->videoRendererHandle == NULL)
         return false;
 
+
     return true;
 }
 
@@ -551,13 +553,13 @@ void* MultimediaManager::pushVideoNoOut(void *data)
             actualPosition = std::chrono::duration_cast<duration_in_milliSeconds>(manager->bufferingLimit - timeOfInsertion).count();
             if(actualPosition < 0)
             {
-                Debug("MANAGER:\tRebuffered %d ms\n", actualPosition *(-1));
+                qDebug("MANAGER:\tRebuffered %d ms", actualPosition *(-1));
                 manager->lastPointInTime = timeOfInsertion;
                 manager->bufferingLimit = manager->lastPointInTime + std::chrono::seconds(((int)manager->getSegmentDuration() / 1000));
             }
             else
             {
-                Debug("MANAGER: INSERT TO BUFFER old_fillness: %f, new_fillness: %f\n", (double)((double)actualPosition/1000.0) / (double) this->segmentBufferSize, (double)((double)(actualPosition + 2000)/1000.0) / (double) manager->segmentBufferSize);
+                qDebug("MANAGER: INSERT TO BUFFER old_fillness: %f, new_fillness: %f", (double)((double)actualPosition/1000.0) / (double) manager->segmentBufferSize, (double)((double)(actualPosition + 2000)/1000.0) / (double) manager->segmentBufferSize);
                 manager->bufferingLimit = manager->bufferingLimit + std::chrono::seconds(((int)manager->getSegmentDuration() /1000));
                 manager->lastPointInTime = timeOfInsertion;
             }
index 4b11da8..fa0511b 100644 (file)
@@ -164,13 +164,13 @@ void MultimediaStream::notifyStatistics(int segNum, uint32_t bitrate, int fps, u
         this->observers.at(i)->notifyStatistics(segNum, bitrate, fps, quality);
 }
 
-void       MultimediaStream::notifyQualityDownloading(uint32_t quality)
+void MultimediaStream::notifyQualityDownloading(uint32_t quality)
 {
     for(size_t i = 0; i < observers.size(); i++)
         this->observers.at(i)->notifyQualityDownloading(quality);
 }
 
-int        MultimediaStream::getBufferLevel()
+int MultimediaStream::getBufferLevel()
 {
     int bufferFill = 0;
     for(size_t i=0; i < observers.size(); i++)
index 63debc1..fd97e76 100644 (file)
@@ -83,7 +83,7 @@ void DASHPlayer::onStartButtonPressed(int period, int videoAdaptationSet, int vi
     {
         return;
     }
-    Debug("DASH PLAYER:        STARTING VIDEO\n");
+    qDebug("DASH PLAYER:       STARTING VIDEO");
     this->multimediaManager->start(this->icn, 20, 0);
 }
 void DASHPlayer::stopButtonPressed()
@@ -210,7 +210,7 @@ bool DASHPlayer::downloadMPD(const QString &adaptationLogic, bool icn)
         this->segment = 0;
         std::string mUrl = this->videoURI;
 
-        Debug("MPD is: %s\n", mUrl.c_str());
+        qDebug("MPD is: %s", mUrl.c_str());
         if (!this->onDownloadMPDPressed(mUrl))
             return false;
 
@@ -249,6 +249,7 @@ bool DASHPlayer::downloadMPD(const QString &adaptationLogic, bool icn)
     return true;
 }
 
+#if 0
 void DASHPlayer::play()
 {
     this->offset = 0;
@@ -257,6 +258,7 @@ void DASHPlayer::play()
     this->onSettingsChanged(0,0,0,0,0);
     this->onStartButtonPressed(0,0,0,0,0, this->adaptationLogic);
 }
+#endif
 
 void DASHPlayer::repeatVideo(bool repeat)
 {
@@ -328,21 +330,20 @@ void DASHPlayer::initSlider()
 
 }
 
-std::string DASHPlayer::msec2string(uint64_t milliseconds)
+std::string DASHPlayer::msec2string(uint64_t ms)
 {
-    uint64_t seconds = milliseconds/1000;
-    int32_t sec = seconds%60;
-    seconds = (seconds - sec)/60;
-    int32_t min = seconds%60;
-    int32_t hours = (seconds - min)/60;
-    char timeStamp[10];
-    sprintf(timeStamp, "%02d:%02d:%02d", hours, min, sec);
-    return std::string(timeStamp);
+    std::ostringstream oss;
+    oss << (ms / 3600000)
+        << ":"
+        << (ms / 60000) % 60
+        << ":"
+        << (ms / 1000) % 60;
+    return oss.str();
 }
 
 void DASHPlayer::onStopped()
 {
-    int posPlayer = this->position;
+    uint64_t posPlayer = this->position;
     if (this->seek)
     {
         this->seek = false;
@@ -887,7 +888,7 @@ void DASHPlayer::setRateEstimator(int rateEstimator)
 
 void DASHPlayer::error(const QtAV::AVError &e)
 {
-    qDebug("error in the player!");
+    qDebug("error in the player; %s", qPrintable(e.string()));
     seekVideo(0);
 }
 
index 7b6274f..bc302f4 100644 (file)
@@ -67,7 +67,9 @@ public:
     Q_INVOKABLE void seekVideo(float value);
     Q_INVOKABLE void repeatVideo(bool repeat);
     Q_INVOKABLE void onStopButtonPressed();
+#if 0
     Q_INVOKABLE void play();
+#endif
     Q_INVOKABLE void onStopped();
     Q_INVOKABLE QString getAdaptationLogic();
     Q_INVOKABLE void setAdaptationLogic(QString adaptationLogic);
index 1794833..07aa1ae 100644 (file)
@@ -129,7 +129,7 @@ void DASHPlayerNoGUI::onStartButtonPressed(int period, int videoAdaptationSet, i
         return;
     }
 
-    Debug("DASH PLAYER:        STARTING VIDEO\n");
+    qDebug("DASH PLAYER:       STARTING VIDEO");
     this->multimediaManager->start(this->isICN, this->alpha, 0);
 }
 
index e23bd30..5f9814e 100644 (file)
@@ -249,6 +249,7 @@ void ViperGui::setStop(bool stop)
     this->stop = stop;
     this->segment = 0;
     this->bufferDuration = 0;
+    this->position = 0;
 }
 
 bool ViperGui::getStop()
index 0c4f2f3..8563ef0 100644 (file)
@@ -27,6 +27,7 @@ MPD::MPD    () :
         maxSegmentDuration(""),
         maxSubsegmentDuration("")
 {
+    this->mpdPathBaseUrl = NULL;
 }
 MPD::~MPD   ()
 {
@@ -38,6 +39,8 @@ MPD::~MPD   ()
         delete(this->periods.at(i));
     for(size_t i = 0; i < this->baseUrls.size(); i++)
         delete(this->baseUrls.at(i));
+    if (this->mpdPathBaseUrl)
+        delete(this->mpdPathBaseUrl);
 }
 
 const std::vector<IProgramInformation *>&   MPD::GetProgramInformations             () const 
index 5feb385..c4fd2fb 100644 (file)
@@ -41,11 +41,11 @@ bool    DOMParser::Parse                    (std::string path)
     if(xmlTextReaderRead(this->reader))
         this->root = this->ProcessNode(path);
 
+    xmlFreeTextReader(this->reader);
+
     if(this->root == NULL)
         return false;
 
-    xmlFreeTextReader(this->reader);
-
     return true;
 }
 Node*   DOMParser::ProcessNode              (std::string path)
@@ -110,6 +110,7 @@ Node*   DOMParser::ProcessNode              (std::string path)
            Node *node = new Node();
            node->SetType(type);
            node->SetText(text);
+           delete text;
            return node;
        }
     }
index 76fbe0c..2c4211d 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char *argv[])
         pthread_mutex_init(&mainMutex,NULL);
         pthread_cond_init(&mainCond, NULL);
 
-        Debug("STARTING NO GUI\n");
+        qDebug("STARTING NO GUI");
         DASHPlayerNoGUI p(argc,argv, &mainCond, true);
 
 
index d54bd67..75ffecf 100755 (executable)
@@ -67,7 +67,8 @@ Rectangle {
 
     function setStopState()
     {
-        isPlaying = "stop"
+        playState = "stop"
+        isPlaying = false
         playBtn.checked = false
 
     }