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 350562 1aac04b95158acd6df883fcdfaae6c0927f4e365
parent 350561 98f174fa9b903aca83ecfb596e13c4cadc6ac2f4
child 350563 5350691a386ad2d390d661eaacd2617647b95175
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, sylvestre
bugs1307019, 1300069
milestone50.0
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