Bug 1270607 - Handle already-shutdown state in EMEDecryptor::Input - c?cpearce
Based on crash reports, it seems Input() is actually called after Shutdown(),
which causes a nullptr deref when trying to access mSamplesWaitingForKey's
mProxy in mSamplesWaitingForKey->WaitIfKeyNotUsable().
So like other MediaDataDecoder's we should just gracefully handle this case.
Keeping a warning like in Decrypted(), to catch this situation in future
debugging sessions.
MozReview-Commit-ID: 6qspmej2tZM
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -39,17 +39,20 @@ public:
RefPtr<InitPromise> Init() override {
MOZ_ASSERT(!mIsShutdown);
return mDecoder->Init();
}
nsresult Input(MediaRawData* aSample) override {
MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
- MOZ_ASSERT(!mIsShutdown);
+ if (mIsShutdown) {
+ NS_WARNING("EME encrypted sample arrived after shutdown");
+ return NS_OK;
+ }
if (mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)) {
return NS_OK;
}
nsAutoPtr<MediaRawDataWriter> writer(aSample->CreateWriter());
mProxy->GetSessionIdsForKeyId(aSample->mCrypto.mKeyId,
writer->mCrypto.mSessionIds);