mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1190258: [MSE] P3. Use actual allocated size rather than logical size when calculating eviction rate. r=gerald
This makes eviction slightly more aggressive and ensure we are actually under the memory threshold.
This commit is contained in:
parent
08b31d655d
commit
6937eee720
@ -394,6 +394,10 @@ public:
|
||||
const uint8_t* Data() const { return mData; }
|
||||
// Size of buffer.
|
||||
size_t Size() const { return mSize; }
|
||||
size_t ComputedSizeOfIncludingThis() const
|
||||
{
|
||||
return sizeof(*this) + mCapacity;
|
||||
}
|
||||
|
||||
const CryptoSample& mCrypto;
|
||||
nsRefPtr<MediaByteBuffer> mExtraData;
|
||||
|
@ -430,7 +430,7 @@ TrackBuffersManager::DoEvictData(const TimeUnit& aPlaybackTime,
|
||||
if (frame->mTime >= lowerLimit.ToMicroseconds()) {
|
||||
break;
|
||||
}
|
||||
partialEvict += sizeof(*frame) + frame->Size();
|
||||
partialEvict += frame->ComputedSizeOfIncludingThis();
|
||||
}
|
||||
|
||||
int64_t finalSize = mSizeSourceBuffer - aSizeToEvict;
|
||||
@ -468,7 +468,7 @@ TrackBuffersManager::DoEvictData(const TimeUnit& aPlaybackTime,
|
||||
if (frame->mTime <= upperLimit.ToMicroseconds()) {
|
||||
break;
|
||||
}
|
||||
partialEvict += sizeof(*frame) + frame->Size();
|
||||
partialEvict += frame->ComputedSizeOfIncludingThis();
|
||||
}
|
||||
if (lastKeyFrameIndex < buffer.Length()) {
|
||||
MSE_DEBUG("Step2. Evicting %u bytes from trailing data",
|
||||
@ -1400,7 +1400,7 @@ TrackBuffersManager::ProcessFrames(TrackBuffer& aSamples, TrackData& aTrackData)
|
||||
}
|
||||
|
||||
samplesRange += sampleInterval;
|
||||
sizeNewSamples += sizeof(*sample) + sample->Size();
|
||||
sizeNewSamples += sample->ComputedSizeOfIncludingThis();
|
||||
sample->mTime = sampleInterval.mStart.ToMicroseconds();
|
||||
sample->mTimecode = decodeTimestamp.ToMicroseconds();
|
||||
sample->mTrackInfo = trackBuffer.mLastInfo;
|
||||
@ -1606,7 +1606,7 @@ TrackBuffersManager::RemoveFrames(const TimeIntervals& aIntervals,
|
||||
if (sample->mDuration > maxSampleDuration) {
|
||||
maxSampleDuration = sample->mDuration;
|
||||
}
|
||||
aTrackData.mSizeBuffer -= sizeof(*sample) + sample->Size();
|
||||
aTrackData.mSizeBuffer -= sample->ComputedSizeOfIncludingThis();
|
||||
}
|
||||
|
||||
removedIntervals.SetFuzz(TimeUnit::FromMicroseconds(maxSampleDuration));
|
||||
|
Loading…
Reference in New Issue
Block a user