From bd730cc79a2077e3994f41a580ae3aabd59879c2 Mon Sep 17 00:00:00 2001 From: Jean-Yves Avenard Date: Fri, 20 Feb 2015 14:19:14 +1300 Subject: [PATCH] Bug 1133625: Part2. Don't accept buffer exceeding our threshold. r=cajbir YouTube attempts to load data in excess of 8MB when close to the end of the video, and never attempts to re-append should it error. As such, the sourcebuffer threshold can't be set to lower than 8MB with this change. --- dom/media/mediasource/SourceBuffer.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dom/media/mediasource/SourceBuffer.cpp b/dom/media/mediasource/SourceBuffer.cpp index b9c9ca70e699..cde96d070e5a 100644 --- a/dom/media/mediasource/SourceBuffer.cpp +++ b/dom/media/mediasource/SourceBuffer.cpp @@ -562,8 +562,9 @@ SourceBuffer::PrepareAppend(const uint8_t* aData, uint32_t aLength, ErrorResult& // See if we have enough free space to append our new data. // As we can only evict once we have playable data, we must give a chance // to the DASH player to provide a complete media segment. - if ((mTrackBuffer->GetSize() > mEvictionThreshold - aLength) && - !mTrackBuffer->HasOnlyIncompleteMedia()) { + if (aLength > mEvictionThreshold || + ((mTrackBuffer->GetSize() > mEvictionThreshold - aLength) && + !mTrackBuffer->HasOnlyIncompleteMedia())) { aRv.Throw(NS_ERROR_DOM_QUOTA_EXCEEDED_ERR); return nullptr; }