diff options
author | Jacques Samain <jsamain+fdio@cisco.com> | 2017-09-07 11:11:05 +0200 |
---|---|---|
committer | Jacques Samain <jsamain+fdio@cisco.com> | 2017-09-07 11:11:05 +0200 |
commit | 98a684367149583c1b1eb4d4f35eef123972ccf9 (patch) | |
tree | c940dd3e9584cda1495d62a3b575e98b92461fd2 | |
parent | c458d21e09d5af3bd9872b1f89237da7fb978842 (diff) |
Resolving live issue: when the client reaches the end of the MPD
Change-Id: I36f1f2373b1030dfb669637d8dae9bf5aa0e08f4
Signed-off-by: Jacques Samain <jsamain+fdio@cisco.com>
-rw-r--r-- | MPD/MPDWrapper.cpp | 27 | ||||
-rw-r--r-- | MPD/SegmentTemplateStream.cpp | 2 |
2 files changed, 20 insertions, 9 deletions
diff --git a/MPD/MPDWrapper.cpp b/MPD/MPDWrapper.cpp index 3b269a72..f0bce82b 100644 --- a/MPD/MPDWrapper.cpp +++ b/MPD/MPDWrapper.cpp @@ -102,7 +102,7 @@ void MPDWrapper::findAudioAdaptationSet (IMPD* mpd) return; } } - //Not found in the new set of adaptation logc => select the first one + //Not found in the new set of adaptation logc => select the first one this->audioAdaptationSet = adaptationSets.at(0); } @@ -125,6 +125,7 @@ void MPDWrapper::findVideoRepresentation (IMPD* mpd) if(this->videoRepresentation) { uint32_t time = this->videoRepresentations->find(this->videoRepresentation)->second->getTime(this->videoSegmentNumber); + uint32_t id = atoi(this->videoRepresentation->GetId().c_str()); for(size_t i = 0; i < representations.size(); i++) { @@ -617,8 +618,23 @@ MediaObject* MPDWrapper::getNextSegment (viper::managers::StreamType type, bool else { while((this->isStopping == false) && segmentNumber >= representationStream->getSize()) + { SleepConditionVariableCS(&this->mpdUpdate, &this->monitorMutex, INFINITE); - + switch(type) + { + case viper::managers::StreamType::AUDIO: + representation = this->audioRepresentation; + representations = this->audioRepresentations; + break; + case viper::managers::StreamType::VIDEO: + representation = this->videoRepresentation; + representations = this->videoRepresentations; + break; + default: + break; + } + representationStream = representations->find(representation)->second; + } if(this->isStopping) { LeaveCriticalSection(&this->monitorMutex); @@ -629,19 +645,14 @@ MediaObject* MPDWrapper::getNextSegment (viper::managers::StreamType type, bool 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; } - representationStream = representations->find(representation)->second; } uint64_t segDuration = 0; //Returns the segmentDuration in milliseconds @@ -674,7 +685,7 @@ MediaObject* MPDWrapper::getSegment (viper::managers::StreamType type, uint32_t IRepresentation* representation; std::map<dash::mpd::IRepresentation *, IRepresentationStream *> *representations; EnterCriticalSection(&this->monitorMutex); - + switch(type) { case viper::managers::StreamType::AUDIO: diff --git a/MPD/SegmentTemplateStream.cpp b/MPD/SegmentTemplateStream.cpp index 50801896..e7be1d54 100644 --- a/MPD/SegmentTemplateStream.cpp +++ b/MPD/SegmentTemplateStream.cpp @@ -235,7 +235,7 @@ size_t SegmentTemplateStream::getSegmentNumber(uint64_t time) size_t i; for(i = 0; i < this->segmentStartTimes.size(); i ++) { - if(time < this->segmentStartTimes.at(i)) + if(time <= this->segmentStartTimes.at(i)) { break; } |