[EME] Bug 24322 - Move algorithms to their respective objects.
authorDavid Dorwin <ddorwin@google.com>
Wed, 03 Sep 2014 17:03:13 -0700
changeset 417 47d3c7f7d622
parent 416 ebef3677efce
child 418 38c065b1c4d7
[EME] Bug 24322 - Move algorithms to their respective objects.
encrypted-media/encrypted-media.html
encrypted-media/encrypted-media.xml
--- a/encrypted-media/encrypted-media.html	Wed Sep 03 17:02:42 2014 -0700
+++ b/encrypted-media/encrypted-media.html	Wed Sep 03 17:03:13 2014 -0700
@@ -956,6 +956,71 @@
 
     <h3 id="mediakeysession-algorithms">Algorithms</h3>
 
+    <h4 id="algorithms-queue-message">Queue a "message" Event</h4>
+    <p>The Queue a "message" Event algorithm is run when the CDM needs to queue a message event to a <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.
+    Requests to run this algorithm include a target <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object, a <var title="true">request</var>, and a <var title="true">destination URL</var>.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the specified <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
+      <li>
+        <p><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-eventmessage">message</a></code> at the <var title="true">session</var>.</p>
+        <p>The event is of type <code><a href="#dom-mediakeymessageevent">MediaKeyMessageEvent</a></code> and has:</p>
+        <ul style="list-style-type:none"><li>
+          <code><a href="#dom-message">message</a></code> = the specified <var title="true">request</var><br>
+          <code><a href="#dom-destinationurl">destinationURL</a></code> = the specified <var title="true">destination URL</var>
+        </li></ul>
+      </li>
+    </ol>
+
+    <h4 id="algorithms-queue-error">Queue an "error" Event</h4>
+    <div class="issue">
+<div class="issue-title"><span>Issue 2</span></div>
+<p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=26372">Bug 26372</a> - There is currently no mechanism for reporting errors and other events not related to a specific method call.</p>
+</div>
+
+    <h4 id="algorithms-keys-changed">Usable Keys Changed</h4>
+    <p>The Usable Keys Changed algorithm is run when the CDM changes the set of keys in the session that may be used for decryption.
+    This can happen as the result of an <code><a href="#dom-update">update()</a></code> call or some other event.
+    Requests to run this algorithm include a target <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the associated <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
+      <li><p><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-eventkeyschange">keyschange</a></code> at the <var title="true">session</var>.</p></li>
+      <li>
+<p><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to run the <a href="#algorithms-resume-playback">Attempt to Resume Playback If Necessary</a> algorithm on each of the <a href="#media-element">media element(s)</a> whose <code><a href="#dom-attrmediakeys">mediaKeys</a></code> attribute is the MediaKeys object that created the <var title="true">session</var>.</p>
+        <p>The user agent may choose to skip this step if it knows resuming will fail <span class="non-normative">(i.e. no additional keys became available)</span>.</p>
+      </li>
+    </ol>
+
+    <h4 id="algorithms-update-expiration">Update Expiration</h4>
+    <p>The Update Expiration algorithm is run when the CDM changes the expiration time of a session.
+    This can happen as the result of an <code><a href="#dom-update">update()</a></code> call or some other event.
+    Requests to run this algorithm include a target <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object and the new expiration time, which may be <code>NaN</code>.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the associated <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
+      <li><p>Let <var title="true">expiration time</var> be <code>NaN</code>.</p></li>
+      <li><p>If the new expiration time is not <code>NaN</code>, let <var title="true">expiration time</var> be the new expiration time in milliseconds since 01 January 1970 UTC.</p></li>
+      <li><p>Set the <var title="true">session</var>'s <code><a href="#dom-expiration">expiration</a></code> attribute to <var title="true">expiration time</var>.</p></li>
+    </ol>
+
+    <h4 id="algorithms-session-close">Session Close</h4>
+    <p>The Session Close algorithm is run when the CDM closes the session associated with a <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p>
+    <p class="non-normative">The CDM may close a session at any point, such as in response to a <code><a href="#dom-close">close()</a></code> call, when the session is no longer needed, or when system resources are lost.
+    Keys in other sessions should be unaffected, even if they have overlapping key IDs.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the associated <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
+      <li><p>Let <var title="true">media keys</var> be the <code><a href="#dom-mediakeys">MediaKeys</a></code> object that created this object.</p></li>
+      <li><p>Remove the entry for the value of the <var title="true">session</var>'s <code><a href="#dom-sessionid">sessionId</a></code> attribute from <var title="true">media keys</var>'s <var title="true">list of active session IDs</var>.</p></li>
+      <li><p>Let <var>promise</var> be the <code><a href="#dom-closed">closed</a></code> attribute of the <var title="true">session</var>.</p></li>
+      <li><p>Resolve <var>promise</var>.</p></li>
+    </ol>
+
 
     <h2 id="htmlmediaelement-extensions">HTMLMediaElement Extensions</h2>
     <p>This section specifies additions to and modifications of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlmediaelement">HTMLMediaElement</a> when the Encrypted Media Extensions are supported.</p>
@@ -1039,10 +1104,7 @@
 
     <h3 id="htmlmediaelement-algorithms">Algorithms</h3>
 
-
-    <h2 id="algorithms">4. Algorithms</h2>
-
-    <h3 id="algorithms-initdata-encountered">4.1. Initialization Data Encountered</h3>
+    <h4 id="algorithms-initdata-encountered">Initialization Data Encountered</h4>
     <p>The following steps are run when the <a href="#media-element">media element</a> encounters <a href="#initialization-data">Initialization Data</a> in the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-data">media data</a> during the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>:</p>
 
     <ol>
@@ -1069,7 +1131,7 @@
       <li><p><i>Continue Normal Flow</i>: Continue with the existing media element's <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>.</p></li>
     </ol>
 
-    <h3 id="algorithms-encrypted-block">4.2. Encrypted Block Encountered</h3>
+    <h4 id="algorithms-encrypted-block">Encrypted Block Encountered</h4>
     <p>The following steps are run when the <a href="#media-element">media element</a> encounters a block <span class="non-normative">(i.e. frame)</span> of encrypted <a href="http://www.w3.org/TR/html5/embedded-content-0.html#media-data">media data</a> during the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#concept-media-load-resource">resource fetch algorithm</a>:</p>
 
     <ol>
@@ -1169,72 +1231,7 @@
       <li>If a readyState change queues a task to fire a <code><a href="http://www.w3.org/TR/html5/embedded-content-0.html#event-media-canplay">canplay</a></code> event, the user agent must also set the <code><a href="#dom-waitingfor">waitingFor</a></code> attribute on the Media Element to "<code><a href="#dom-waitingfornone">none</a></code>".</li>
     </ul>
 
-    <h3 id="algorithms-queue-message">4.3. Queue a "message" Event</h3>
-    <p>The Queue a "message" Event algorithm is run when the CDM needs to queue a message event to a <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.
-    Requests to run this algorithm include a target <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object, a <var title="true">request</var>, and a <var title="true">destination URL</var>.
-    </p>
-    <p>The following steps are run:</p>
-    <ol>
-      <li><p>Let the <var title="true">session</var> be the specified <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
-      <li>
-        <p><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-eventmessage">message</a></code> at the <var title="true">session</var>.</p>
-        <p>The event is of type <code><a href="#dom-mediakeymessageevent">MediaKeyMessageEvent</a></code> and has:</p>
-        <ul style="list-style-type:none"><li>
-          <code><a href="#dom-message">message</a></code> = the specified <var title="true">request</var><br>
-          <code><a href="#dom-destinationurl">destinationURL</a></code> = the specified <var title="true">destination URL</var>
-        </li></ul>
-      </li>
-    </ol>
-
-    <h3 id="algorithms-queue-error">4.4. Queue an "error" Event</h3>
-    <div class="issue">
-<div class="issue-title"><span>Issue 2</span></div>
-<p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=26372">Bug 26372</a> - There is currently no mechanism for reporting errors and other events not related to a specific method call.</p>
-</div>
-
-    <h3 id="algorithms-keys-changed">4.5. Usable Keys Changed</h3>
-    <p>The Usable Keys Changed algorithm is run when the CDM changes the set of keys in the session that may be used for decryption.
-    This can happen as the result of an <code><a href="#dom-update">update()</a></code> call or some other event.
-    Requests to run this algorithm include a target <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.
-    </p>
-    <p>The following steps are run:</p>
-    <ol>
-      <li><p>Let the <var title="true">session</var> be the associated <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
-      <li><p><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to <a href="http://www.w3.org/TR/html5/webappapis.html#fire-a-simple-event">fire a simple event</a> named <code><a href="#dom-eventkeyschange">keyschange</a></code> at the <var title="true">session</var>.</p></li>
-      <li>
-<p><a href="http://www.w3.org/TR/html5/webappapis.html#queue-a-task">Queue a task</a> to run the <a href="#algorithms-resume-playback">Attempt to Resume Playback If Necessary</a> algorithm on each of the <a href="#media-element">media element(s)</a> whose <code><a href="#dom-attrmediakeys">mediaKeys</a></code> attribute is the MediaKeys object that created the <var title="true">session</var>.</p>
-        <p>The user agent may choose to skip this step if it knows resuming will fail <span class="non-normative">(i.e. no additional keys became available)</span>.</p>
-      </li>
-    </ol>
-
-    <h3 id="algorithms-update-expiration">4.6. Update Expiration</h3>
-    <p>The Update Expiration algorithm is run when the CDM changes the expiration time of a session.
-    This can happen as the result of an <code><a href="#dom-update">update()</a></code> call or some other event.
-    Requests to run this algorithm include a target <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object and the new expiration time, which may be <code>NaN</code>.
-    </p>
-    <p>The following steps are run:</p>
-    <ol>
-      <li><p>Let the <var title="true">session</var> be the associated <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
-      <li><p>Let <var title="true">expiration time</var> be <code>NaN</code>.</p></li>
-      <li><p>If the new expiration time is not <code>NaN</code>, let <var title="true">expiration time</var> be the new expiration time in milliseconds since 01 January 1970 UTC.</p></li>
-      <li><p>Set the <var title="true">session</var>'s <code><a href="#dom-expiration">expiration</a></code> attribute to <var title="true">expiration time</var>.</p></li>
-    </ol>
-
-    <h3 id="algorithms-session-close">4.7. Session Close</h3>
-    <p>The Session Close algorithm is run when the CDM closes the session associated with a <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p>
-    <p class="non-normative">The CDM may close a session at any point, such as in response to a <code><a href="#dom-close">close()</a></code> call, when the session is no longer needed, or when system resources are lost.
-    Keys in other sessions should be unaffected, even if they have overlapping key IDs.
-    </p>
-    <p>The following steps are run:</p>
-    <ol>
-      <li><p>Let the <var title="true">session</var> be the associated <code><a href="#dom-mediakeysession">MediaKeySession</a></code> object.</p></li>
-      <li><p>Let <var title="true">media keys</var> be the <code><a href="#dom-mediakeys">MediaKeys</a></code> object that created this object.</p></li>
-      <li><p>Remove the entry for the value of the <var title="true">session</var>'s <code><a href="#dom-sessionid">sessionId</a></code> attribute from <var title="true">media keys</var>'s <var title="true">list of active session IDs</var>.</p></li>
-      <li><p>Let <var>promise</var> be the <code><a href="#dom-closed">closed</a></code> attribute of the <var title="true">session</var>.</p></li>
-      <li><p>Resolve <var>promise</var>.</p></li>
-    </ol>
-
-    <h3 id="algorithms-queue-waiting">4.8. Queue a "waiting" Event</h3>
+    <h4 id="algorithms-queue-waiting">Queue a "waiting" Event</h4>
     <p>The Queue a "waiting" Event algorithm is run when the CDM needs to queue a waiting event to a <code><a href="#dom-htmlmediaelement">HTMLMediaElement</a></code> object.
     Requests to run this algorithm include a target <code><a href="#dom-htmlmediaelement">HTMLMediaElement</a></code> object.
     </p>
@@ -1251,7 +1248,7 @@
       <li><p>Suspend playback.</p></li>
     </ol>
 
-    <h3 id="algorithms-resume-playback">4.9. Attempt to Resume Playback If Necessary</h3>
+    <h4 id="algorithms-resume-playback">Attempt to Resume Playback If Necessary</h4>
     <p>The Attempt to Resume Playback If Necessary algorithm is run when one or more keys becomes available.
     If playback is blocked waiting for a key, it resumes playback if a necessary key has been provided.
     Requests to run this algorithm include a target <code><a href="#dom-htmlmediaelement">HTMLMediaElement</a></code> object.
--- a/encrypted-media/encrypted-media.xml	Wed Sep 03 17:02:42 2014 -0700
+++ b/encrypted-media/encrypted-media.xml	Wed Sep 03 17:03:13 2014 -0700
@@ -943,6 +943,67 @@
 
     <h3 id="mediakeysession-algorithms">Algorithms</h3>
 
+    <h4 id="algorithms-queue-message">Queue a "message" Event</h4>
+    <p>The Queue a "message" Event algorithm is run when the CDM needs to queue a message event to a <coderef>MediaKeySession</coderef> object.
+    Requests to run this algorithm include a target <coderef>MediaKeySession</coderef> object, a <var title="true">request</var>, and a <var title="true">destination URL</var>.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the specified <coderef>MediaKeySession</coderef> object.</p></li>
+      <li>
+        <p><Queue-a-task/> to <fire-a-simple-event/> named <coderef prefix="event">message</coderef> at the <var title="true">session</var>.</p>
+        <p>The event is of type <coderef>MediaKeyMessageEvent</coderef> and has:</p>
+        <ul style="list-style-type:none"><li>
+          <coderef>message</coderef> = the specified <var title="true">request</var><br></br>
+          <coderef>destinationURL</coderef> = the specified <var title="true">destination URL</var>
+        </li></ul>
+      </li>
+    </ol>
+
+    <h4 id="algorithms-queue-error">Queue an "error" Event</h4>
+    <div class="issue"><div class="issue-title"><span>Issue 2</span></div><p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=26372">Bug 26372</a> - There is currently no mechanism for reporting errors and other events not related to a specific method call.</p></div>
+
+    <h4 id="algorithms-keys-changed">Usable Keys Changed</h4>
+    <p>The Usable Keys Changed algorithm is run when the CDM changes the set of keys in the session that may be used for decryption.
+    This can happen as the result of an <methodref>update</methodref> call or some other event.
+    Requests to run this algorithm include a target <coderef>MediaKeySession</coderef> object.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the associated <coderef>MediaKeySession</coderef> object.</p></li>
+      <li><p><Queue-a-task/> to <fire-a-simple-event/> named <coderef prefix="event">keyschange</coderef> at the <var title="true">session</var>.</p></li>
+      <li><p><Queue-a-task/> to run the <a href="#algorithms-resume-playback">Attempt to Resume Playback If Necessary</a> algorithm on each of the <a href="#media-element">media element(s)</a> whose <coderef prefix="attr">mediaKeys</coderef> attribute is the MediaKeys object that created the <var title="true">session</var>.</p>
+        <p>The user agent may choose to skip this step if it knows resuming will fail <span class="non-normative">(i.e. no additional keys became available)</span>.</p>
+      </li>
+    </ol>
+
+    <h4 id="algorithms-update-expiration">Update Expiration</h4>
+    <p>The Update Expiration algorithm is run when the CDM changes the expiration time of a session.
+    This can happen as the result of an <methodref>update</methodref> call or some other event.
+    Requests to run this algorithm include a target <coderef>MediaKeySession</coderef> object and the new expiration time, which may be <code>NaN</code>.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the associated <coderef>MediaKeySession</coderef> object.</p></li>
+      <li><p>Let <var title="true">expiration time</var> be <code>NaN</code>.</p></li>
+      <li><p>If the new expiration time is not <code>NaN</code>, let <var title="true">expiration time</var> be the new expiration time in milliseconds since 01 January 1970 UTC.</p></li>
+      <li><p>Set the <var title="true">session</var>'s <coderef>expiration</coderef> attribute to <var title="true">expiration time</var>.</p></li>
+    </ol>
+
+    <h4 id="algorithms-session-close">Session Close</h4>
+    <p>The Session Close algorithm is run when the CDM closes the session associated with a <coderef>MediaKeySession</coderef> object.</p>
+    <p class="non-normative">The CDM may close a session at any point, such as in response to a <methodref>close</methodref> call, when the session is no longer needed, or when system resources are lost.
+    Keys in other sessions should be unaffected, even if they have overlapping key IDs.
+    </p>
+    <p>The following steps are run:</p>
+    <ol>
+      <li><p>Let the <var title="true">session</var> be the associated <coderef>MediaKeySession</coderef> object.</p></li>
+      <li><p>Let <var title="true">media keys</var> be the <coderef>MediaKeys</coderef> object that created this object.</p></li>
+      <li><p>Remove the entry for the value of the <var title="true">session</var>'s <coderef>sessionId</coderef> attribute from <var title="true">media keys</var>'s <var title="true">list of active session IDs</var>.</p></li>
+      <li><p>Let <var>promise</var> be the <coderef>closed</coderef> attribute of the <var title="true">session</var>.</p></li>
+      <li><p>Resolve <var>promise</var>.</p></li>
+    </ol>
+
 
     <h2 id="htmlmediaelement-extensions">HTMLMediaElement Extensions</h2>
     <p>This section specifies additions to and modifications of the <a href="http://www.w3.org/TR/html5/embedded-content-0.html#htmlmediaelement">HTMLMediaElement</a> when the Encrypted Media Extensions are supported.</p>
@@ -1021,10 +1082,7 @@
 
     <h3 id="htmlmediaelement-algorithms">Algorithms</h3>
 
-
-    <h2 id="algorithms">4. Algorithms</h2>
-
-    <h3 id="algorithms-initdata-encountered">4.1. Initialization Data Encountered</h3>
+    <h4 id="algorithms-initdata-encountered">Initialization Data Encountered</h4>
     <p>The following steps are run when the <a href="#media-element">media element</a> encounters <a href="#initialization-data">Initialization Data</a> in the <videoanchor name="media-data">media data</videoanchor> during the <resource-fetch-algorithm/>:</p>
 
     <ol>
@@ -1051,7 +1109,7 @@
       <li><p><i>Continue Normal Flow</i>: Continue with the existing media element's <resource-fetch-algorithm/>.</p></li>
     </ol>
 
-    <h3 id="algorithms-encrypted-block">4.2. Encrypted Block Encountered</h3>
+    <h4 id="algorithms-encrypted-block">Encrypted Block Encountered</h4>
     <p>The following steps are run when the <a href="#media-element">media element</a> encounters a block <span class="non-normative">(i.e. frame)</span> of encrypted <videoanchor name="media-data">media data</videoanchor> during the <resource-fetch-algorithm/>:</p>
 
     <ol>
@@ -1144,68 +1202,7 @@
       <li>If a readyState change queues a task to fire a <videoref name="event-media-canplay">canplay</videoref> event, the user agent must also set the <coderef>waitingFor</coderef> attribute on the Media Element to "<coderef prefix="waitingfor">none</coderef>".</li>
     </ul>
 
-    <h3 id="algorithms-queue-message">4.3. Queue a "message" Event</h3>
-    <p>The Queue a "message" Event algorithm is run when the CDM needs to queue a message event to a <coderef>MediaKeySession</coderef> object.
-    Requests to run this algorithm include a target <coderef>MediaKeySession</coderef> object, a <var title="true">request</var>, and a <var title="true">destination URL</var>.
-    </p>
-    <p>The following steps are run:</p>
-    <ol>
-      <li><p>Let the <var title="true">session</var> be the specified <coderef>MediaKeySession</coderef> object.</p></li>
-      <li>
-        <p><Queue-a-task/> to <fire-a-simple-event/> named <coderef prefix="event">message</coderef> at the <var title="true">session</var>.</p>
-        <p>The event is of type <coderef>MediaKeyMessageEvent</coderef> and has:</p>
-        <ul style="list-style-type:none"><li>
-          <coderef>message</coderef> = the specified <var title="true">request</var><br></br>
-          <coderef>destinationURL</coderef> = the specified <var title="true">destination URL</var>
-        </li></ul>
-      </li>
-    </ol>
-
-    <h3 id="algorithms-queue-error">4.4. Queue an "error" Event</h3>
-    <div class="issue"><div class="issue-title"><span>Issue 2</span></div><p class=""><a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=26372">Bug 26372</a> - There is currently no mechanism for reporting errors and other events not related to a specific method call.</p></div>
-
-    <h3 id="algorithms-keys-changed">4.5. Usable Keys Changed</h3>
-    <p>The Usable Keys Changed algorithm is run when the CDM changes the set of keys in the session that may be used for decryption.
-    This can happen as the result of an <methodref>update</methodref> call or some other event.
-    Requests to run this algorithm include a target <coderef>MediaKeySession</coderef> object.
-    </p>
-    <p>The following steps are run:</p>
-    <ol>
-      <li><p>Let the <var title="true">session</var> be the associated <coderef>MediaKeySession</coderef> object.</p></li>
-      <li><p><Queue-a-task/> to <fire-a-simple-event/> named <coderef prefix="event">keyschange</coderef> at the <var title="true">session</var>.</p></li>
-      <li><p><Queue-a-task/> to run the <a href="#algorithms-resume-playback">Attempt to Resume Playback If Necessary</a> algorithm on each of the <a href="#media-element">media element(s)</a> whose <coderef prefix="attr">mediaKeys</coderef> attribute is the MediaKeys object that created the <var title="true">session</var>.</p>
-        <p>The user agent may choose to skip this step if it knows resuming will fail <span class="non-normative">(i.e. no additional keys became available)</span>.</p>
-      </li>
-    </ol>
-
-    <h3 id="algorithms-update-expiration">4.6. Update Expiration</h3>
-    <p>The Update Expiration algorithm is run when the CDM changes the expiration time of a session.
-    This can happen as the result of an <methodref>update</methodref> call or some other event.
-    Requests to run this algorithm include a target <coderef>MediaKeySession</coderef> object and the new expiration time, which may be <code>NaN</code>.
-    </p>
-    <p>The following steps are run:</p>
-    <ol>
-      <li><p>Let the <var title="true">session</var> be the associated <coderef>MediaKeySession</coderef> object.</p></li>
-      <li><p>Let <var title="true">expiration time</var> be <code>NaN</code>.</p></li>
-      <li><p>If the new expiration time is not <code>NaN</code>, let <var title="true">expiration time</var> be the new expiration time in milliseconds since 01 January 1970 UTC.</p></li>
-      <li><p>Set the <var title="true">session</var>'s <coderef>expiration</coderef> attribute to <var title="true">expiration time</var>.</p></li>
-    </ol>
-
-    <h3 id="algorithms-session-close">4.7. Session Close</h3>
-    <p>The Session Close algorithm is run when the CDM closes the session associated with a <coderef>MediaKeySession</coderef> object.</p>
-    <p class="non-normative">The CDM may close a session at any point, such as in response to a <methodref>close</methodref> call, when the session is no longer needed, or when system resources are lost.
-    Keys in other sessions should be unaffected, even if they have overlapping key IDs.
-    </p>
-    <p>The following steps are run:</p>
-    <ol>
-      <li><p>Let the <var title="true">session</var> be the associated <coderef>MediaKeySession</coderef> object.</p></li>
-      <li><p>Let <var title="true">media keys</var> be the <coderef>MediaKeys</coderef> object that created this object.</p></li>
-      <li><p>Remove the entry for the value of the <var title="true">session</var>'s <coderef>sessionId</coderef> attribute from <var title="true">media keys</var>'s <var title="true">list of active session IDs</var>.</p></li>
-      <li><p>Let <var>promise</var> be the <coderef>closed</coderef> attribute of the <var title="true">session</var>.</p></li>
-      <li><p>Resolve <var>promise</var>.</p></li>
-    </ol>
-
-    <h3 id="algorithms-queue-waiting">4.8. Queue a "waiting" Event</h3>
+    <h4 id="algorithms-queue-waiting">Queue a "waiting" Event</h4>
     <p>The Queue a "waiting" Event algorithm is run when the CDM needs to queue a waiting event to a <coderef>HTMLMediaElement</coderef> object.
     Requests to run this algorithm include a target <coderef>HTMLMediaElement</coderef> object.
     </p>
@@ -1221,7 +1218,7 @@
       <li><p>Suspend playback.</p></li>
     </ol>
 
-    <h3 id="algorithms-resume-playback">4.9. Attempt to Resume Playback If Necessary</h3>
+    <h4 id="algorithms-resume-playback">Attempt to Resume Playback If Necessary</h4>
     <p>The Attempt to Resume Playback If Necessary algorithm is run when one or more keys becomes available.
     If playback is blocked waiting for a key, it resumes playback if a necessary key has been provided.
     Requests to run this algorithm include a target <coderef>HTMLMediaElement</coderef> object.