diff options
author | 2017-07-21 15:55:25 +0200 | |
---|---|---|
committer | 2017-07-21 15:55:25 +0200 | |
commit | 04424399a22c592a95b19dad95a958cb1566a8e2 (patch) | |
tree | faed3118b6f30867c87f96cc7a57b83b7b667672 /MPD | |
parent | 0ffb40536f5b9565e34960e8500418a195885a06 (diff) |
Resolving infinite loop issue on live MPD handling
Change-Id: I7d667a0d5360a20a95fa5c4072dd15ededc33400
Signed-off-by: Jacques Samain <jsamain+fdio@cisco.com>
Diffstat (limited to 'MPD')
-rw-r--r-- | MPD/MPDWrapper.cpp | 18 | ||||
-rw-r--r-- | MPD/SegmentTemplateStream.cpp | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/MPD/MPDWrapper.cpp b/MPD/MPDWrapper.cpp index 2f66834e..20d4aa5e 100644 --- a/MPD/MPDWrapper.cpp +++ b/MPD/MPDWrapper.cpp @@ -46,9 +46,9 @@ IMPD* MPDWrapper::getMPD () } void MPDWrapper::updateMPD (IMPD* mpd) -{ -//Assumptions here: -// *only one period in the MPD +{ +//Assumptions here: +// *only one period in the MPD // *only triggered if using SegmentTimeline dynamic MPD EnterCriticalSection(&this->monitorMutex); this->period = mpd->GetPeriods().at(0); @@ -75,8 +75,8 @@ void MPDWrapper::findVideoAdaptationSet (IMPD* mpd) return; } } - //Not found in the new set of adaptation logc => select the first one - this->videoAdaptationSet = adaptationSets.at(0); + //Not found in the new set of adaptation logc => select the first one + this->videoAdaptationSet = adaptationSets.at(0); } else { @@ -568,7 +568,7 @@ MediaObject* MPDWrapper::getNextSegment (viper::managers::StreamType type, bool { IRepresentation* representation; std::map<dash::mpd::IRepresentation *, IRepresentationStream *> *representations; - + EnterCriticalSection(&this->monitorMutex); switch(type) { @@ -625,17 +625,19 @@ MediaObject* MPDWrapper::getNextSegment (viper::managers::StreamType type, bool LeaveCriticalSection(&this->monitorMutex); return NULL; } - + //Need to update representationStream here as it was updated with the mpd: switch(type) { case viper::managers::StreamType::AUDIO: representation = this->audioRepresentation; representations = this->audioRepresentations; + segmentNumber = this->audioSegmentNumber; break; case viper::managers::StreamType::VIDEO: representation = this->videoRepresentation; representations = this->videoRepresentations; + segmentNumber = this->videoSegmentNumber; break; default: break; @@ -646,7 +648,7 @@ MediaObject* MPDWrapper::getNextSegment (viper::managers::StreamType type, bool seg = representationStream->getMediaSegment(segmentNumber); if(seg != NULL) { - MediaObject *media = new MediaObject(seg, representation, withFeedBack); + MediaObject *media = new MediaObject(seg, representation, withFeedBack); segmentNumber++; switch(type) { diff --git a/MPD/SegmentTemplateStream.cpp b/MPD/SegmentTemplateStream.cpp index 409d8e59..ee51cf07 100644 --- a/MPD/SegmentTemplateStream.cpp +++ b/MPD/SegmentTemplateStream.cpp @@ -219,7 +219,7 @@ uint64_t SegmentTemplateStream::getTime(size_t segmentNumber) if(segmentNumber < this->segmentStartTimes.size()) return this->segmentStartTimes.at(segmentNumber); else - return 0; + return this->segmentStartTimes.at(this->segmentStartTimes.size()-1); } size_t SegmentTemplateStream::getSegmentNumber(uint64_t time) |