vlc | branch: master | Francois Cartegnie <fcvlc...@free.fr> | Wed Sep 21 16:46:43 2016 +0200| [d0f23a4441207559058baaf893d1043f89d82485] | committer: Francois Cartegnie
demux: adaptive: add segment change duration event > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d0f23a4441207559058baaf893d1043f89d82485 --- modules/demux/adaptive/SegmentTracker.cpp | 15 +++++++++++++++ modules/demux/adaptive/SegmentTracker.hpp | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/modules/demux/adaptive/SegmentTracker.cpp b/modules/demux/adaptive/SegmentTracker.cpp index 3146827..168acd9 100644 --- a/modules/demux/adaptive/SegmentTracker.cpp +++ b/modules/demux/adaptive/SegmentTracker.cpp @@ -68,6 +68,13 @@ SegmentTrackerEvent::SegmentTrackerEvent(const ID &id, mtime_t current, mtime_t u.buffering.id = &id; } +SegmentTrackerEvent::SegmentTrackerEvent(const ID &id, mtime_t duration) +{ + type = SEGMENT_CHANGE; + u.segment.duration = duration; + u.segment.id = &id; +} + SegmentTracker::SegmentTracker(AbstractAdaptationLogic *logic_, BaseAdaptationSet *adaptSet) { first = true; @@ -241,6 +248,14 @@ SegmentChunk * SegmentTracker::getNextChunk(bool switch_allowed, SegmentChunk *chunk = segment->toChunk(next, rep, connManager); + /* Notify new segment length for stats / logic */ + if(chunk) + { + const Timescale timescale = rep->inheritTimescale(); + notify(SegmentTrackerEvent(rep->getAdaptationSet()->getID(), + timescale.ToTime(segment->duration.Get()))); + } + /* We need to check segment/chunk format changes, as we can't rely on representation's (HLS)*/ if(chunk && format != chunk->getStreamFormat()) { diff --git a/modules/demux/adaptive/SegmentTracker.hpp b/modules/demux/adaptive/SegmentTracker.hpp index fa8e360..e5b6f5a 100644 --- a/modules/demux/adaptive/SegmentTracker.hpp +++ b/modules/demux/adaptive/SegmentTracker.hpp @@ -58,6 +58,7 @@ namespace adaptive SegmentTrackerEvent(const StreamFormat *); SegmentTrackerEvent(const ID &, bool); SegmentTrackerEvent(const ID &, mtime_t, mtime_t); + SegmentTrackerEvent(const ID &, mtime_t); enum { DISCONTINUITY, @@ -65,6 +66,7 @@ namespace adaptive FORMATCHANGE, BUFFERING_STATE, BUFFERING_LEVEL_CHANGE, + SEGMENT_CHANGE, } type; union { @@ -92,6 +94,11 @@ namespace adaptive mtime_t current; mtime_t target; } buffering_level; + struct + { + const ID *id; + mtime_t duration; + } segment; } u; }; _______________________________________________ vlc-commits mailing list vlc-commits@videolan.org https://mailman.videolan.org/listinfo/vlc-commits