Bug 1307019 - Ensure MDSM and MFR have consistent view of what counts as encrypted. r=jya
authorChris Pearce <cpearce@mozilla.com>
Mon, 03 Oct 2016 16:34:31 +1300
changeset 316204 61d63bbd649fb0ef01afa61a516fed44dee07ecc
parent 316203 29fc20c94897948013efcd0f52607630056d3339
child 316205 8f201cbda968f8d8bf52e77c05d75d558690a6f9
push id32773
push usercpearce@mozilla.com
push dateMon, 03 Oct 2016 20:30:21 +0000
treeherderautoland@8f201cbda968 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya
bugs1307019, 1300069
milestone52.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 1307019 - Ensure MDSM and MFR have consistent view of what counts as encrypted. r=jya The patch in bug 1300069 introduced an inconsistency between what the MediaDecoderStateMachine and the MediaFormatReader consider an encrypted stream. The MDSM considered a stream encrypted if mInfo.IsEncrypted() is true, and that only takes into account the PSSH. Whereas the MFR only considers the presence of a TENC box to indicate encryptedness. This would cause the MDSM to not wait for the CDM before trying to start decoding. So if you setup the MediaSource before setting the MediaKeys on the MediaElement, you'll end up trying to create an EME decoder without a CDMProxy, and that causes a null pointer deref and crash. This patch ensures that the MDSM and the MFR use the same logic to determine whether a stream is encrypted. MozReview-Commit-ID: KGuYTuP9XDL
dom/media/MediaInfo.h
--- a/dom/media/MediaInfo.h
+++ b/dom/media/MediaInfo.h
@@ -459,17 +459,18 @@ public:
     // Set dummy values so that HasAudio() will return true;
     // See AudioInfo::IsValid()
     mAudio.mChannels = 2;
     mAudio.mRate = 44100;
   }
 
   bool IsEncrypted() const
   {
-    return mCrypto.IsEncrypted();
+    return (HasAudio() && mAudio.mCrypto.mValid) ||
+           (HasVideo() && mVideo.mCrypto.mValid);
   }
 
   bool HasValidMedia() const
   {
     return HasVideo() || HasAudio();
   }
 
   void AssertValid() const