Bug 1385155. P3 - let MP4Stream use SourceBufferResource instead of MediaResourceIndex. r=gerald
authorJW Wang <jwwang@mozilla.com>
Thu, 27 Jul 2017 17:58:45 +0800
changeset 420249 e264858a00d481b5afa785753f29efcaaeca6228
parent 420248 78d726cefb1275075bae8a9a7c5e67d8d360e6fc
child 420250 847e0a72b2766a90ced8727574c27f596ca29872
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1385155
milestone56.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 1385155. P3 - let MP4Stream use SourceBufferResource instead of MediaResourceIndex. r=gerald MozReview-Commit-ID: Gf6FEQAOLRk
dom/media/mediasource/ContainerParser.cpp
--- a/dom/media/mediasource/ContainerParser.cpp
+++ b/dom/media/mediasource/ContainerParser.cpp
@@ -357,33 +357,33 @@ private:
   Maybe<WebMTimeDataOffset> mLastMapping;
 };
 
 #ifdef MOZ_FMP4
 
 class MP4Stream : public mp4_demuxer::Stream
 {
 public:
-  explicit MP4Stream(MediaResource* aResource);
+  explicit MP4Stream(SourceBufferResource* aResource);
   virtual ~MP4Stream();
   bool ReadAt(int64_t aOffset,
               void* aBuffer,
               size_t aCount,
               size_t* aBytesRead) override;
   bool CachedReadAt(int64_t aOffset,
                     void* aBuffer,
                     size_t aCount,
                     size_t* aBytesRead) override;
   bool Length(int64_t* aSize) override;
 
 private:
-  MediaResourceIndex mResource;
+  RefPtr<SourceBufferResource> mResource;
 };
 
-MP4Stream::MP4Stream(MediaResource* aResource)
+MP4Stream::MP4Stream(SourceBufferResource* aResource)
   : mResource(aResource)
 {
   MOZ_COUNT_CTOR(MP4Stream);
   MOZ_ASSERT(aResource);
 }
 
 MP4Stream::~MP4Stream()
 {
@@ -400,32 +400,32 @@ MP4Stream::ReadAt(int64_t aOffset,
 }
 
 bool
 MP4Stream::CachedReadAt(int64_t aOffset,
                         void* aBuffer,
                         size_t aCount,
                         size_t* aBytesRead)
 {
-  nsresult rv = mResource.GetResource()->ReadFromCache(
+  nsresult rv = mResource->ReadFromCache(
     reinterpret_cast<char*>(aBuffer), aOffset, aCount);
   if (NS_FAILED(rv)) {
     *aBytesRead = 0;
     return false;
   }
   *aBytesRead = aCount;
   return true;
 }
 
 bool
 MP4Stream::Length(int64_t* aSize)
 {
-  if (mResource.GetLength() < 0)
+  if (mResource->GetLength() < 0)
     return false;
-  *aSize = mResource.GetLength();
+  *aSize = mResource->GetLength();
   return true;
 }
 
 class MP4ContainerParser : public ContainerParser
 {
 public:
   explicit MP4ContainerParser(const MediaContainerType& aType)
     : ContainerParser(aType)