mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-17 15:25:52 +00:00
Bug 1298027 - Relax decoder shutdown and mediakey removal on MediaElement suspension. r=cpearce
This changeset relaxes the shutting down of decoders and removal of mediakeys when suspending HTMLMediaElements. This should now only happen for adobe primetime. This alleviates, for non-primetime CDMs, the issue of videos breaking when moving an EME protected video from a tab to a new window. These conditions can be relaxed as neither clearkey or widevine support secure stop. This means we don't need to shutdown their decoders and keys to signal a stoppage, as at this stage, doing so doesn't give us secure stop and instead means that playback is busted when we try to resume. MozReview-Commit-ID: 3MGNXGGDVLS --HG-- extra : rebase_source : cbf46b3da089f79d9b6729a02997d1a0a12b68a7
This commit is contained in:
parent
b30589a1ae
commit
5dbd650b59
@ -12,6 +12,7 @@
|
||||
#include "mozilla/MathAlgorithms.h"
|
||||
#include "mozilla/AsyncEventDispatcher.h"
|
||||
#include "mozilla/dom/MediaEncryptedEvent.h"
|
||||
#include "mozilla/EMEUtils.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "nsIDOMHTMLMediaElement.h"
|
||||
@ -5292,16 +5293,23 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
|
||||
ReportTelemetry();
|
||||
ReportEMETelemetry();
|
||||
|
||||
// For EME content, force destruction of the CDM client (and CDM
|
||||
// For EME content, we may force destruction of the CDM client (and CDM
|
||||
// instance if this is the last client for that CDM instance) and
|
||||
// the CDM's decoder. This ensures the CDM gets reliable and prompt
|
||||
// shutdown notifications, as it may have book-keeping it needs
|
||||
// to do on shutdown.
|
||||
if (mMediaKeys) {
|
||||
mMediaKeys->Shutdown();
|
||||
mMediaKeys = nullptr;
|
||||
if (mDecoder) {
|
||||
ShutdownDecoder();
|
||||
nsAutoString keySystem;
|
||||
mMediaKeys->GetKeySystem(keySystem);
|
||||
// If we're using Primetime we need to shutdown the key system and
|
||||
// decoder to preserve secure stop like behavior, other CDMs don't
|
||||
// implement this so we don't need to worry with them.
|
||||
if (IsPrimetimeKeySystem(keySystem)) {
|
||||
mMediaKeys->Shutdown();
|
||||
mMediaKeys = nullptr;
|
||||
if (mDecoder) {
|
||||
ShutdownDecoder();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mDecoder) {
|
||||
@ -5310,7 +5318,6 @@ void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendE
|
||||
}
|
||||
mEventDeliveryPaused = aSuspendEvents;
|
||||
} else {
|
||||
MOZ_ASSERT(!mMediaKeys);
|
||||
if (mDecoder) {
|
||||
mDecoder->Resume();
|
||||
if (!mPaused && !mDecoder->IsEnded()) {
|
||||
|
Loading…
Reference in New Issue
Block a user