Bug 1296531 - Add MediaSegment::IsNull. r=jesup

This allows us to see if all chunks in a MediaSegment are null.
When this is true for the MediaSegment passed to NotifyQueuedChanges, we can
assume that the track's input is blocked for the given time.

MozReview-Commit-ID: zf7V7aiohg

--HG--
extra : rebase_source : 5dd8442f85e6011fc0015460c6a7fedf04fb956e
This commit is contained in:
Andreas Pehrson 2017-05-16 13:06:02 +02:00
Родитель 5e6a6af6f3
Коммит eac8b1842e
2 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -408,16 +408,6 @@ public:
return 0;
}
bool IsNull() const {
for (ChunkIterator ci(*const_cast<AudioSegment*>(this)); !ci.IsEnded();
ci.Next()) {
if (!ci->IsNull()) {
return false;
}
}
return true;
}
static Type StaticType() { return AUDIO; }
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const override

Просмотреть файл

@ -148,6 +148,11 @@ public:
mLastPrincipalHandle = aLastPrincipalHandle;
}
/**
* Returns true if all chunks in this segment are null.
*/
virtual bool IsNull() const = 0;
/**
* Create a MediaSegment of the same type.
*/
@ -229,6 +234,15 @@ protected:
*/
template <class C, class Chunk> class MediaSegmentBase : public MediaSegment {
public:
bool IsNull() const override
{
for (typename C::ConstChunkIterator iter(*this); !iter.IsEnded(); iter.Next()) {
if (!iter->IsNull()) {
return false;
}
}
return true;
}
MediaSegment* CreateEmptyClone() const override
{
return new C();