Bug 1161984 - Get rid of IsWaitingMediaResources() in MP4Reader. r=jya
authorAlfredo Yang <ayang>
Wed, 13 May 2015 00:02:00 -0400
changeset 244248 fabd4d52ca7a9440c856f952015b7fc125420ac4
parent 244247 b0f4250a4468e6426586520029a0b468047bd727
child 244249 8c5b4478608d9a993850464fe07797d39bb406bb
push id59879
push userryanvm@gmail.com
push dateSun, 17 May 2015 23:46:43 +0000
treeherdermozilla-inbound@62c3b79f3f28 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1161984
milestone41.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 1161984 - Get rid of IsWaitingMediaResources() in MP4Reader. r=jya
dom/media/fmp4/MP4Reader.cpp
dom/media/fmp4/MP4Reader.h
dom/media/fmp4/PlatformDecoderModule.h
dom/media/fmp4/SharedDecoderManager.cpp
dom/media/fmp4/gmp/MediaDataDecoderProxy.h
--- a/dom/media/fmp4/MP4Reader.cpp
+++ b/dom/media/fmp4/MP4Reader.cpp
@@ -381,17 +381,17 @@ MP4Reader::ReadMetadata(MediaInfo* aInfo
       ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
       mIsEncrypted = mCrypto.valid;
     }
 
     // Remember that we've initialized the demuxer, so that if we're decoding
     // an encrypted stream and we need to wait for a CDM to be set, we don't
     // need to reinit the demuxer.
     mDemuxerInitialized = true;
-  } else if (mPlatform && !IsWaitingMediaResources()) {
+  } else if (mPlatform) {
     *aInfo = mInfo;
     *aTags = nullptr;
     NS_ENSURE_TRUE(EnsureDecodersSetup(), NS_ERROR_FAILURE);
     return NS_OK;
   }
 
   if (HasAudio()) {
     mInfo.mAudio = mDemuxer->AudioConfig();
@@ -459,21 +459,16 @@ MP4Reader::EnsureDecodersSetup()
 #ifdef MOZ_EME
       // We have encrypted audio or video. We'll need a CDM to decrypt and
       // possibly decode this. Wait until we've received a CDM from the
       // JavaScript player app. Note: we still go through the motions here
       // even if EME is disabled, so that if script tries and fails to create
       // a CDM, we can detect that and notify chrome and show some UI
       // explaining that we failed due to EME being disabled.
       nsRefPtr<CDMProxy> proxy;
-      if (IsWaitingMediaResources()) {
-        return true;
-      }
-      MOZ_ASSERT(!IsWaitingMediaResources());
-
       {
         ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
         proxy = mDecoder->GetCDMProxy();
       }
       MOZ_ASSERT(proxy);
 
       mPlatform = PlatformDecoderModule::CreateCDMWrapper(proxy,
                                                           HasAudio(),
@@ -525,18 +520,16 @@ MP4Reader::EnsureDecodersSetup()
                                  mLayersBackendType,
                                  mDecoder->GetImageContainer());
     }
     NS_ENSURE_TRUE(mVideo.mDecoder != nullptr, false);
     nsresult rv = mVideo.mDecoder->Init();
     NS_ENSURE_SUCCESS(rv, false);
   }
 
-  NotifyResourcesStatusChanged();
-
   return true;
 }
 
 void
 MP4Reader::ReadUpdatedMetadata(MediaInfo* aInfo)
 {
   *aInfo = mInfo;
 }
@@ -1124,29 +1117,21 @@ void MP4Reader::ReleaseMediaResources()
     container->ClearCurrentFrame();
   }
   if (mVideo.mDecoder) {
     mVideo.mDecoder->Shutdown();
     mVideo.mDecoder = nullptr;
   }
 }
 
-void MP4Reader::NotifyResourcesStatusChanged()
-{
-  if (mDecoder) {
-    mDecoder->NotifyWaitingForResourcesStatusChanged();
-  }
-}
-
 void
 MP4Reader::SetIdle()
 {
   if (mSharedDecoderManager && mVideo.mDecoder) {
     mSharedDecoderManager->SetIdle(mVideo.mDecoder);
-    NotifyResourcesStatusChanged();
   }
 }
 
 void
 MP4Reader::SetSharedDecoderManager(SharedDecoderManager* aManager)
 {
 #if !defined(MOZ_WIDGET_ANDROID)
   mSharedDecoderManager = aManager;
--- a/dom/media/fmp4/MP4Reader.h
+++ b/dom/media/fmp4/MP4Reader.h
@@ -119,17 +119,16 @@ private:
   void Output(TrackType aType, MediaData* aSample);
   void InputExhausted(TrackType aTrack);
   void Error(TrackType aTrack);
   void Flush(TrackType aTrack);
   void DrainComplete(TrackType aTrack);
   void UpdateIndex();
   bool IsSupportedAudioMimeType(const nsACString& aMimeType);
   bool IsSupportedVideoMimeType(const nsACString& aMimeType);
-  void NotifyResourcesStatusChanged();
   virtual bool IsWaitingOnCDMResource() override;
 
   Microseconds GetNextKeyframeTime();
   bool ShouldSkip(bool aSkipToNextKeyframe, int64_t aTimeThreshold);
 
   size_t SizeOfQueue(TrackType aTrack);
 
   nsRefPtr<MP4Stream> mStream;
@@ -151,19 +150,16 @@ private:
       mReader->InputExhausted(mType);
     }
     virtual void Error() override {
       mReader->Error(mType);
     }
     virtual void DrainComplete() override {
       mReader->DrainComplete(mType);
     }
-    virtual void NotifyResourcesStatusChanged() override {
-      mReader->NotifyResourcesStatusChanged();
-    }
     virtual void ReleaseMediaResources() override {
       mReader->ReleaseMediaResources();
     }
     virtual bool OnReaderTaskQueue() override {
       return mReader->OnTaskQueue();
     }
   private:
     MP4Reader* mReader;
--- a/dom/media/fmp4/PlatformDecoderModule.h
+++ b/dom/media/fmp4/PlatformDecoderModule.h
@@ -174,18 +174,16 @@ public:
   virtual void Error() = 0;
 
   // Denotes that the last input sample has been inserted into the decoder,
   // and no more output can be produced unless more input is sent.
   virtual void InputExhausted() = 0;
 
   virtual void DrainComplete() = 0;
 
-  virtual void NotifyResourcesStatusChanged() {};
-
   virtual void ReleaseMediaResources() {};
 
   virtual bool OnReaderTaskQueue() = 0;
 };
 
 // MediaDataDecoder is the interface exposed by decoders created by the
 // PlatformDecoderModule's Create*Decoder() functions. The type of
 // media data that the decoder accepts as valid input and produces as
--- a/dom/media/fmp4/SharedDecoderManager.cpp
+++ b/dom/media/fmp4/SharedDecoderManager.cpp
@@ -39,23 +39,16 @@ public:
   }
   virtual void DrainComplete() override
   {
     if (mManager->mActiveCallback) {
       AssertHaveActiveProxy();
       mManager->DrainComplete();
     }
   }
-  virtual void NotifyResourcesStatusChanged() override
-  {
-    if (mManager->mActiveCallback) {
-      AssertHaveActiveProxy();
-      mManager->mActiveCallback->NotifyResourcesStatusChanged();
-    }
-  }
   virtual void ReleaseMediaResources() override
   {
     if (mManager->mActiveCallback) {
       AssertHaveActiveProxy();
       mManager->mActiveCallback->ReleaseMediaResources();
     }
   }
   virtual bool OnReaderTaskQueue() override
--- a/dom/media/fmp4/gmp/MediaDataDecoderProxy.h
+++ b/dom/media/fmp4/gmp/MediaDataDecoderProxy.h
@@ -101,20 +101,16 @@ public:
   virtual void InputExhausted() override {
     mProxyCallback->InputExhausted();
   }
 
   virtual void DrainComplete() override {
     mProxyCallback->DrainComplete();
   }
 
-  virtual void NotifyResourcesStatusChanged() override {
-    mProxyCallback->NotifyResourcesStatusChanged();
-  }
-
   virtual void ReleaseMediaResources() override {
     mProxyCallback->ReleaseMediaResources();
   }
 
   virtual void FlushComplete();
 
   virtual bool OnReaderTaskQueue() override
   {