aboutsummaryrefslogtreecommitdiffstats
path: root/Input
diff options
context:
space:
mode:
authorJacques Samain <jsamain+fdio@cisco.com>2017-07-25 15:32:54 +0200
committerJacques Samain <jsamain+fdio@cisco.com>2017-07-25 15:32:54 +0200
commit0e275345e28c34f2c6b91a75f44ac93034ae477c (patch)
tree0b94ec17f395fce7ae1015200d45bd61ce0112a8 /Input
parentce4d018aa8185da0bbf5445eaf54d88700f1a381 (diff)
Handling live MPDs with variable segments duration
Change-Id: I074d8863a9afb47815e47bf663b87e7f663890b9 Signed-off-by: Jacques Samain <jsamain+fdio@cisco.com>
Diffstat (limited to 'Input')
-rw-r--r--Input/DASHReceiver.cpp9
-rw-r--r--Input/DASHReceiver.h6
-rw-r--r--Input/MediaObject.cpp16
-rw-r--r--Input/MediaObject.h15
4 files changed, 29 insertions, 17 deletions
diff --git a/Input/DASHReceiver.cpp b/Input/DASHReceiver.cpp
index 59514e57..74415bfa 100644
--- a/Input/DASHReceiver.cpp
+++ b/Input/DASHReceiver.cpp
@@ -141,7 +141,7 @@ MediaObject* DASHReceiver::GetInitSegmentWithoutLock ()
return this->mpdWrapper->getInitSegmentWithoutLock(type);
}
-MediaObject* DASHReceiver::FindInitSegment (int representation)
+MediaObject* DASHReceiver::FindInitSegment (std::string representation)
{
if (!this->InitSegmentExists(representation))
return NULL;
@@ -192,7 +192,7 @@ void DASHReceiver::NotifySegmentDownloaded ()
void DASHReceiver::DownloadInitSegmentWithoutLock ()
{
- int rep = atoi(this->mpdWrapper->getRepresentationIDWithoutLock(type).c_str());
+ std::string rep = this->mpdWrapper->getRepresentationIDWithoutLock(type);
if (this->InitSegmentExists(rep))
return;
@@ -209,7 +209,7 @@ void DASHReceiver::DownloadInitSegmentWithoutLock ()
void DASHReceiver::DownloadInitSegment ()
{
- int rep = atoi(this->mpdWrapper->getRepresentationID(type).c_str());
+ std::string rep = this->mpdWrapper->getRepresentationID(type);
if (this->InitSegmentExists(rep))
return;
@@ -224,7 +224,7 @@ void DASHReceiver::DownloadInitSegment ()
}
}
-bool DASHReceiver::InitSegmentExists (int rep)
+bool DASHReceiver::InitSegmentExists (std::string rep)
{
if (this->initSegments.find(rep) != this->initSegments.end())
return true;
@@ -310,7 +310,6 @@ void* DASHReceiver::DoBuffering (void *recei
}
m_start_time = std::chrono::system_clock::now();
media->StartDownload(dashReceiver->conn);
-
media->WaitFinished();
bool canPush = dashReceiver->CanPush();
if (canPush && !dashReceiver->PushBack(media))
diff --git a/Input/DASHReceiver.h b/Input/DASHReceiver.h
index ee2df388..a6db0382 100644
--- a/Input/DASHReceiver.h
+++ b/Input/DASHReceiver.h
@@ -57,7 +57,7 @@ public:
input::MediaObject* GetSegment(uint32_t segmentNumber);
input::MediaObject* GetInitSegment();
input::MediaObject* GetInitSegmentWithoutLock();
- input::MediaObject* FindInitSegment(int representation);
+ input::MediaObject* FindInitSegment(std::string representation);
uint32_t GetPosition();
void SetPosition(uint32_t segmentNumber);
void SetLooping(bool isLoopinp);
@@ -86,7 +86,7 @@ private:
float drop;
bool withFeedBack;
bool isBufferBased;
- std::map<int, MediaObject*> initSegments;
+ std::map<std::string, MediaObject*> initSegments;
libdash::framework::buffer::Buffer<MediaObject> *buffer;
IDASHReceiverObserver *observer;
libdash::framework::mpd::MPDWrapper *mpdWrapper;
@@ -120,7 +120,7 @@ private:
void NotifySegmentDownloaded();
void DownloadInitSegment();
void DownloadInitSegmentWithoutLock();
- bool InitSegmentExists(int rep);
+ bool InitSegmentExists(std::string rep);
static void* DoBuffering(void *receiver);
};
}
diff --git a/Input/MediaObject.cpp b/Input/MediaObject.cpp
index b2dde357..2f4e0044 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 = atoi(rep->GetId().c_str());
+ this->representationId = rep->GetId();
}
MediaObject::~MediaObject()
@@ -57,12 +57,22 @@ uint32_t MediaObject::GetRepresentationHeight()
return this->representationHeight;
}
-int MediaObject::GetRepresentationID()
+std::string MediaObject::GetRepresentationID()
{
return this->representationId;
}
-void MediaObject::SetFeedBack(bool flag)
+uint64_t MediaObject::GetSegmentDuration()
+{
+ return this->segmentDuration;
+}
+
+void MediaObject::SetSegmentDuration(uint64_t segDuration)
+{
+ this->segmentDuration = segDuration;
+}
+
+void MediaObject::SetFeedBack(bool flag)
{
this->withFeedBack = flag;
}
diff --git a/Input/MediaObject.h b/Input/MediaObject.h
index 1edd69af..24c2995b 100644
--- a/Input/MediaObject.h
+++ b/Input/MediaObject.h
@@ -59,23 +59,26 @@ public:
void SetDASHReceiver(input::DASHReceiver *_dashReceiver);
uint32_t GetRepresentationBandwidth();
uint32_t GetRepresentationHeight();
- int GetRepresentationID();
+ std::string GetRepresentationID();
+ uint64_t GetSegmentDuration();
+ void SetSegmentDuration(uint64_t segmentDuration);
private:
dash::mpd::ISegment *segment;
MediaObject *initSeg;
dash::mpd::IRepresentation *rep;
dash::network::DownloadState state;
- uint64_t bps;
- bool withFeedBack;
+ uint64_t bps;
+ bool withFeedBack;
double dnltime;
input::DASHReceiver *dashReceiver;
adaptation::IAdaptationLogic *adaptationLogic;
mutable CRITICAL_SECTION stateLock;
mutable CONDITION_VARIABLE stateChanged;
- uint32_t representationBandwidth;
- uint32_t representationHeight;
- int representationId;
+ uint32_t representationBandwidth;
+ uint32_t representationHeight;
+ std::string representationId;
+ uint64_t segmentDuration;
};
}
}