Bug 1315850 - Shutdown CDMVideoDecoder. r=jya

This severs the ChromiumCDMVideoDecoder's connection with the CDM. The CDM process
will shutdown when the MediaKeys also severs its connection.

MozReview-Commit-ID: Aqc4y5Nxjvc

--HG--
extra : rebase_source : 5a2f77ffe84f9b99b4668520c838b29a428578d3
This commit is contained in:
Chris Pearce 2017-03-08 10:20:33 +13:00
Родитель dbc1c7bcdf
Коммит 4c421503a8
3 изменённых файлов: 24 добавлений и 1 удалений

Просмотреть файл

@ -626,5 +626,18 @@ ChromiumCDMParent::RecvDrainComplete()
mDecodePromise.ResolveIfExists(MediaDataDecoder::DecodedData(), __func__);
return IPC_OK();
}
RefPtr<ShutdownPromise>
ChromiumCDMParent::ShutdownVideoDecoder()
{
mInitVideoDecoderPromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED,
__func__);
MOZ_ASSERT(mDecodePromise.IsEmpty());
MOZ_ASSERT(mFlushDecoderPromise.IsEmpty());
if (!SendDeinitializeVideoDecoder()) {
return ShutdownPromise::CreateAndResolve(true, __func__);
}
return ShutdownPromise::CreateAndResolve(true, __func__);
}
} // namespace gmp
} // namespace mozilla

Просмотреть файл

@ -73,6 +73,8 @@ public:
RefPtr<MediaDataDecoder::DecodePromise> Drain();
RefPtr<ShutdownPromise> ShutdownVideoDecoder();
protected:
~ChromiumCDMParent() {}

Просмотреть файл

@ -134,7 +134,15 @@ ChromiumCDMVideoDecoder::Drain()
RefPtr<ShutdownPromise>
ChromiumCDMVideoDecoder::Shutdown()
{
return ShutdownPromise::CreateAndResolve(true, __func__);
if (!mCDMParent) {
// Must have failed to get the CDMParent from the ChromiumCDMProxy
// in our constructor; the MediaKeys must have shut down the CDM
// before we had a chance to start up the decoder.
return ShutdownPromise::CreateAndResolve(true, __func__);
}
RefPtr<gmp::ChromiumCDMParent> cdm = mCDMParent;
return InvokeAsync(
mGMPThread, __func__, [cdm]() { return cdm->ShutdownVideoDecoder(); });
}
} // namespace mozilla