Bug 1000608 - Allow querying source buffers to see if they contain data for a given time - r=kinetik

This commit is contained in:
cajbir 2014-04-23 19:45:00 +12:00
Родитель ad8b3875f1
Коммит a22aa76f5d
4 изменённых файлов: 26 добавлений и 0 удалений

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

@ -490,6 +490,15 @@ SourceBuffer::Evict(double aStart, double aEnd)
}
}
bool
SourceBuffer::ContainsTime(double aTime)
{
double start = 0.0;
double end = 0.0;
GetBufferedStartEndTime(&start, &end);
return aTime >= start && aTime <= end;
}
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(SourceBuffer, DOMEventTargetHelper,
mMediaSource)

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

@ -109,6 +109,9 @@ public:
// Evict data in the source buffer in the given time range.
void Evict(double aStart, double aEnd);
// Returns true if the data in the source buffer contains the given time.
bool ContainsTime(double aTime);
private:
SourceBuffer(MediaSource* aMediaSource, const nsACString& aType);

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

@ -111,6 +111,17 @@ SourceBufferList::Evict(double aStart, double aEnd)
}
}
bool
SourceBufferList::ContainsTime(double aTime)
{
for (uint32_t i = 0; i < mSourceBuffers.Length(); ++i) {
if (!mSourceBuffers[i]->ContainsTime(aTime)) {
return false;
}
}
return true;
}
void
SourceBufferList::Ended()
{

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

@ -77,6 +77,9 @@ public:
// Evicts data for the given time range from each SourceBuffer in the list.
void Evict(double aStart, double aEnd);
// Returns true if all SourceBuffers in the list contain data for the given time.
bool ContainsTime(double aTime);
private:
friend class AsyncEventRunner<SourceBufferList>;
void DispatchSimpleEvent(const char* aName);