From f8907f0a7a84928800adbbfd8e66e500794aa5d5 Mon Sep 17 00:00:00 2001 From: jacko Date: Thu, 8 Jun 2017 19:54:24 +0200 Subject: Adding handling for different kind of MPDs (previously the front end could only handle MPD with SegmentList) Now can handle: MPD with SegmentTemplate in Representation (VOD) MPD with SegmentTemplate and SegmentTimeline (live) Change-Id: Ie32e0e1823c94b1412990192595b16d3e2df1cfd Plus: removed some printf Signed-off-by: jacko --- Input/DASHReceiver.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'Input/DASHReceiver.cpp') diff --git a/Input/DASHReceiver.cpp b/Input/DASHReceiver.cpp index df9d019b..bbfe3e35 100644 --- a/Input/DASHReceiver.cpp +++ b/Input/DASHReceiver.cpp @@ -55,6 +55,7 @@ DASHReceiver::DASHReceiver (IMPD *mpd, IDASHReceiverObserver *obs, Buff this->adaptationSetStream = new AdaptationSetStream(mpd, period, adaptationSet); this->representationStream = adaptationSetStream->getRepresentationStream(this->representation); this->segmentOffset = CalculateSegmentOffset(); + this->representationStream->setSegmentOffset(this->segmentOffset); this->conn = NULL; this->initConn = NULL; @@ -131,20 +132,23 @@ MediaObject* DASHReceiver::GetNextSegment () while(this->isPaused) SleepConditionVariableCS(&this->paused, &this->monitorPausedMutex, INFINITE); - if(this->segmentNumber >= this->representationStream->getSize()) + if(!strcmp(this->mpd->GetType().c_str(), "static")) { - qDebug("looping? : %s\n", this->isLooping ? "YES" : "NO"); - if(this->isLooping) + if(this->segmentNumber >= this->representationStream->getSize()) { - this->segmentNumber = 0; - } - else - { - LeaveCriticalSection(&this->monitorPausedMutex); - return NULL; + qDebug("looping? : %s\n", this->isLooping ? "YES" : "NO"); + if(this->isLooping) + { + this->segmentNumber = 0; + } + else + { + LeaveCriticalSection(&this->monitorPausedMutex); + return NULL; + } } } - seg = this->representationStream->getMediaSegment(this->segmentNumber + this->segmentOffset); + seg = this->representationStream->getMediaSegment(this->segmentNumber); if (seg != NULL) { @@ -167,7 +171,7 @@ MediaObject* DASHReceiver::GetSegment (uint32_t segNum) if(segNum >= this->representationStream->getSize()) return NULL; - seg = this->representationStream->getMediaSegment(segNum + segmentOffset); + seg = this->representationStream->getMediaSegment(segNum); if (seg != NULL) { -- cgit 1.2.3-korg