Bug 1133625: Part2. Don't accept buffer exceeding our threshold. r=cajbir
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 20 Feb 2015 14:19:14 +1300
changeset 229950 74014ad8e1f8301cff489b9a6561f1deb39059ee
parent 229949 af39fc4994cc2c06cce3f11d582b17cd3195cfbb
child 229951 fb6b682a464e0bd9f30fa2004c73d907f34a9a65
push id55849
push userjyavenard@mozilla.com
push dateFri, 20 Feb 2015 01:20:02 +0000
treeherdermozilla-inbound@fb6b682a464e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscajbir
bugs1133625
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
--- a/dom/media/mediasource/SourceBuffer.cpp
+++ b/dom/media/mediasource/SourceBuffer.cpp
@@ -557,18 +557,19 @@ SourceBuffer::PrepareAppend(const uint8_
     // We notify that we've evicted from the time range 0 through to
     // the current start point.
     mMediaSource->NotifyEvicted(0.0, newBufferStartTime);
   }
 
   // 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;
   }
 
   nsRefPtr<LargeDataBuffer> data = new LargeDataBuffer();
   if (!data->AppendElements(aData, aLength)) {
     aRv.Throw(NS_ERROR_DOM_QUOTA_EXCEEDED_ERR);
     return nullptr;