vlc | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Tue Jan 13 15:10:03 2015 +0100| [e5de71d0643498aa82aba38ddfc4d3cc295ef20f] | committer: Francois Cartegnie
demux: dash: prune expired live timeline elements > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5de71d0643498aa82aba38ddfc4d3cc295ef20f --- modules/demux/dash/DASHManager.cpp | 12 +++++++++++- modules/demux/dash/SegmentTracker.cpp | 8 ++++++++ modules/demux/dash/SegmentTracker.hpp | 1 + modules/demux/dash/Streams.cpp | 5 +++++ modules/demux/dash/Streams.hpp | 1 + modules/demux/dash/mpd/MPD.cpp | 6 +++++- modules/demux/dash/mpd/MPD.h | 2 +- 7 files changed, 32 insertions(+), 3 deletions(-) diff --git a/modules/demux/dash/DASHManager.cpp b/modules/demux/dash/DASHManager.cpp index 5652c8a..b6dca19 100644 --- a/modules/demux/dash/DASHManager.cpp +++ b/modules/demux/dash/DASHManager.cpp @@ -223,10 +223,20 @@ bool DASHManager::updateMPD() return false; } + mtime_t minsegmentTime = 0; + for(int type=0; type<Streams::count; type++) + { + if(!streams[type]) + continue; + mtime_t segmentTime = streams[type]->getPosition(); + if(!minsegmentTime || segmentTime < minsegmentTime) + minsegmentTime = segmentTime; + } + MPD *newmpd = MPDFactory::create(parser.getRootNode(), mpdstream, parser.getProfile()); if(newmpd) { - mpd->mergeWith(newmpd); + mpd->mergeWith(newmpd, minsegmentTime); delete newmpd; } stream_Delete(mpdstream); diff --git a/modules/demux/dash/SegmentTracker.cpp b/modules/demux/dash/SegmentTracker.cpp index 8559dc4..4284647 100644 --- a/modules/demux/dash/SegmentTracker.cpp +++ b/modules/demux/dash/SegmentTracker.cpp @@ -108,3 +108,11 @@ bool SegmentTracker::setPosition(mtime_t time, bool tryonly) } return false; } + +mtime_t SegmentTracker::getSegmentStart() const +{ + if(prevRepresentation) + return prevRepresentation->getPlaybackTimeBySegmentNumber(count); + else + return 0; +} diff --git a/modules/demux/dash/SegmentTracker.hpp b/modules/demux/dash/SegmentTracker.hpp index d76d525..22a35eb 100644 --- a/modules/demux/dash/SegmentTracker.hpp +++ b/modules/demux/dash/SegmentTracker.hpp @@ -57,6 +57,7 @@ namespace dash void resetCounter(); http::Chunk* getNextChunk(Streams::Type); bool setPosition(mtime_t, bool); + mtime_t getSegmentStart() const; private: bool initializing; diff --git a/modules/demux/dash/Streams.cpp b/modules/demux/dash/Streams.cpp index 9e2ac47..b85c8e3 100644 --- a/modules/demux/dash/Streams.cpp +++ b/modules/demux/dash/Streams.cpp @@ -223,6 +223,11 @@ bool Stream::setPosition(mtime_t time, bool tryonly) return ret; } +mtime_t Stream::getPosition() const +{ + return segmentTracker->getSegmentStart(); +} + AbstractStreamOutput::AbstractStreamOutput(demux_t *demux) { realdemux = demux; diff --git a/modules/demux/dash/Streams.hpp b/modules/demux/dash/Streams.hpp index 10404f4..e0d3fcc 100644 --- a/modules/demux/dash/Streams.hpp +++ b/modules/demux/dash/Streams.hpp @@ -56,6 +56,7 @@ namespace dash bool seekAble() const; size_t read(http::HTTPConnectionManager *); bool setPosition(mtime_t, bool); + mtime_t getPosition() const; private: http::Chunk *getChunk(); diff --git a/modules/demux/dash/mpd/MPD.cpp b/modules/demux/dash/mpd/MPD.cpp index f55556f..79499ed 100644 --- a/modules/demux/dash/mpd/MPD.cpp +++ b/modules/demux/dash/mpd/MPD.cpp @@ -154,7 +154,7 @@ void MPD::getTimeLinesBoundaries(mtime_t *min, mtime_t *max) const } } -void MPD::mergeWith(MPD *updatedMPD) +void MPD::mergeWith(MPD *updatedMPD, mtime_t prunebarrier) { availabilityEndTime.Set(updatedMPD->availabilityEndTime.Get()); /* Only merge timelines for now */ @@ -166,6 +166,10 @@ void MPD::mergeWith(MPD *updatedMPD) updatedMPD->periods.at(i)->collectTimelines(&timelinesUpdate); for(size_t j = 0; j < timelines.size() && j < timelinesUpdate.size(); j++) + { timelines.at(j)->mergeWith(*timelinesUpdate.at(j)); + if(prunebarrier) + timelines.at(j)->prune(prunebarrier); + } } } diff --git a/modules/demux/dash/mpd/MPD.h b/modules/demux/dash/mpd/MPD.h index d3908e1..f6cf5fe 100644 --- a/modules/demux/dash/mpd/MPD.h +++ b/modules/demux/dash/mpd/MPD.h @@ -60,7 +60,7 @@ namespace dash virtual Period* getFirstPeriod(); virtual Period* getNextPeriod(Period *period); - void mergeWith(MPD *); + void mergeWith(MPD *, mtime_t = 0); void getTimeLinesBoundaries(mtime_t *, mtime_t *) const; Property<time_t> duration; _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits