Description
The EME specification currently mentions a "replacement algorithm" in the notes for the update() method (https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-update):
- "The replacement algorithm within a session is Key System-dependent."
- "It is RECOMMENDED that CDM implementations support a standard and reasonably high minimum number of keys per MediaKeySession object, including a standard replacement algorithm... This enables a reasonable number of key rotation algorithms to be implemented across user agents and may reduce the likelihood of playback interruptions in use cases that involve various streams in the same element (e.g., adaptive streams, various audio and video tracks) using different keys."
However, the term "replacement algorithm" is not defined anywhere in the current specification. This makes it ambiguous for implementers and the behavior unpredictable for web developers.
Historical Context
The related text existed in the first commit of the EME spec in 2012 (8f067598985f3c8dc3832482626537a8f98e74b7). From the text, it seems that it's for the case that a key for a key ID already existed, and we need to replace that key when update() is called. The following is the quote from the initial EME draft (converted from xml):
If key contains a key or license, store the key.
- Let
key ID be null.
- If
sessionId is not null and refers to a session with Initialization Data that contains a key ID, let key ID be that ID.
- If
key is not null and contains a key ID, let key ID be that ID.
- If
initData is not null and contains a key ID, let key ID be that ID.
- Store the key by following the steps for the first matching condition from the following list:
- If
key ID is not null:
- Clear any key not associated with a key ID.
- If a key already exists for
key ID, delete that element.
- Store the key and/or license in
key indexed by key ID. The replacement algorithm is Key System-dependent.
- Otherwise:
- Clear all stored keys.
- Store the key and/or license in
key with no associated key ID.
Notes: It is recommended that CDM providers support a standard and reasonably high minimum number of cached keys/licenses (with IDs) per media element as well as a standard replacement algorithm. This enables a reasonable number of key rotation algorithms to be implemented across user agents and may reduce the likelihood of playback interruptions in use cases that involve various streams in the same element, such as adaptive streams or various audio and video tracks using different keys.
The Problem
Because this context is now buried in decade-old commits, mailing lists and issue threads, the current spec text is confusing.
It's unclear whether "replacement" simply means overwriting a key with the same key ID, as the text suggested, or some eviction algorithm which is related to "reasonably high minimum number of cached keys/licenses" and "key rotation".
I'd suggest the working group to discuss this and update the notes to make it clear and better matching the current update() algorithm.
Description
The EME specification currently mentions a "replacement algorithm" in the notes for the
update()method (https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-update):However, the term "replacement algorithm" is not defined anywhere in the current specification. This makes it ambiguous for implementers and the behavior unpredictable for web developers.
Historical Context
The related text existed in the first commit of the EME spec in 2012 (8f067598985f3c8dc3832482626537a8f98e74b7). From the text, it seems that it's for the case that a key for a key ID already existed, and we need to replace that key when update() is called. The following is the quote from the initial EME draft (converted from xml):
The Problem
Because this context is now buried in decade-old commits, mailing lists and issue threads, the current spec text is confusing.
It's unclear whether "replacement" simply means overwriting a key with the same key ID, as the text suggested, or some eviction algorithm which is related to "reasonably high minimum number of cached keys/licenses" and "key rotation".
I'd suggest the working group to discuss this and update the notes to make it clear and better matching the current
update()algorithm.