aboutsummaryrefslogtreecommitdiffstats
path: root/Adaptation/AdapTech.cpp
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/AdapTech.cpp
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/AdapTech.cpp')
-rw-r--r--Adaptation/AdapTech.cpp44
1 files changed, 38 insertions, 6 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);