Closed Bug 1265587 Opened 8 years ago Closed 8 years ago

Amazon Widevine video triggers MediaKeySession InvalidModificationError exception

Categories

(Core :: Audio/Video: Playback, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox47 --- fixed
firefox48 --- fixed

People

(Reporter: cpeterson, Assigned: cpearce)

References

Details

Attachments

(1 file)

Amazon reports that they intermittently see InvalidModificationError exceptions from the MediaKeySession object:

DOMException
code: 13
message: "An attempt was made to modify the type of the underlying objec" [sic]
name: "InvalidModificationError"
result: 2152923149 (0x8053000D)

They have seen this error happen in two cases:

* the most common is on a call to MediaKeySession::update, when adding in a license.
* the other case was on a call to MediaKeySession::generateRequest, with initialization data from the video element's "encrypted" event

The first one seems to happen when they try to re-acquire the license for a video. Roughly this would translate to:

- append an initialization segment to the source buffer
- when the encrypted event comes, create a MediaKeySession and call generateRequest on it
- handle the "message" event and request a license
- set the license using MediaKeySession::update
- play some of the content, then stop playing, remove all SourceBuffers, clear the video element's src and close the MediaKeySession
- then run this process again, for the same content.
Priority: -- → P1
The Widevine CDM, and I believe the Adobe CDM too probably, do not mark a
session's keys as unusable when a key session is closed. This means that
the CDMCaps' copy of the keys that are usable is wrong, and so if the media
with the same keys is reloaded with the same MediaKeys, Firefox will assume
that the keys are usable before the license for the keys has been
re-negotiated, and so decryption will fail.

Review commit: https://reviewboard.mozilla.org/r/48251/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/48251/
Attachment #8744033 - Flags: review?(gsquelart)
Comment on attachment 8744033 [details]
MozReview Request: Bug 1265587 - Force keystatuses to be cleared when Widevine keysessions are closed. r?gerald

https://reviewboard.mozilla.org/r/48251/#review44981

r+ with optional nit:

::: dom/media/eme/CDMCaps.h:76
(Diff revision 1)
>      void GetSessionIdsForKeyId(const CencKeyId& aKeyId,
>                                 nsTArray<nsCString>& aOutSessionIds);
>  
> +    // Ensures all keys for a session are marked as 'unknown', i.e. removed.
> +    // Returns true if a key status was changed.
> +    bool RemoveKeysForSession(const nsString& aSessionId);

Could take 'nsAString' (with 'A'), to be consistent with GetKeyStatusesForSession, which you call.
Attachment #8744033 - Flags: review?(gsquelart) → review+
https://reviewboard.mozilla.org/r/48251/#review44981

> Could take 'nsAString' (with 'A'), to be consistent with GetKeyStatusesForSession, which you call.

This would require a bunch of other things to also require to be converted to abstract strings, so I left it as is.
Comment on attachment 8744033 [details]
MozReview Request: Bug 1265587 - Force keystatuses to be cleared when Widevine keysessions are closed. r?gerald

Approval Request Comment
[Feature/regressing bug #]: Widevine EME
[User impact if declined]: Users won't be able to play an Amazon Prime video, click the "close player" button, then click the "continue watching" button on the same video and have the same video restart playing.
[Describe test coverage new/current, TreeHerder]: We have lots of EME mochitests
[Risks and why]: Low. Netflix doesn't execute this code path.
[String/UUID change made/needed]: None
Attachment #8744033 - Flags: approval-mozilla-aurora?
Comment on attachment 8744033 [details]
MozReview Request: Bug 1265587 - Force keystatuses to be cleared when Widevine keysessions are closed. r?gerald

Widevine EME related, Aurora47+
Attachment #8744033 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
https://hg.mozilla.org/mozilla-central/rev/6855520a3df4
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.