Bug 1367128: P3. Plumb in new eviction methods with MSE demuxer. r=gerald
authorJean-Yves Avenard <jyavenard@mozilla.com>
Fri, 02 Jun 2017 21:16:33 +0200
changeset 410454 34cf246b51d8c2a07f1b29265b09bdf01862472e
parent 410453 564b0921883d4c42e9cccc632a85483f0ded802b
child 410455 5ec621ced42e4e1758e0c5ebe4974d041aa45ef7
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1367128
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 1367128: P3. Plumb in new eviction methods with MSE demuxer. r=gerald MozReview-Commit-ID: HULNEfD3tRJ
dom/media/fmp4/MP4Demuxer.cpp
--- a/dom/media/fmp4/MP4Demuxer.cpp
+++ b/dom/media/fmp4/MP4Demuxer.cpp
@@ -52,16 +52,18 @@ public:
 
   RefPtr<SkipAccessPointPromise>
   SkipToNextRandomAccessPoint(const media::TimeUnit& aTimeThreshold) override;
 
   media::TimeIntervals GetBuffered() override;
 
   void BreakCycles() override;
 
+  void NotifyDataRemoved();
+
 private:
   friend class MP4Demuxer;
   void NotifyDataArrived();
   already_AddRefed<MediaRawData> GetNextSample();
   void EnsureUpToDateIndex();
   void SetNextKeyFrameTime();
   RefPtr<MP4Demuxer> mParent;
   RefPtr<mp4_demuxer::ResourceStream> mStream;
@@ -323,20 +325,20 @@ MP4Demuxer::NotifyDataArrived()
     dmx->NotifyDataArrived();
   }
 }
 
 void
 MP4Demuxer::NotifyDataRemoved()
 {
   for (auto& dmx : mAudioDemuxers) {
-    dmx->NotifyDataArrived();
+    dmx->NotifyDataRemoved();
   }
   for (auto& dmx : mVideoDemuxers) {
-    dmx->NotifyDataArrived();
+    dmx->NotifyDataRemoved();
   }
 }
 
 UniquePtr<EncryptionInfo>
 MP4Demuxer::GetCrypto()
 {
   UniquePtr<EncryptionInfo> crypto;
   if (!mCryptoInitData.IsEmpty()) {
@@ -606,16 +608,29 @@ MP4TrackDemuxer::GetBuffered()
 
 void
 MP4TrackDemuxer::NotifyDataArrived()
 {
   mNeedReIndex = true;
 }
 
 void
+MP4TrackDemuxer::NotifyDataRemoved()
+{
+  AutoPinned<MediaResource> resource(mParent->mResource);
+  MediaByteRangeSet byteRanges;
+  nsresult rv = resource->GetCachedRanges(byteRanges);
+  if (NS_FAILED(rv)) {
+    return;
+  }
+  mIndex->UpdateMoofIndex(byteRanges, true /* can evict */);
+  mNeedReIndex = false;
+}
+
+void
 MP4TrackDemuxer::BreakCycles()
 {
   mParent = nullptr;
 }
 
 } // namespace mozilla
 
 #undef LOG