Bug 1188812 - Obtain CDM can render capability and store into MediaInfo r=cpearce.
authorKilik Kuo <kikuo@mozilla.com>
Thu, 06 Aug 2015 14:24:00 +0800
changeset 256766 7bfb63119f1ce5fc543c02882e3d4dcfc316196c
parent 256765 79ecbf9133b17d4e1219da2f5222192e9c2bc084
child 256767 6e166fef1a0f7406b73804c9a04c136086dc257e
push id29187
push usercbook@mozilla.com
push dateFri, 07 Aug 2015 11:13:32 +0000
treeherdermozilla-central@3e51753a099f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1188812
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 1188812 - Obtain CDM can render capability and store into MediaInfo r=cpearce.
dom/media/MediaFormatReader.cpp
dom/media/MediaInfo.h
--- a/dom/media/MediaFormatReader.cpp
+++ b/dom/media/MediaFormatReader.cpp
@@ -409,18 +409,22 @@ MediaFormatReader::EnsureDecodersSetup()
       // 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;
       {
         ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
         proxy = mDecoder->GetCDMProxy();
+        MOZ_ASSERT(proxy);
+
+        CDMCaps::AutoLock caps(proxy->Capabilites());
+        mInfo.mVideo.mIsRenderedExternally = caps.CanRenderVideo();
+        mInfo.mAudio.mIsRenderedExternally = caps.CanRenderAudio();
       }
-      MOZ_ASSERT(proxy);
 
       mPlatform = PlatformDecoderModule::CreateCDMWrapper(proxy);
       NS_ENSURE_TRUE(mPlatform, false);
 #else
       // EME not supported.
       return false;
 #endif
     } else {
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -41,16 +41,17 @@ public:
     : mId(aId)
     , mKind(aKind)
     , mLabel(aLabel)
     , mLanguage(aLanguage)
     , mEnabled(aEnabled)
     , mTrackId(aTrackId)
     , mDuration(0)
     , mMediaTime(0)
+    , mIsRenderedExternally(false)
     , mType(aType)
   {
     MOZ_COUNT_CTOR(TrackInfo);
   }
 
   // Only used for backward compatibility. Do not use in new code.
   void Init(TrackType aType,
             const nsAString& aId,
@@ -78,16 +79,20 @@ public:
 
   TrackID mTrackId;
 
   nsAutoCString mMimeType;
   int64_t mDuration;
   int64_t mMediaTime;
   CryptoTrack mCrypto;
 
+  // True if the track is gonna be (decrypted)/decoded and
+  // rendered directly by non-gecko components.
+  bool mIsRenderedExternally;
+
   virtual AudioInfo* GetAsAudioInfo()
   {
     return nullptr;
   }
   virtual VideoInfo* GetAsVideoInfo()
   {
     return nullptr;
   }
@@ -142,16 +147,17 @@ protected:
     mLabel = aOther.mLabel;
     mLanguage = aOther.mLanguage;
     mEnabled = aOther.mEnabled;
     mTrackId = aOther.mTrackId;
     mMimeType = aOther.mMimeType;
     mDuration = aOther.mDuration;
     mMediaTime = aOther.mMediaTime;
     mCrypto = aOther.mCrypto;
+    mIsRenderedExternally = aOther.mIsRenderedExternally;
     mType = aOther.mType;
     MOZ_COUNT_CTOR(TrackInfo);
   }
 
 private:
   TrackType mType;
 };