Skip to content

Commit f1ba914

Browse files
committed
webaudio/Analyser/handle-silent-inputs.html test is failing
https://bugs.webkit.org/show_bug.cgi?id=216708 Reviewed by Geoffrey Garen. Source/WebCore: Merge the following fix to AnalyserNode from Blink so that webaudio/Analyser/handle-silent-inputs.html layout test starts passing: - https://codereview.chromium.org/2666063003 No new tests, rebaselined existing test. * Modules/webaudio/AnalyserNode.cpp: (WebCore::AnalyserNode::process): (WebCore::AnalyserNode::updatePullStatus): (WebCore::AnalyserNode::tailTime const): * Modules/webaudio/AnalyserNode.h: * Modules/webaudio/AudioBasicInspectorNode.h: LayoutTests: Rebaseline test that is now passing. * webaudio/Analyser/handle-silent-inputs-expected.txt: Canonical link: https://commits.webkit.org/229511@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267252 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 4723a14 commit f1ba914

7 files changed

Lines changed: 112 additions & 130 deletions

File tree

LayoutTests/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2020-09-18 Chris Dumez <cdumez@apple.com>
2+
3+
webaudio/Analyser/handle-silent-inputs.html test is failing
4+
https://bugs.webkit.org/show_bug.cgi?id=216708
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Rebaseline test that is now passing.
9+
10+
* webaudio/Analyser/handle-silent-inputs-expected.txt:
11+
112
2020-09-18 Youenn Fablet <youenn@apple.com>
213

314
Hash deviceIds in WebProcess instead of UIProcess to allow audio output device IDs in WebProcess

LayoutTests/webaudio/Analyser/handle-silent-inputs-expected.txt

Lines changed: 21 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -5,146 +5,44 @@ PASS Executing "auto-pull"
55
PASS Executing "timing"
66
PASS Audit report
77
PASS > [connected] Test handling of silent inputs
8-
FAIL X 0: Analyser time data at time 0.5: Expected 0 for all values but found 64 unexpected values:
9-
Index Actual
10-
[0] 0.9980266094207764
11-
[1] 0.9939585328102112
12-
[2] 0.960288405418396
13-
[3] 0.8980192542076111
14-
...and 60 more errors. assert_true: expected true got false
15-
FAIL < [connected] 1 out of 1 assertions were failed. assert_true: expected true got false
8+
PASS 0: Analyser time data at time 0.5 contains only the constant 0.
9+
PASS < [connected] All assertions passed. (total 1 assertions)
1610
PASS > [auto-pull] Test handling of silent inputs
17-
FAIL X 1: Analyser time data at time 0.5: Expected 0 for all values but found 64 unexpected values:
18-
Index Actual
19-
[0] 0.9980266094207764
20-
[1] 0.9939585328102112
21-
[2] 0.960288405418396
22-
[3] 0.8980192542076111
23-
...and 60 more errors. assert_true: expected true got false
24-
FAIL < [auto-pull] 1 out of 1 assertions were failed. assert_true: expected true got false
11+
PASS 1: Analyser time data at time 0.5 contains only the constant 0.
12+
PASS < [auto-pull] All assertions passed. (total 1 assertions)
2513
PASS > [timing] Test shifting in of zeroes after source has stopped
2614
PASS At time 0.125 Analyser frames [0, 2048) contains only the constant 1.
2715
PASS At time 0.1328125 Analyser frames [0, 1920) contains only the constant 1.
2816
PASS At time 0.1328125 Analyser frames [1920, 2048) contains only the constant 0.
2917
PASS At time 0.140625 Analyser frames [0, 1792) contains only the constant 1.
30-
FAIL X At time 0.140625 Analyser frames [1792, 2048): Expected 0 for all values but found 128 unexpected values:
31-
Index Actual
32-
[0] 1
33-
[1] 1
34-
[2] 1
35-
[3] 1
36-
...and 124 more errors. assert_true: expected true got false
18+
PASS At time 0.140625 Analyser frames [1792, 2048) contains only the constant 0.
3719
PASS At time 0.1484375 Analyser frames [0, 1664) contains only the constant 1.
38-
FAIL X At time 0.1484375 Analyser frames [1664, 2048): Expected 0 for all values but found 256 unexpected values:
39-
Index Actual
40-
[0] 1
41-
[1] 1
42-
[2] 1
43-
[3] 1
44-
...and 252 more errors. assert_true: expected true got false
20+
PASS At time 0.1484375 Analyser frames [1664, 2048) contains only the constant 0.
4521
PASS At time 0.15625 Analyser frames [0, 1536) contains only the constant 1.
46-
FAIL X At time 0.15625 Analyser frames [1536, 2048): Expected 0 for all values but found 384 unexpected values:
47-
Index Actual
48-
[0] 1
49-
[1] 1
50-
[2] 1
51-
[3] 1
52-
...and 380 more errors. assert_true: expected true got false
22+
PASS At time 0.15625 Analyser frames [1536, 2048) contains only the constant 0.
5323
PASS At time 0.1640625 Analyser frames [0, 1408) contains only the constant 1.
54-
FAIL X At time 0.1640625 Analyser frames [1408, 2048): Expected 0 for all values but found 512 unexpected values:
55-
Index Actual
56-
[0] 1
57-
[1] 1
58-
[2] 1
59-
[3] 1
60-
...and 508 more errors. assert_true: expected true got false
24+
PASS At time 0.1640625 Analyser frames [1408, 2048) contains only the constant 0.
6125
PASS At time 0.171875 Analyser frames [0, 1280) contains only the constant 1.
62-
FAIL X At time 0.171875 Analyser frames [1280, 2048): Expected 0 for all values but found 640 unexpected values:
63-
Index Actual
64-
[0] 1
65-
[1] 1
66-
[2] 1
67-
[3] 1
68-
...and 636 more errors. assert_true: expected true got false
26+
PASS At time 0.171875 Analyser frames [1280, 2048) contains only the constant 0.
6927
PASS At time 0.1796875 Analyser frames [0, 1152) contains only the constant 1.
70-
FAIL X At time 0.1796875 Analyser frames [1152, 2048): Expected 0 for all values but found 768 unexpected values:
71-
Index Actual
72-
[0] 1
73-
[1] 1
74-
[2] 1
75-
[3] 1
76-
...and 764 more errors. assert_true: expected true got false
28+
PASS At time 0.1796875 Analyser frames [1152, 2048) contains only the constant 0.
7729
PASS At time 0.1875 Analyser frames [0, 1024) contains only the constant 1.
78-
FAIL X At time 0.1875 Analyser frames [1024, 2048): Expected 0 for all values but found 896 unexpected values:
79-
Index Actual
80-
[0] 1
81-
[1] 1
82-
[2] 1
83-
[3] 1
84-
...and 892 more errors. assert_true: expected true got false
30+
PASS At time 0.1875 Analyser frames [1024, 2048) contains only the constant 0.
8531
PASS At time 0.1953125 Analyser frames [0, 896) contains only the constant 1.
86-
FAIL X At time 0.1953125 Analyser frames [896, 2048): Expected 0 for all values but found 1024 unexpected values:
87-
Index Actual
88-
[0] 1
89-
[1] 1
90-
[2] 1
91-
[3] 1
92-
...and 1020 more errors. assert_true: expected true got false
32+
PASS At time 0.1953125 Analyser frames [896, 2048) contains only the constant 0.
9333
PASS At time 0.203125 Analyser frames [0, 768) contains only the constant 1.
94-
FAIL X At time 0.203125 Analyser frames [768, 2048): Expected 0 for all values but found 1152 unexpected values:
95-
Index Actual
96-
[0] 1
97-
[1] 1
98-
[2] 1
99-
[3] 1
100-
...and 1148 more errors. assert_true: expected true got false
34+
PASS At time 0.203125 Analyser frames [768, 2048) contains only the constant 0.
10135
PASS At time 0.2109375 Analyser frames [0, 640) contains only the constant 1.
102-
FAIL X At time 0.2109375 Analyser frames [640, 2048): Expected 0 for all values but found 1280 unexpected values:
103-
Index Actual
104-
[0] 1
105-
[1] 1
106-
[2] 1
107-
[3] 1
108-
...and 1276 more errors. assert_true: expected true got false
36+
PASS At time 0.2109375 Analyser frames [640, 2048) contains only the constant 0.
10937
PASS At time 0.21875 Analyser frames [0, 512) contains only the constant 1.
110-
FAIL X At time 0.21875 Analyser frames [512, 2048): Expected 0 for all values but found 1408 unexpected values:
111-
Index Actual
112-
[0] 1
113-
[1] 1
114-
[2] 1
115-
[3] 1
116-
...and 1404 more errors. assert_true: expected true got false
38+
PASS At time 0.21875 Analyser frames [512, 2048) contains only the constant 0.
11739
PASS At time 0.2265625 Analyser frames [0, 384) contains only the constant 1.
118-
FAIL X At time 0.2265625 Analyser frames [384, 2048): Expected 0 for all values but found 1536 unexpected values:
119-
Index Actual
120-
[0] 1
121-
[1] 1
122-
[2] 1
123-
[3] 1
124-
...and 1532 more errors. assert_true: expected true got false
40+
PASS At time 0.2265625 Analyser frames [384, 2048) contains only the constant 0.
12541
PASS At time 0.234375 Analyser frames [0, 256) contains only the constant 1.
126-
FAIL X At time 0.234375 Analyser frames [256, 2048): Expected 0 for all values but found 1664 unexpected values:
127-
Index Actual
128-
[0] 1
129-
[1] 1
130-
[2] 1
131-
[3] 1
132-
...and 1660 more errors. assert_true: expected true got false
42+
PASS At time 0.234375 Analyser frames [256, 2048) contains only the constant 0.
13343
PASS At time 0.2421875 Analyser frames [0, 128) contains only the constant 1.
134-
FAIL X At time 0.2421875 Analyser frames [128, 2048): Expected 0 for all values but found 1792 unexpected values:
135-
Index Actual
136-
[0] 1
137-
[1] 1
138-
[2] 1
139-
[3] 1
140-
...and 1788 more errors. assert_true: expected true got false
141-
FAIL X At time 0.25 Analyser frames [0, 2048): Expected 0 for all values but found 1920 unexpected values:
142-
Index Actual
143-
[0] 1
144-
[1] 1
145-
[2] 1
146-
[3] 1
147-
...and 1916 more errors. assert_true: expected true got false
148-
FAIL < [timing] 15 out of 32 assertions were failed. assert_true: expected true got false
149-
FAIL # AUDIT TASK RUNNER FINISHED: 3 out of 3 tasks were failed. assert_true: expected true got false
44+
PASS At time 0.2421875 Analyser frames [128, 2048) contains only the constant 0.
45+
PASS At time 0.25 Analyser frames [0, 2048) contains only the constant 0.
46+
PASS < [timing] All assertions passed. (total 32 assertions)
47+
PASS # AUDIT TASK RUNNER FINISHED: 3 tasks ran successfully.
15048

Source/WebCore/ChangeLog

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
2020-09-18 Chris Dumez <cdumez@apple.com>
2+
3+
webaudio/Analyser/handle-silent-inputs.html test is failing
4+
https://bugs.webkit.org/show_bug.cgi?id=216708
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Merge the following fix to AnalyserNode from Blink so that webaudio/Analyser/handle-silent-inputs.html
9+
layout test starts passing:
10+
- https://codereview.chromium.org/2666063003
11+
12+
No new tests, rebaselined existing test.
13+
14+
* Modules/webaudio/AnalyserNode.cpp:
15+
(WebCore::AnalyserNode::process):
16+
(WebCore::AnalyserNode::updatePullStatus):
17+
(WebCore::AnalyserNode::tailTime const):
18+
* Modules/webaudio/AnalyserNode.h:
19+
* Modules/webaudio/AudioBasicInspectorNode.h:
20+
121
2020-09-18 Youenn Fablet <youenn@apple.com>
222

323
Add internal flag to enable/disable H264 hardware encoder

Source/WebCore/Modules/webaudio/AnalyserNode.cpp

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,22 @@ void AnalyserNode::process(size_t framesToProcess)
8282
{
8383
AudioBus* outputBus = output(0)->bus();
8484

85-
if (!isInitialized() || !input(0)->isConnected()) {
85+
if (!isInitialized()) {
8686
outputBus->zero();
8787
return;
8888
}
8989

9090
AudioBus* inputBus = input(0)->bus();
9191

92-
// Give the analyser the audio which is passing through this AudioNode.
92+
// Give the analyser the audio which is passing through this AudioNode. This must always
93+
// be done so that the state of the Analyser reflects the current input.
9394
m_analyser.writeInput(inputBus, framesToProcess);
9495

96+
if (!input(0)->isConnected()) {
97+
outputBus->zero();
98+
return;
99+
}
100+
95101
// For in-place processing, our override of pullInputs() will just pass the audio data through unchanged if the channel count matches from input to output
96102
// (resulting in inputBus == outputBus). Otherwise, do an up-mix to stereo.
97103
if (inputBus != outputBus)
@@ -153,6 +159,48 @@ bool AnalyserNode::requiresTailProcessing() const
153159
return true;
154160
}
155161

162+
void AnalyserNode::updatePullStatus()
163+
{
164+
ASSERT(context().isGraphOwner());
165+
166+
if (output(0)->isConnected()) {
167+
// When an AudioBasicInspectorNode is connected to a downstream node, it
168+
// will get pulled by the downstream node, thus remove it from the context's
169+
// automatic pull list.
170+
if (m_needAutomaticPull) {
171+
context().removeAutomaticPullNode(*this);
172+
m_needAutomaticPull = false;
173+
}
174+
} else {
175+
unsigned numberOfInputConnections = input(0)->numberOfRenderingConnections();
176+
// When an AnalyserNode is not connected to any downstream node
177+
// while still connected from upstream node(s), add it to the context's
178+
// automatic pull list.
179+
//
180+
// But don't remove the AnalyserNode if there are no inputs
181+
// connected to the node. The node needs to be pulled so that the
182+
// internal state is updated with the correct input signal (of
183+
// zeroes).
184+
if (numberOfInputConnections && !m_needAutomaticPull) {
185+
context().addAutomaticPullNode(*this);
186+
m_needAutomaticPull = true;
187+
}
188+
}
189+
}
190+
191+
bool AnalyserNode::propagatesSilence() const
192+
{
193+
// An AnalyserNode does actually propogate silence, but to get the
194+
// time and FFT data updated correctly, process() needs to be
195+
// called even if all the inputs are silent.
196+
return false;
197+
}
198+
199+
double AnalyserNode::tailTime() const
200+
{
201+
return RealtimeAnalyser::MaxFFTSize / static_cast<double>(context().sampleRate());
202+
}
203+
156204
} // namespace WebCore
157205

158206
#endif // ENABLE(WEB_AUDIO)

Source/WebCore/Modules/webaudio/AnalyserNode.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,12 @@ class AnalyserNode final : public AudioBasicInspectorNode {
6363

6464
void process(size_t framesToProcess) final;
6565
void reset() final;
66+
void updatePullStatus() final;
6667

67-
double tailTime() const final { return 0; }
68+
double tailTime() const final;
6869
double latencyTime() const final { return 0; }
6970
bool requiresTailProcessing() const final;
71+
bool propagatesSilence() const final;
7072

7173
RealtimeAnalyser m_analyser;
7274
};

Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ void AudioBasicInspectorNode::updatePullStatus()
9595
context().addAutomaticPullNode(*this);
9696
m_needAutomaticPull = true;
9797
} else if (!numberOfInputConnections && m_needAutomaticPull) {
98-
// The AudioBasicInspectorNode is connected to nothing, remove it from the context's automatic pull list.
98+
// The AudioBasicInspectorNode is connected to nothing and is not an AnalyserNode, remove it from the
99+
// context's automatic pull list. AnalyserNode's need to be pulled even with no inputs so that the
100+
// internal state gets updated to hold the right time and FFT data.
99101
context().removeAutomaticPullNode(*this);
100102
m_needAutomaticPull = false;
101103
}

Source/WebCore/Modules/webaudio/AudioBasicInspectorNode.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,14 @@ class AudioBasicInspectorNode : public AudioNode {
3636
public:
3737
explicit AudioBasicInspectorNode(BaseAudioContext&);
3838

39+
protected:
40+
bool m_needAutomaticPull { false }; // When setting to true, AudioBasicInspectorNode will be pulled automatically by AudioContext before the end of each render quantum.
41+
3942
private:
4043
void pullInputs(size_t framesToProcess) override;
4144
void checkNumberOfChannelsForInput(AudioNodeInput*) override;
4245

43-
void updatePullStatus() final;
44-
45-
bool m_needAutomaticPull { false }; // When setting to true, AudioBasicInspectorNode will be pulled automatically by AudioContext before the end of each render quantum.
46+
void updatePullStatus() override;
4647
};
4748

4849
} // namespace WebCore

0 commit comments

Comments
 (0)