Bug 1065235 - Make the SourceBuffer eviction threshold a hidden pref. r=cajbir

--HG--
extra : rebase_source : 7c22907cc774440f599cd972792d6d55a50151a2
This commit is contained in:
Matthew Gregan 2014-09-09 21:39:00 +12:00
parent c56b93ea7b
commit 54b218302a
2 changed files with 5 additions and 2 deletions

View File

@ -514,6 +514,8 @@ SourceBuffer::SourceBuffer(MediaSource* aMediaSource, const nsACString& aType)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aMediaSource);
mEvictionThreshold = Preferences::GetUint("media.mediasource.eviction_threshold",
75 * (1 << 20));
mParser = ContainerParser::CreateForMIMEType(aType);
mTrackBuffer = new TrackBuffer(aMediaSource->GetDecoder(), aType);
MSE_DEBUG("SourceBuffer(%p)::SourceBuffer: Create mParser=%p mTrackBuffer=%p",
@ -660,8 +662,7 @@ SourceBuffer::AppendData(const uint8_t* aData, uint32_t aLength, ErrorResult& aR
// TODO: Make the eviction threshold smaller for audio-only streams.
// TODO: Drive evictions off memory pressure notifications.
// TODO: Consider a global eviction threshold rather than per TrackBuffer.
const uint32_t evict_threshold = 75 * (1 << 20);
bool evicted = mTrackBuffer->EvictData(evict_threshold);
bool evicted = mTrackBuffer->EvictData(mEvictionThreshold);
if (evicted) {
MSE_DEBUG("SourceBuffer(%p)::AppendData Evict; current buffered start=%f",
this, GetBufferedStart());

View File

@ -139,6 +139,8 @@ private:
const nsCString mType;
uint32_t mEvictionThreshold;
nsAutoPtr<ContainerParser> mParser;
nsRefPtr<TrackBuffer> mTrackBuffer;