Bug 1027875 - Make GetCachedRanges() handle the empty case; r=kinetik
authorAnthony Jones <ajones@mozilla.com>
Fri, 04 Jul 2014 20:31:20 +1200
changeset 192396 00a68fd085d5682d3f15877973c2d9c4887825d2
parent 192395 bd855ca58b41aa5393c7faea87a2e94afaf57d5c
child 192397 aabe2de625c6f372cc75543206be6109f144de29
push id27086
push userttaubert@mozilla.com
push dateSun, 06 Jul 2014 16:11:25 +0000
treeherdermozilla-central@9f59e39f70a5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1027875
milestone33.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 1027875 - Make GetCachedRanges() handle the empty case; r=kinetik
content/media/mediasource/SourceBufferResource.h
--- a/content/media/mediasource/SourceBufferResource.h
+++ b/content/media/mediasource/SourceBufferResource.h
@@ -239,18 +239,20 @@ public:
   virtual bool IsSuspendedByCache() MOZ_OVERRIDE { return false; }
   virtual bool IsSuspended() MOZ_OVERRIDE { return false; }
   virtual nsresult ReadFromCache(char* aBuffer, int64_t aOffset, uint32_t aCount) MOZ_OVERRIDE;
   virtual bool IsTransportSeekable() MOZ_OVERRIDE { return true; }
   virtual nsresult Open(nsIStreamListener** aStreamListener) MOZ_OVERRIDE { return NS_ERROR_FAILURE; }
 
   virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges) MOZ_OVERRIDE
   {
-    aRanges.AppendElement(MediaByteRange(mInputBuffer.GetOffset(),
-                                         mInputBuffer.GetLength()));
+    if (mInputBuffer.GetLength()) {
+      aRanges.AppendElement(MediaByteRange(mInputBuffer.GetOffset(),
+                                           mInputBuffer.GetLength()));
+    }
     return NS_OK;
   }
 
   virtual const nsCString& GetContentType() const MOZ_OVERRIDE { return mType; }
 
   virtual size_t SizeOfExcludingThis(
                       MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE
   {