Bug 1185792: [webm] P1. Don't clear mNeedReIndex if GetCachedRanges is emtpy. r=jya
authorJan Gerber <j@mailb.org>
Wed, 29 Jul 2015 17:03:18 +0200
changeset 255424 bce1487864338fa488dcdba1d8f3c96cb209291f
parent 255374 ffd18bccd1ce140a71315e33ead24d7918a5f99f
child 255425 a6673a602500d6a360b413da8715886187d332ca
push id29144
push userryanvm@gmail.com
push dateThu, 30 Jul 2015 20:08:20 +0000
treeherdermozilla-central@6a16c1845238 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1185792
milestone42.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 1185792: [webm] P1. Don't clear mNeedReIndex if GetCachedRanges is emtpy. r=jya
dom/media/webm/WebMDemuxer.cpp
--- a/dom/media/webm/WebMDemuxer.cpp
+++ b/dom/media/webm/WebMDemuxer.cpp
@@ -446,25 +446,25 @@ WebMDemuxer::IsSeekable() const
 }
 
 void
 WebMDemuxer::EnsureUpToDateIndex()
 {
   if (!mNeedReIndex) {
     return;
   }
+  if (mInitData && mBufferedState->GetInitEndOffset() == -1) {
+    mBufferedState->NotifyDataArrived(mInitData->Elements(), mInitData->Length(), 0);
+  }
   AutoPinned<MediaResource> resource(mResource);
   nsTArray<MediaByteRange> byteRanges;
   nsresult rv = resource->GetCachedRanges(byteRanges);
-  if (NS_FAILED(rv)) {
+  if (NS_FAILED(rv) || !byteRanges.Length()) {
     return;
   }
-  if (mInitData && mBufferedState->GetInitEndOffset() == -1) {
-    mBufferedState->NotifyDataArrived(mInitData->Elements(), mInitData->Length(), 0);
-  }
   mBufferedState->UpdateIndex(byteRanges, mResource);
   if (!mInitData && mBufferedState->GetInitEndOffset() != -1) {
     mInitData = mResource->MediaReadAt(0, mBufferedState->GetInitEndOffset());
   }
   mNeedReIndex = false;
 }
 
 void