Bug 1368837 - BufferMediaResource::GetCachedDataEnd should return aOffset when out of cache - r=cpearce
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 01 Jun 2017 11:30:14 +1200
changeset 361716 e38d5530bf2b18ee63a7b3a1f7633376a0ce0969
parent 361715 7a404b72b9b8f89046938755e17c17de333dfdf5
child 361717 d7836ae27b65d4e511d3bf047380e1fb83124002
push id31939
push usercbook@mozilla.com
push dateThu, 01 Jun 2017 11:49:28 +0000
treeherdermozilla-central@d96110d76619 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1368837
milestone55.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 1368837 - BufferMediaResource::GetCachedDataEnd should return aOffset when out of cache - r=cpearce MozReview-Commit-ID: 6EEXSUxShLp
dom/media/BufferMediaResource.h
--- a/dom/media/BufferMediaResource.h
+++ b/dom/media/BufferMediaResource.h
@@ -70,17 +70,20 @@ private:
   }
   int64_t Tell() override { return mOffset; }
 
   void Pin() override {}
   void Unpin() override {}
   double GetDownloadRate(bool* aIsReliable) override { *aIsReliable = false; return 0.; }
   int64_t GetLength() override { return mLength; }
   int64_t GetNextCachedData(int64_t aOffset) override { return aOffset; }
-  int64_t GetCachedDataEnd(int64_t aOffset) override { return mLength; }
+  int64_t GetCachedDataEnd(int64_t aOffset) override
+  {
+    return std::max(aOffset, int64_t(mLength));
+  }
   bool IsDataCachedToEndOfResource(int64_t aOffset) override { return true; }
   bool IsSuspendedByCache() override { return false; }
   bool IsSuspended() override { return false; }
   nsresult ReadFromCache(char* aBuffer,
                          int64_t aOffset,
                          uint32_t aCount) override
   {
     if (aOffset < 0) {