vlc | branch: master | Francois Cartegnie <[email protected]> | Fri Jun 5 19:15:07 2015 +0200| [5f8fc0c95d5f138b5b11afcb44cddfc68133f756] | committer: Francois Cartegnie
demux: adaptative: have chunks ref segments > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5f8fc0c95d5f138b5b11afcb44cddfc68133f756 --- modules/demux/adaptative/playlist/Segment.cpp | 14 ++++++++++++++ modules/demux/adaptative/playlist/Segment.h | 4 +++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/modules/demux/adaptative/playlist/Segment.cpp b/modules/demux/adaptative/playlist/Segment.cpp index 3ac04f0..b47aacb 100644 --- a/modules/demux/adaptative/playlist/Segment.cpp +++ b/modules/demux/adaptative/playlist/Segment.cpp @@ -29,6 +29,7 @@ #include "Segment.h" #include "BaseRepresentation.h" +#include <cassert> using namespace adaptative::http; using namespace adaptative::playlist; @@ -42,6 +43,12 @@ ISegment::ISegment(const ICanonicalUrl *parent): classId = CLASSID_ISEGMENT; startTime.Set(VLC_TS_INVALID); duration.Set(0); + chunksuse.Set(0); +} + +ISegment::~ISegment() +{ + assert(chunksuse.Get() == 0); } Chunk * ISegment::getChunk(const std::string &url) @@ -114,6 +121,13 @@ ISegment::SegmentChunk::SegmentChunk(ISegment *segment_, const std::string &url) Chunk(url) { segment = segment_; + segment->chunksuse.Set(segment->chunksuse.Get() + 1); +} + +ISegment::SegmentChunk::~SegmentChunk() +{ + assert(segment->chunksuse.Get() > 0); + segment->chunksuse.Set(segment->chunksuse.Get() - 1); } void ISegment::SegmentChunk::setRepresentation(BaseRepresentation *rep_) diff --git a/modules/demux/adaptative/playlist/Segment.h b/modules/demux/adaptative/playlist/Segment.h index 9a672be..44b4970 100644 --- a/modules/demux/adaptative/playlist/Segment.h +++ b/modules/demux/adaptative/playlist/Segment.h @@ -45,7 +45,7 @@ namespace adaptative { public: ISegment(const ICanonicalUrl *parent); - virtual ~ISegment(){} + virtual ~ISegment(); /** * @return true if the segment should be dropped after being read. * That is basically true when using an Url, and false @@ -61,6 +61,7 @@ namespace adaptative int getClassId () const; Property<mtime_t> startTime; Property<mtime_t> duration; + Property<unsigned> chunksuse; static const int CLASSID_ISEGMENT = 0; @@ -74,6 +75,7 @@ namespace adaptative { public: SegmentChunk(ISegment *segment, const std::string &url); + virtual ~SegmentChunk(); void setRepresentation(BaseRepresentation *); virtual void onDownload(block_t **); // reimpl _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
