Skip to content

Commit ee7d7b1

Browse files
addressing review feedback
1 parent ec8db99 commit ee7d7b1

File tree

1 file changed

+52
-38
lines changed

1 file changed

+52
-38
lines changed

index.bs

Lines changed: 52 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -708,10 +708,12 @@ Each {{BaseAudioContext}} has a unique
708708
media element event task source</a>.
709709
Additionally, a {{BaseAudioContext}} has several private slots <dfn attribute
710710
for="BaseAudioContext">[[rendering thread state]]</dfn> and <dfn attribute
711-
for="BaseAudioContext">[[control thread state]]</dfn> that take values from
712-
{{AudioContextState}}, and that are both initially set to <code>"suspended"
713-
</code>, and a private slot <dfn attribute for="BaseAudioContext">
714-
[[render quantum size]]</dfn> that is an unsigned integer.
711+
for="BaseAudioContext">[[control thread state]]</dfn> that take values
712+
from {{AudioContextState}}, and that are both initially set to <code>"suspended"
713+
</code>, <dfn attribute for="BaseAudioContext">[[interrupt end return state]]
714+
</dfn> that also take values from {{AudioContextState}} and is initially set to
715+
`null` and a private slot <dfn attribute for="BaseAudioContext">[[render quantum
716+
size]]</dfn> that is an unsigned integer.
715717

716718
<pre class="idl">
717719
enum AudioContextState {
@@ -1549,6 +1551,8 @@ Constructors</h4>
15491551

15501552
1. Set a {{[[rendering thread state]]}} to <code>suspended</code> on
15511553
|context|.
1554+
1555+
1. Set {{[[interrupt end return state]]}} to `null` on |context|.
15521556

15531557
1. Let |messageChannel| be a new {{MessageChannel}}.
15541558

@@ -1983,15 +1987,19 @@ Methods</h4>
19831987
returning <var>promise</var>.
19841988

19851989
1. Set {{[[suspended by user]]}} to <code>false</code>.
1990+
1991+
1. If the context's {{BaseAudioContext/state}} attribute is
1992+
"{{AudioContextState/suspended}}" and the context's
1993+
{{[[control thread state]]}} is
1994+
"{{AudioContextState/interrupted}}", then:
19861995

1987-
1. If the {{[[control thread state]]}} on the {{AudioContext}} is
1988-
<code>suspended</code> and there is an ongoing
1989-
[=interruption=]:
1990-
1991-
1. Queue a media element task</a> to execute the following steps:
1996+
1. <a>Queue a media element task</a> to execute the following steps:
19921997

19931998
1. Set the {{BaseAudioContext/state}} attribute of the
19941999
{{AudioContext}} to "{{AudioContextState/interrupted}}".
2000+
2001+
1. Set the {{[[interrupt end return state]]}} slot to
2002+
"{{AudioContextState/running}}".
19952003

19962004
1. [=Queue a media element task=] to [=fire an event=] named
19972005
{{BaseAudioContext/statechange}} at the {{AudioContext}}.
@@ -2104,14 +2112,19 @@ Methods</h4>
21042112

21052113
1. Attempt to <a>release system resources</a>.
21062114

2107-
2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to <code>suspended</code>.
2115+
1. If the {{[[rendering thread state]]}} on the {{AudioContext}} is
2116+
"{{AudioContextState/interrupted}}", <a>queue a media element
2117+
task</a> to set the {{[[interrupt end return state]]}} slot to
2118+
"{{AudioContextState/suspended}}".
21082119

2109-
3. <a href="https://html.spec.whatwg.org/multipage/media.html#queue-a-media-element-task">
2110-
queue a media element task</a> to execute the following steps:
2120+
1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
2121+
"{{AudioContextState/suspended}}".
2122+
2123+
1. <a>Queue a media element task</a> to execute the following steps:
21112124

21122125
1. Resolve <em>promise</em>.
21132126

2114-
2. If the {{BaseAudioContext/state}}
2127+
1. If the {{BaseAudioContext/state}}
21152128
attribute of the {{AudioContext}} is not already "{{AudioContextState/suspended}}":
21162129

21172130
1. Set the {{BaseAudioContext/state}} attribute of the {{AudioContext}} to "{{AudioContextState/suspended}}".
@@ -12121,70 +12134,69 @@ to halt audio playback for an {{AudioContext}}. For example, The user agent may
1212112134
create an interruption when another application requests exclusive access to the
1212212135
audio output hardware.
1212312136

12124-
When an [=interruption=] happens, the user agent must <a>queue a control message</a>
12137+
When an [=interruption=] happens, the user agent MUST <a>queue a control message</a>
1212512138
to interrupt the {{AudioContext}}.
1212612139

1212712140
Running a <a>control message</a> to <dfn attribute for="AudioContext"
1212812141
lt="interruption-start">interrupt an {{AudioContext}}</dfn> |context|
1212912142
means running these steps on the <a>rendering thread</a>:
1213012143

12131-
1. If the |context|'s {{[[rendering thread state]]}} is <code>closed</code>
12132-
or <code>interrupted</code>:
12133-
12134-
1. Abort these steps.
12144+
1. If the |context|'s {{[[rendering thread state]]}} is
12145+
{{AudioContextState/closed}} or {{AudioContextState/interrupted}}, abort
12146+
these steps.
1213512147

1213612148
1. If the |context|'s {{[[rendering thread state]]}} is
12137-
<code>running</code>:
12149+
{{AudioContextState/running}}:
1213812150

1213912151
1. Attempt to <a>release system resources</a>.
1214012152

1214112153
1. [=Queue a media element task=] to execute the following steps:
1214212154

1214312155
1. Set the |context|'s {{[[control thread state]]}} to
12144-
<code>interrupted</code>.
12156+
{{AudioContextState/interrupted}}.
12157+
12158+
1. Set the |context|'s {{[[interrupt end return state]]}} slot to
12159+
"{{AudioContextState/running}}".
1214512160

1214612161
1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the
1214712162
|context|.
1214812163

1214912164
1. If the |context|'s {{[[rendering thread state]]}} is
12150-
<code>suspended</code>:
12165+
{{AudioContextState/suspended}}:
1215112166

1215212167
1. [=Queue a media element task=] to execute the following steps:
1215312168

1215412169
1. Set the |context|'s {{[[control thread state]]}} to
12155-
<code>interrupted</code>.
12170+
{{AudioContextState/interrupted}}.
12171+
12172+
1. Set the |context|'s {{[[interrupt end return state]]}} slot to
12173+
"{{AudioContextState/suspended}}".
1215612174

1215712175
1. Set the |context|'s {{[[rendering thread state]]}} to
12158-
<code>interrupted</code>.
12176+
{{AudioContextState/interrupted}}.
1215912177

12160-
Note: If the {{AudioContext}} is <code>suspended</code> a
12178+
Note: If the {{AudioContext}} is {{AudioContextState/suspended}} a
1216112179
{{BaseAudioContext/statechange}} event is not fired for privacy reasons to avoid
1216212180
over-sharing user activity - e.g. when a phone call comes in or when the screen
1216312181
gets locked.
1216412182

12165-
When an [=interruption=] ends, the user agent must <a>queue a control message</a>
12183+
When an [=interruption=] ends, the user agent MUST <a>queue a control message</a>
1216612184
to <dfn attribute for="AudioContext" lt="interruption-end">end the
1216712185
{{AudioContext}} interruption</dfn>.
1216812186

12169-
<dfn lt="linear PCM">Linear pulse code modulation</dfn>
12170-
1217112187
Running a <a>control message</a> to end an {{AudioContext}} |context|
1217212188
[=interruption=] means running these steps on the <a>rendering thread</a>:
1217312189

1217412190
1. If the |context|'s {{[[rendering thread state]]}} is not
12175-
<code>interrupted</code>:
12191+
{{AudioContextState/interrupted}}, abort these steps.
1217612192

12177-
1. Abort these steps.
12178-
12179-
1. If the |context|'s {{[[rendering thread state]]}} was
12180-
<code>running</code> before the [=interruption=] or if the the
12181-
|context|'s {{[[rendering thread state]]}} was <code>suspended</code>
12182-
and {{AudioContext/resume}} was called during the [=interruption=]:
12193+
1. If the |context|'s {{[[interrupt end return state]]}} is
12194+
"{{AudioContextState/running}}":
1218312195

1218412196
1. Attempt to <a href="#acquiring">acquire system resources</a>.
1218512197

1218612198
1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
12187-
<code>running</code>.
12199+
"{{AudioContextState/running}}".
1218812200

1218912201
1. Start <a href="#rendering-loop">rendering the audio graph</a>.
1219012202

@@ -12194,13 +12206,13 @@ Running a <a>control message</a> to end an {{AudioContext}} |context|
1219412206
is not already "{{AudioContextState/running}}":
1219512207

1219612208
1. Set the |context|'s {{[[control thread state]]}} to
12197-
<code>running</code>.
12209+
"{{AudioContextState/running}}".
1219812210

1219912211
1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the
1220012212
|context|.
1220112213

12202-
1. If the |context|'s {{[[rendering thread state]]}} was
12203-
<code>suspended</code> before the [=interruption=]:
12214+
1. If the |context|'s {{[[interrupt end return state]]}} is
12215+
"{{AudioContextState/suspended}}"
1220412216

1220512217
1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
1220612218
<code>suspended</code>.
@@ -12210,6 +12222,8 @@ Running a <a>control message</a> to end an {{AudioContext}} |context|
1221012222
1. Set the |context|'s {{[[control thread state]]}} to
1221112223
<code>suspended</code>.
1221212224

12225+
1. Set the |context|'s {{[[interrupt end return state]]}} to `null`.
12226+
1221312227
<h3 id="error-handling-on-a-running-audio-context">
1221412228
Handling an error from System Audio Resources on the {{AudioContext}}</h3>
1221512229

0 commit comments

Comments
 (0)