Skip to content

Commit 7cd94d7

Browse files
addressing review feedback
1 parent ec8db99 commit 7cd94d7

File tree

1 file changed

+52
-34
lines changed

1 file changed

+52
-34
lines changed

index.bs

Lines changed: 52 additions & 34 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

@@ -1987,11 +1991,19 @@ Methods</h4>
19871991
1. If the {{[[control thread state]]}} on the {{AudioContext}} is
19881992
<code>suspended</code> and there is an ongoing
19891993
[=interruption=]:
1994+
1995+
1. If the context's {{BaseAudioContext/state}} attribute is
1996+
"{{AudioContextState/suspended}}" and the context's
1997+
{{[[control thread state]]}} is
1998+
"{{AudioContextState/interrupted}}", then:
19901999

1991-
1. Queue a media element task</a> to execute the following steps:
2000+
1. <a>Queue a media element task</a> to execute the following steps:
19922001

19932002
1. Set the {{BaseAudioContext/state}} attribute of the
19942003
{{AudioContext}} to "{{AudioContextState/interrupted}}".
2004+
2005+
1. Set the {{[[interrupt end return state]]}} slot to
2006+
"{{AudioContextState/running}}".
19952007

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

21052117
1. Attempt to <a>release system resources</a>.
21062118

2107-
2. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to <code>suspended</code>.
2119+
1. If the {{[[rendering thread state]]}} on the {{AudioContext}} is
2120+
"{{AudioContextState/interrupted}}", <a>queue a media element
2121+
task</a> to set the {{[[interrupt end return state]]}} slot to
2122+
"{{AudioContextState/suspended}}".
21082123

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:
2124+
1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
2125+
"{{AudioContextState/suspended}}".
2126+
2127+
1. <a>Queue a media element task</a> to execute the following steps:
21112128

21122129
1. Resolve <em>promise</em>.
21132130

2114-
2. If the {{BaseAudioContext/state}}
2131+
1. If the {{BaseAudioContext/state}}
21152132
attribute of the {{AudioContext}} is not already "{{AudioContextState/suspended}}":
21162133

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

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

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

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

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

1213912155
1. Attempt to <a>release system resources</a>.
1214012156

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

1214312159
1. Set the |context|'s {{[[control thread state]]}} to
12144-
<code>interrupted</code>.
12160+
{{AudioContextState/interrupted}}.
12161+
12162+
1. Set the |context|'s {{[[interrupt end return state]]}} slot to
12163+
"{{AudioContextState/running}}".
1214512164

1214612165
1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the
1214712166
|context|.
1214812167

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

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

1215412173
1. Set the |context|'s {{[[control thread state]]}} to
12155-
<code>interrupted</code>.
12174+
{{AudioContextState/interrupted}}.
12175+
12176+
1. Set the |context|'s {{[[interrupt end return state]]}} slot to
12177+
"{{AudioContextState/suspended}}".
1215612178

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

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

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

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

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

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=]:
12197+
1. If the |context|'s {{[[interrupt end return state]]}} is
12198+
"{{AudioContextState/running}}":
1218312199

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

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

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

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

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

1219912215
1. [=Fire an event=] named {{BaseAudioContext/statechange}} at the
1220012216
|context|.
1220112217

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

1220512221
1. Set the {{[[rendering thread state]]}} on the {{AudioContext}} to
1220612222
<code>suspended</code>.
@@ -12210,6 +12226,8 @@ Running a <a>control message</a> to end an {{AudioContext}} |context|
1221012226
1. Set the |context|'s {{[[control thread state]]}} to
1221112227
<code>suspended</code>.
1221212228

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

0 commit comments

Comments
 (0)