From b5fc2106912f0ed3168972caee33b45ee6bb4b53 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Fri, 22 Mar 2019 11:04:20 +0100 Subject: [HICN-8] Update viper video player to use hicn sockets over HTTP Change-Id: I0aa727e513e3ffcf3286cecc7e7c43237da5155f Signed-off-by: Angelo Mantellini --- Input/ICNConnectionConsumerApi.cpp | 25 ++++++++++++++++++++----- Input/ICNConnectionConsumerApi.h | 11 ++++++++--- 2 files changed, 28 insertions(+), 8 deletions(-) (limited to 'Input') diff --git a/Input/ICNConnectionConsumerApi.cpp b/Input/ICNConnectionConsumerApi.cpp index 15475d5f..f983a054 100644 --- a/Input/ICNConnectionConsumerApi.cpp +++ b/Input/ICNConnectionConsumerApi.cpp @@ -55,8 +55,12 @@ ICNConnectionConsumerApi::ICNConnectionConsumerApi(double alpha, float beta, flo this->res = false; InitializeConditionVariable (&this->contentRetrieved); InitializeCriticalSection (&this->monitorMutex); - this->hTTPClientConnection = new libl4::http::HTTPClientConnection(); - libl4::transport::ConsumerSocket &c = this->hTTPClientConnection->getConsumer(); + this->hTTPClientConnection = new libl4::http::HTTPClientConnection(); +#ifdef HICNET + transport::interface::ConsumerSocket &c = this->hTTPClientConnection->getConsumer(); +#else + libl4::transport::ConsumerSocket &c = this->hTTPClientConnection->getConsumer(); +#endif 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")) @@ -64,14 +68,25 @@ ICNConnectionConsumerApi::ICNConnectionConsumerApi(double alpha, float beta, flo fclose(fp); configFile = true; } +#ifdef HICNET if(!configFile) { 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); + c.setSocketOption(transport::interface::RaaqmTransportOptions::BETA_VALUE, this->beta); + c.setSocketOption(transport::interface::RaaqmTransportOptions::DROP_FACTOR, this->drop); } - c.setSocketOption(int(libl4::transport::RateEstimationOptions::RATE_ESTIMATION_OBSERVER), (libl4::transport::IcnObserver * )this); + c.setSocketOption(int(transport::interface::RateEstimationOptions::RATE_ESTIMATION_OBSERVER), (transport::protocol::IcnObserver * )this); +#else + if(!configFile) + { + 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); + } + c.setSocketOption(int(libl4::transport::RateEstimationOptions::RATE_ESTIMATION_OBSERVER), (libl4::transport::IcnObserver * )this); +#endif #ifdef NO_GUI if(this->icnAlpha != 20) this->icnRateBased = true; diff --git a/Input/ICNConnectionConsumerApi.h b/Input/ICNConnectionConsumerApi.h index 9a5f8a47..c05c5244 100644 --- a/Input/ICNConnectionConsumerApi.h +++ b/Input/ICNConnectionConsumerApi.h @@ -17,7 +17,8 @@ #define QTPLAYER_INPUT_ICNCONNECTIONCONSUMERAPI_H_ #if defined(HICNET) -#include +#include +#include #else #include #endif @@ -45,7 +46,6 @@ #include #include "../Portable/MultiThreading.h" -#include //logging purpose #include @@ -56,7 +56,13 @@ namespace libdash { namespace framework { namespace input { +#if defined(HICNET) +class ICNConnectionConsumerApi : public IICNConnection, public transport::protocol::IcnObserver{ +#else class ICNConnectionConsumerApi : public IICNConnection, public libl4::transport::IcnObserver{ +#endif + + public: ICNConnectionConsumerApi(double alpha, float beta, float drop); virtual ~ICNConnectionConsumerApi(); @@ -81,7 +87,6 @@ public: virtual void SetBeta(float beta); virtual void SetDrop(float drop); - //libl4::transport::IcnObserver virtual void notifyStats(double throughput); virtual void notifyDownloadTime(double downloadingTime); -- cgit 1.2.3-korg