diff --git a/dom/media/fmp4/MP4Reader.cpp b/dom/media/fmp4/MP4Reader.cpp index 7e8d2b44d165..795e262cd796 100644 --- a/dom/media/fmp4/MP4Reader.cpp +++ b/dom/media/fmp4/MP4Reader.cpp @@ -749,18 +749,6 @@ MP4Reader::Update(TrackType aTrack) mFoundSPSForTelemetry = AccumulateSPSTelemetry(extradata); } - if (sample && sample->mMp4Sample && sample->mMp4Sample->crypto.valid) { - CryptoSample& crypto = sample->mMp4Sample->crypto; - MOZ_ASSERT(crypto.session_ids.IsEmpty()); - - ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor()); - - nsRefPtr proxy = mDecoder->GetCDMProxy(); - MOZ_ASSERT(proxy); - - proxy->GetSessionIdsForKeyId(crypto.key, crypto.session_ids); - } - if (sample) { decoder.mDecoder->Input(sample->mMp4Sample.forget()); if (aTrack == kVideo) { diff --git a/dom/media/fmp4/eme/EMEDecoderModule.cpp b/dom/media/fmp4/eme/EMEDecoderModule.cpp index a7a2f5d24281..9e8a254d619b 100644 --- a/dom/media/fmp4/eme/EMEDecoderModule.cpp +++ b/dom/media/fmp4/eme/EMEDecoderModule.cpp @@ -89,6 +89,9 @@ public: return NS_OK; } + mProxy->GetSessionIdsForKeyId(aSample->crypto.key, + aSample->crypto.session_ids); + mProxy->Decrypt(aSample, new DeliverDecrypted(this, mTaskQueue)); return NS_OK; } @@ -162,6 +165,7 @@ public: EMEMediaDataDecoderProxy(nsIThread* aProxyThread, MediaDataDecoderCallback* aCallback, CDMProxy* aProxy, FlushableMediaTaskQueue* aTaskQueue) : MediaDataDecoderProxy(aProxyThread, aCallback) , mSamplesWaitingForKey(new SamplesWaitingForKey(this, aTaskQueue, aProxy)) + , mProxy(aProxy) { } @@ -170,6 +174,7 @@ public: private: nsRefPtr mSamplesWaitingForKey; + nsRefPtr mProxy; }; nsresult @@ -179,6 +184,9 @@ EMEMediaDataDecoderProxy::Input(mp4_demuxer::MP4Sample* aSample) return NS_OK; } + mProxy->GetSessionIdsForKeyId(aSample->crypto.key, + aSample->crypto.session_ids); + return MediaDataDecoderProxy::Input(aSample); } @@ -189,6 +197,7 @@ EMEMediaDataDecoderProxy::Shutdown() mSamplesWaitingForKey->BreakCycles(); mSamplesWaitingForKey = nullptr; + mProxy = nullptr; return rv; }