author | Karl Tomlinson <karlt+@karlt.net> |
Tue, 04 Aug 2015 10:42:31 +1200 | |
changeset 257986 | a4b1ad86a79b17dc18f6b2afa28c06ead84c58e5 |
parent 257985 | 82f1fab387233061a6137c7a104863faa9c294e9 |
child 257987 | e4cadc8dc05885a798be43019e0d9c75b4da572a |
push id | 29238 |
push user | ryanvm@gmail.com |
push date | Mon, 17 Aug 2015 13:06:57 +0000 |
treeherder | mozilla-central@a6eeb28458fd [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | roc |
bugs | 962719 |
milestone | 43.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/media/MediaSegment.h +++ b/dom/media/MediaSegment.h @@ -279,16 +279,36 @@ public: void Next() { ++mIndex; } const Chunk& operator*() { return mSegment.mChunks[mIndex]; } const Chunk* operator->() { return &mSegment.mChunks[mIndex]; } private: const MediaSegmentBase<C, Chunk>& mSegment; uint32_t mIndex; }; + Chunk* FindChunkContaining(StreamTime aOffset, StreamTime* aStart = nullptr) + { + if (aOffset < 0) { + return nullptr; + } + StreamTime offset = 0; + for (uint32_t i = 0; i < mChunks.Length(); ++i) { + Chunk& c = mChunks[i]; + StreamTime nextOffset = offset + c.GetDuration(); + if (aOffset < nextOffset) { + if (aStart) { + *aStart = offset; + } + return &c; + } + offset = nextOffset; + } + return nullptr; + } + void RemoveLeading(StreamTime aDuration) { RemoveLeading(aDuration, 0); } #ifdef MOZILLA_INTERNAL_API void GetStartTime(TimeStamp &aTime) { aTime = mChunks[0].mTimeStamp; @@ -351,36 +371,16 @@ protected: { MOZ_ASSERT(aDuration >= 0); Chunk* c = mChunks.AppendElement(); c->mDuration = aDuration; mDuration += aDuration; return c; } - Chunk* FindChunkContaining(StreamTime aOffset, StreamTime* aStart = nullptr) - { - if (aOffset < 0) { - return nullptr; - } - StreamTime offset = 0; - for (uint32_t i = 0; i < mChunks.Length(); ++i) { - Chunk& c = mChunks[i]; - StreamTime nextOffset = offset + c.GetDuration(); - if (aOffset < nextOffset) { - if (aStart) { - *aStart = offset; - } - return &c; - } - offset = nextOffset; - } - return nullptr; - } - Chunk* GetLastChunk() { if (mChunks.IsEmpty()) { return nullptr; } return &mChunks[mChunks.Length() - 1]; }