Commit a675a51
committed
[GPUProcess] Regression(r268632) Garbage is rendered on speakers when using WebAudio
https://bugs.webkit.org/show_bug.cgi?id=218729
Reviewed by Eric Carlson.
Source/WebCore:
* platform/audio/cocoa/AudioDestinationCocoa.h:
* platform/mock/MockAudioDestinationCocoa.cpp:
(WebCore::MockAudioDestinationCocoa::start):
(WebCore::MockAudioDestinationCocoa::stop):
(WebCore::MockAudioDestinationCocoa::tick):
* platform/mock/MockAudioDestinationCocoa.h:
Make AudioDestinationCocoa::m_dispatchToRenderThread private so that subclasses cannot set it.
Update MockAudioDestinationCocoa to use m_dispatchToRenderThread to dispatch to the
render thread when available, instead of unconditionally dispatching to its own WorkQueue and
then expecting AudioDestinationCocoa::render() to render to the actual rendering thread.
Source/WebKit:
RemoteAudioDestinationProxy::requestBuffer() was calling AudioDestinationCocoa::render()
and expecting RemoteAudioDestinationProxy::renderOnRenderingThead() to get called as
a result. It would take care of writing to the CARingBuffer and sending the IPC back
to the GPU process in renderOnRenderingThead(). The issue was that AudioDestinationCocoa
uses a PushPullFIFO internally for buffering. It first fetches available frames from
the FIFO and then only calls renderOnRenderingThead() with the number of frames that
remain to processed (usually 0). As a result, RemoteAudioDestinationProxy::renderOnRenderingThead()
would often store 0 frames instead of 128 (or sometimes a number of frames less than
128), even though the full 128 frames were actually rendered.
To address the issue, stop overriding renderOnRenderingThead() in
RemoteAudioDestinationProxy. Instead, do the writing to the CARingBuffer and the IPC
response in RemoteAudioDestinationProxy::requestBuffer(), directly after calling
AudioDestinationCocoa::render(). After calling AudioDestinationCocoa::render()
we know that |framesToRender| frames have been rendered / added to the buffer.
* WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp:
(WebKit::RemoteAudioDestinationProxy::requestBuffer):
* WebProcess/GPU/media/RemoteAudioDestinationProxy.h:
Canonical link: https://commits.webkit.org/231420@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269630 268f45cc-cd09-0410-ab3c-d52691b4dbfc1 parent 1ed60da commit a675a51
7 files changed
Lines changed: 65 additions & 22 deletions
File tree
- Source
- WebCore
- platform
- audio/cocoa
- mock
- WebKit
- WebProcess/GPU/media
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
1 | 19 | | |
2 | 20 | | |
3 | 21 | | |
| |||
Lines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
| |||
65 | 64 | | |
66 | 65 | | |
67 | 66 | | |
68 | | - | |
69 | | - | |
70 | 67 | | |
71 | 68 | | |
72 | 69 | | |
73 | 70 | | |
74 | 71 | | |
75 | 72 | | |
| 73 | + | |
| 74 | + | |
76 | 75 | | |
77 | 76 | | |
78 | 77 | | |
| |||
93 | 92 | | |
94 | 93 | | |
95 | 94 | | |
| 95 | + | |
| 96 | + | |
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
| |||
61 | 67 | | |
62 | 68 | | |
63 | 69 | | |
64 | | - | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
| |||
70 | 76 | | |
71 | 77 | | |
72 | 78 | | |
73 | | - | |
| 79 | + | |
74 | 80 | | |
75 | 81 | | |
76 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
1 | 28 | | |
2 | 29 | | |
3 | 30 | | |
| |||
Lines changed: 7 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
135 | | - | |
| 135 | + | |
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 139 | + | |
| 140 | + | |
151 | 141 | | |
152 | 142 | | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
153 | 146 | | |
154 | | - | |
155 | 147 | | |
156 | 148 | | |
157 | 149 | | |
158 | 150 | | |
159 | 151 | | |
160 | 152 | | |
161 | 153 | | |
162 | | - | |
| 154 | + | |
163 | 155 | | |
164 | 156 | | |
165 | 157 | | |
| |||
Lines changed: 0 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | 90 | | |
92 | 91 | | |
93 | 92 | | |
| |||
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
108 | | - | |
109 | 107 | | |
110 | 108 | | |
111 | 109 | | |
| |||
0 commit comments