Bug 1307019 - Ensure MDSM and MFR have consistent view of what counts as encrypted. r=jya, a=sylvestre
authorChris Pearce <cpearce@mozilla.com>
Mon, 03 Oct 2016 16:34:31 +1300
changeset 340421 8104e34db545f0bc1724d0302613e76b464c46a4
parent 340420 e289e3f73f466c6366da6ce38411c4550d667989
child 340422 abd9db31f1e206f43d28774d382ca0b903b2f9b4
push id10102
push usercbook@mozilla.com
push dateWed, 05 Oct 2016 13:08:00 +0000
treeherdermozilla-aurora@02cc4b849623 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, sylvestre
bugs1307019, 1300069
milestone51.0a2
Bug 1307019 - Ensure MDSM and MFR have consistent view of what counts as encrypted. r=jya, a=sylvestre 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