mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 2 changesets (bug 1108917) for mochitest-2 bustage on a CLOSED TREE
Backed out changeset e278ad9face8 (bug 1108917) Backed out changeset 5c24dfe0cf87 (bug 1108917)
This commit is contained in:
parent
1c7227e9e3
commit
d43fd4f419
@ -202,32 +202,6 @@ TrackBuffer::AppendDataToCurrentResource(const uint8_t* aData, uint32_t aLength)
|
||||
return true;
|
||||
}
|
||||
|
||||
class DecoderSorter
|
||||
{
|
||||
public:
|
||||
bool LessThan(SourceBufferDecoder* aFirst, SourceBufferDecoder* aSecond) const
|
||||
{
|
||||
nsRefPtr<dom::TimeRanges> first = new dom::TimeRanges();
|
||||
aFirst->GetBuffered(first);
|
||||
|
||||
nsRefPtr<dom::TimeRanges> second = new dom::TimeRanges();
|
||||
aSecond->GetBuffered(second);
|
||||
|
||||
return first->GetStartTime() < second->GetStartTime();
|
||||
}
|
||||
|
||||
bool Equals(SourceBufferDecoder* aFirst, SourceBufferDecoder* aSecond) const
|
||||
{
|
||||
nsRefPtr<dom::TimeRanges> first = new dom::TimeRanges();
|
||||
aFirst->GetBuffered(first);
|
||||
|
||||
nsRefPtr<dom::TimeRanges> second = new dom::TimeRanges();
|
||||
aSecond->GetBuffered(second);
|
||||
|
||||
return first->GetStartTime() == second->GetStartTime();
|
||||
}
|
||||
};
|
||||
|
||||
bool
|
||||
TrackBuffer::EvictData(uint32_t aThreshold)
|
||||
{
|
||||
@ -244,43 +218,13 @@ TrackBuffer::EvictData(uint32_t aThreshold)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get a list of initialized decoders, sorted by their start times.
|
||||
nsTArray<SourceBufferDecoder*> decoders;
|
||||
decoders.AppendElements(mInitializedDecoders);
|
||||
decoders.Sort(DecoderSorter());
|
||||
|
||||
// First try to evict data before the current play position, starting
|
||||
// with the earliest time.
|
||||
uint32_t i = 0;
|
||||
for (; i < decoders.Length(); ++i) {
|
||||
for (uint32_t i = 0; i < mInitializedDecoders.Length(); ++i) {
|
||||
MSE_DEBUG("TrackBuffer(%p)::EvictData decoder=%u threshold=%u toEvict=%lld",
|
||||
this, i, aThreshold, toEvict);
|
||||
toEvict -= decoders[i]->GetResource()->EvictData(toEvict);
|
||||
if (!decoders[i]->GetResource()->GetSize() &&
|
||||
decoders[i] != mCurrentDecoder) {
|
||||
RemoveDecoder(decoders[i]);
|
||||
}
|
||||
if (toEvict <= 0 || decoders[i] == mCurrentDecoder) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If we still need to evict more, then try to evict entire decoders,
|
||||
// starting from the end.
|
||||
if (toEvict > 0) {
|
||||
uint32_t end = i;
|
||||
MOZ_ASSERT(decoders[end] == mCurrentDecoder);
|
||||
|
||||
for (i = decoders.Length() - 1; i > end; --i) {
|
||||
MSE_DEBUG("TrackBuffer(%p)::EvictData removing entire decoder=%u from end toEvict=%lld",
|
||||
this, i, toEvict);
|
||||
// TODO: We could implement forward-eviction within a decoder and
|
||||
// be able to evict within the current decoder.
|
||||
toEvict -= decoders[i]->GetResource()->GetSize();
|
||||
RemoveDecoder(decoders[i]);
|
||||
if (toEvict <= 0) {
|
||||
break;
|
||||
}
|
||||
toEvict -= mInitializedDecoders[i]->GetResource()->EvictData(toEvict);
|
||||
if (!mInitializedDecoders[i]->GetResource()->GetSize() &&
|
||||
mInitializedDecoders[i] != mCurrentDecoder) {
|
||||
RemoveDecoder(mInitializedDecoders[i]);
|
||||
}
|
||||
}
|
||||
return toEvict < (totalSize - aThreshold);
|
||||
|
Loading…
Reference in New Issue
Block a user