From e57e3f656fce06c7867906d014270a0fe8fba175 Mon Sep 17 00:00:00 2001 From: "Angelo Mantellini (manangel)" Date: Tue, 27 Jun 2017 16:27:57 +0200 Subject: restore adaptation logic and android correction Change-Id: I20358214b0c1debc544e9e4b08c1cfd84aff4611 Signed-off-by: Angelo Mantellini (manangel) --- Input/DASHReceiver.cpp | 4 ++-- Input/ICNConnectionConsumerApi.cpp | 17 +++++++---------- Input/ICNConnectionConsumerApi.h | 2 +- Input/MediaObject.cpp | 2 +- MPD/MPDWrapper.cpp | 8 ++++---- 5 files changed, 15 insertions(+), 18 deletions(-) diff --git a/Input/DASHReceiver.cpp b/Input/DASHReceiver.cpp index c1f1acc6..f559f298 100644 --- a/Input/DASHReceiver.cpp +++ b/Input/DASHReceiver.cpp @@ -207,7 +207,7 @@ void DASHReceiver::NotifySegmentDownloaded () void DASHReceiver::DownloadInitSegmentWithoutLock () { - int rep = std::stoi(this->mpdWrapper->getRepresentationIDWithoutLock(type).c_str()); + int rep = atoi(this->mpdWrapper->getRepresentationIDWithoutLock(type).c_str()); if (this->InitSegmentExists(rep)) return; @@ -224,7 +224,7 @@ void DASHReceiver::DownloadInitSegmentWithoutLock () void DASHReceiver::DownloadInitSegment () { - int rep = std::stoi(this->mpdWrapper->getRepresentationID(type).c_str()); + int rep = atoi(this->mpdWrapper->getRepresentationID(type).c_str()); if (this->InitSegmentExists(rep)) return; diff --git a/Input/ICNConnectionConsumerApi.cpp b/Input/ICNConnectionConsumerApi.cpp index 04b378df..d5048cba 100644 --- a/Input/ICNConnectionConsumerApi.cpp +++ b/Input/ICNConnectionConsumerApi.cpp @@ -56,25 +56,22 @@ ICNConnectionConsumerApi::ICNConnectionConsumerApi(double alpha, float beta, flo InitializeConditionVariable (&this->contentRetrieved); InitializeCriticalSection (&this->monitorMutex); this->hTTPClientConnection = new libl4::http::HTTPClientConnection(); - //this->myConsumer = new ConsumerSocket(ccnx::Name(), TransportProtocolAlgorithms::RAAQM); - //this->myConsumer->setSocketOption(RaaqmTransportOptions::GAMMA_VALUE, (int)gamma); - + libl4::transport::ConsumerSocket &c = this->hTTPClientConnection->getConsumer(); bool configFile = false; //CHECK if we are not going to override the configuration file. (if !autotune) - if(FILE *fp = fopen("/usr/etc/consumer.conf", "r")) + if(FILE *fp = fopen("/usr/local/etc/hicn-consumer.conf", "r")) { fclose(fp); configFile = true; } if(!configFile) { -// qDebug("beta %f, drop %f", this->beta, this->drop); - // this->myConsumer->setSocketOption(RaaqmTransportOptions::BETA_VALUE, this->beta); - // this->myConsumer->setSocketOption(RaaqmTransportOptions::DROP_FACTOR, this->drop); + qDebug("beta %f, drop %f", this->beta, this->drop); + + c.setSocketOption(libl4::transport::RaaqmTransportOptions::BETA_VALUE, this->beta); + c.setSocketOption(libl4::transport::RaaqmTransportOptions::DROP_FACTOR, this->drop); } - //this->myConsumer->setSocketOption(RateEstimationOptions::RATE_ESTIMATION_OBSERVER, this); - //this->myConsumer->setSocketOption(ConsumerCallbacksOptions::CONTENT_RETRIEVED, (ConsumerContentCallback) bind(&ICNConnectionConsumerApi::processPayload, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3)); - //this->myConsumer->setSocketOption(ConsumerCallbacksOptions::CONTENT_OBJECT_TO_VERIFY, (ConsumerContentObjectVerificationCallback)bind(&ICNConnectionConsumerApi::onPacket, this, std::placeholders::_1, std::placeholders::_2)); + c.setSocketOption(int(libl4::transport::RateEstimationOptions::RATE_ESTIMATION_OBSERVER), (libl4::transport::IcnObserver * )this); #ifdef NO_GUI if(this->icnAlpha != 20) this->icnRateBased = true; diff --git a/Input/ICNConnectionConsumerApi.h b/Input/ICNConnectionConsumerApi.h index 0ee5cba7..240ebcaa 100644 --- a/Input/ICNConnectionConsumerApi.h +++ b/Input/ICNConnectionConsumerApi.h @@ -56,7 +56,7 @@ namespace libdash { namespace framework { namespace input { -class ICNConnectionConsumerApi : public IICNConnection { +class ICNConnectionConsumerApi : public IICNConnection, public libl4::transport::IcnObserver{ public: ICNConnectionConsumerApi(double alpha, float beta, float drop); virtual ~ICNConnectionConsumerApi(); diff --git a/Input/MediaObject.cpp b/Input/MediaObject.cpp index f479a886..b2dde357 100644 --- a/Input/MediaObject.cpp +++ b/Input/MediaObject.cpp @@ -28,7 +28,7 @@ MediaObject::MediaObject(ISegment *segment, IRepresentation *rep, bool withFeedB InitializeCriticalSection (&this->stateLock); this->representationBandwidth = rep->GetBandwidth(); this->representationHeight = rep->GetHeight(); - this->representationId = std::stoi(rep->GetId()); + this->representationId = atoi(rep->GetId().c_str()); } MediaObject::~MediaObject() diff --git a/MPD/MPDWrapper.cpp b/MPD/MPDWrapper.cpp index 163ed19d..2f66834e 100644 --- a/MPD/MPDWrapper.cpp +++ b/MPD/MPDWrapper.cpp @@ -125,10 +125,10 @@ void MPDWrapper::findVideoRepresentation (IMPD* mpd) if(this->videoRepresentation) { uint32_t time = this->videoRepresentations->find(this->videoRepresentation)->second->getTime(this->videoSegmentNumber); - uint32_t id = std::stoi(this->videoRepresentation->GetId()); + uint32_t id = atoi(this->videoRepresentation->GetId().c_str()); for(size_t i = 0; i < representations.size(); i++) { - if(id == std::stoi(representations.at(i)->GetId())) + if(id == atoi(representations.at(i)->GetId().c_str())) { this->videoRepresentation = representations.at(i); this->destroyAdaptationSetStream(viper::managers::StreamType::VIDEO); @@ -157,10 +157,10 @@ void MPDWrapper::findAudioRepresentation (IMPD* mpd) if(this->audioRepresentation) { uint32_t time = this->audioRepresentations->find(this->audioRepresentation)->second->getTime(this->audioSegmentNumber); - uint32_t id = std::stoi(this->audioRepresentation->GetId()); + uint32_t id = atoi(this->audioRepresentation->GetId().c_str()); for(size_t i = 0; i < representations.size(); i++) { - if(id == std::stoi(representations.at(i)->GetId())) + if(id == atoi(representations.at(i)->GetId().c_str())) { this->audioRepresentation = representations.at(i); this->destroyAdaptationSetStream(viper::managers::StreamType::AUDIO); -- cgit 1.2.3-korg