Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Issue 2777903005: Add WebThread in AudioDestination to support AudioWorkletThread (Closed)

Created:
3 years, 8 months ago by hongchan
Modified:
3 years, 7 months ago
CC:
chromium-reviews, blink-reviews, kinuko+watch, Raymond Toy
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Add WebThread in AudioDestination to support AudioWorkletThread This CL to introduce a WebThread to run WebAudio graph rendering. FYI: with the box 2d demo on my local machine (MacPro), the release build of this patch was able to render 50 cubes concurrently before glitch, which is similar to the current stable build that runs only on the audio device thread. No significant performance regression is observed. Design doc: https://docs.google.com/document/d/1WnqZHcA2TQjS1aKvzx2nnJ2y2tWK1Xp_0BhFGpsryaQ/edit# BUG=706133 Review-Url: https://codereview.chromium.org/2777903005 Cr-Commit-Position: refs/heads/master@{#467819} Committed: https://chromium.googlesource.com/chromium/src/+/1492075fce7add79a11e13a3c40d55261f4ae89d

Patch Set 1 #

Total comments: 23

Patch Set 2 : Addressing feedback #

Total comments: 8

Patch Set 3 : Added thread checking #

Patch Set 4 : Rebased after Blink renaming #

Patch Set 5 : Refactoring WIP (please ignore) #

Total comments: 8

Patch Set 6 : Refactoring AudioDestination for thread safety #

Total comments: 10

Patch Set 7 : Remove callback between Destination and FIFO #

Total comments: 20

Patch Set 8 : Cleaning up #

Patch Set 9 : Issue with unit test #

Patch Set 10 : Added Unit Test for multi-thread support #

Total comments: 15

Patch Set 11 : Parameterized Unit Test #

Total comments: 22

Patch Set 12 : Addressed feedback #

Total comments: 3

Patch Set 13 : Clean up after l-g-t-m #

Unified diffs Side-by-side diffs Delta from patch set Stats (+395 lines, -93 lines) Patch
M third_party/WebKit/Source/platform/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/AudioDestination.h View 1 2 3 4 5 6 7 3 chunks +30 lines, -15 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/AudioDestination.cpp View 1 2 3 4 5 6 7 7 chunks +48 lines, -28 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/PushPullFIFO.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +34 lines, -20 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 5 chunks +20 lines, -14 lines 0 comments Download
A third_party/WebKit/Source/platform/audio/PushPullFIFOMultithreadTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +235 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/audio/PushPullFIFOTest.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +23 lines, -16 lines 0 comments Download

Messages

Total messages: 68 (29 generated)
hongchan
This is a proof-of-concept. PTAL at the high level approach.
3 years, 8 months ago (2017-03-28 22:24:27 UTC) #3
nhiroki
Looks good to me. I'll defer to WebAudio/Arch experts. Added some early comments about thread ...
3 years, 8 months ago (2017-03-29 01:54:05 UTC) #4
haraken
The approach looks good. https://codereview.chromium.org/2777903005/diff/1/third_party/WebKit/Source/platform/audio/AudioDestination.cpp File third_party/WebKit/Source/platform/audio/AudioDestination.cpp (right): https://codereview.chromium.org/2777903005/diff/1/third_party/WebKit/Source/platform/audio/AudioDestination.cpp#newcode127 third_party/WebKit/Source/platform/audio/AudioDestination.cpp:127: m_fifo->pull(m_outputBus.get(), numberOfFrames); Is it okay ...
3 years, 8 months ago (2017-03-29 07:56:24 UTC) #5
o1ka
The CL look fine performance-wise. I see some issues with muti-threading and suggest a bit ...
3 years, 8 months ago (2017-03-29 09:05:11 UTC) #6
Raymond Toy
https://codereview.chromium.org/2777903005/diff/1/third_party/WebKit/Source/platform/audio/PushPullFIFO.h File third_party/WebKit/Source/platform/audio/PushPullFIFO.h (right): https://codereview.chromium.org/2777903005/diff/1/third_party/WebKit/Source/platform/audio/PushPullFIFO.h#newcode29 third_party/WebKit/Source/platform/audio/PushPullFIFO.h:29: // quantum, RQ) thus FIFO is needed to handle ...
3 years, 8 months ago (2017-03-29 16:13:13 UTC) #7
hongchan
nhiroki@ Please advise how I can check the thread inside of method. Both threads are ...
3 years, 8 months ago (2017-03-29 19:39:59 UTC) #8
o1ka
On 2017/03/29 19:39:59, hongchan wrote: > olka@ > If you think a complete redesign of ...
3 years, 8 months ago (2017-03-30 08:27:31 UTC) #9
nhiroki
https://codereview.chromium.org/2777903005/diff/1/third_party/WebKit/Source/platform/audio/PushPullFIFO.h File third_party/WebKit/Source/platform/audio/PushPullFIFO.h (right): https://codereview.chromium.org/2777903005/diff/1/third_party/WebKit/Source/platform/audio/PushPullFIFO.h#newcode29 third_party/WebKit/Source/platform/audio/PushPullFIFO.h:29: // quantum, RQ) thus FIFO is needed to handle ...
3 years, 8 months ago (2017-03-30 09:04:41 UTC) #10
o1ka
(forgot to publish comments) https://codereview.chromium.org/2777903005/diff/20001/third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp File third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp (right): https://codereview.chromium.org/2777903005/diff/20001/third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp#newcode173 third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp:173: return m_framesAvailable; This is correct ...
3 years, 8 months ago (2017-03-30 13:17:05 UTC) #11
hongchan
PS3 adds the thread checking. Starting from the next patch set, I will address on ...
3 years, 8 months ago (2017-03-30 18:36:01 UTC) #12
hongchan
On 2017/03/30 18:36:01, hongchan wrote: > PS3 adds the thread checking. > > Starting from ...
3 years, 8 months ago (2017-04-12 19:07:44 UTC) #14
hongchan
On 2017/04/12 19:07:44, hongchan wrote: > On 2017/03/30 18:36:01, hongchan wrote: > > PS3 adds ...
3 years, 8 months ago (2017-04-12 23:16:03 UTC) #16
o1ka
On 2017/04/12 19:07:44, hongchan wrote: > On 2017/03/30 18:36:01, hongchan wrote: > > PS3 adds ...
3 years, 8 months ago (2017-04-13 08:36:39 UTC) #17
o1ka
https://codereview.chromium.org/2777903005/diff/120001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp File third_party/WebKit/Source/platform/audio/AudioDestination.cpp (right): https://codereview.chromium.org/2777903005/diff/120001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp#newcode118 third_party/WebKit/Source/platform/audio/AudioDestination.cpp:118: if (!fifo_ || fifo_->length() < number_of_frames) Are you keeping ...
3 years, 8 months ago (2017-04-13 08:36:54 UTC) #18
hongchan
Please ignore PS5. PS6 introduces a major change in AudioDestination: - Based on the suggestion ...
3 years, 8 months ago (2017-04-14 16:31:48 UTC) #22
haraken
https://codereview.chromium.org/2777903005/diff/180001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp File third_party/WebKit/Source/platform/audio/AudioDestination.cpp (right): https://codereview.chromium.org/2777903005/diff/180001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp#newcode123 third_party/WebKit/Source/platform/audio/AudioDestination.cpp:123: Bind(&AudioDestination::RequestRender, WTF::Unretained(this), On 2017/04/14 16:31:48, hongchan wrote: > @nhiroki ...
3 years, 8 months ago (2017-04-14 19:01:43 UTC) #23
hongchan
https://codereview.chromium.org/2777903005/diff/180001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp File third_party/WebKit/Source/platform/audio/AudioDestination.cpp (right): https://codereview.chromium.org/2777903005/diff/180001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp#newcode123 third_party/WebKit/Source/platform/audio/AudioDestination.cpp:123: Bind(&AudioDestination::RequestRender, WTF::Unretained(this), On 2017/04/14 19:01:43, haraken wrote: > On ...
3 years, 8 months ago (2017-04-14 20:46:30 UTC) #24
nhiroki
https://codereview.chromium.org/2777903005/diff/180001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp File third_party/WebKit/Source/platform/audio/AudioDestination.cpp (right): https://codereview.chromium.org/2777903005/diff/180001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp#newcode123 third_party/WebKit/Source/platform/audio/AudioDestination.cpp:123: Bind(&AudioDestination::RequestRender, WTF::Unretained(this), On 2017/04/14 20:46:29, hongchan wrote: > On ...
3 years, 8 months ago (2017-04-17 03:27:30 UTC) #25
hongchan
https://codereview.chromium.org/2777903005/diff/180001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp File third_party/WebKit/Source/platform/audio/AudioDestination.cpp (right): https://codereview.chromium.org/2777903005/diff/180001/third_party/WebKit/Source/platform/audio/AudioDestination.cpp#newcode123 third_party/WebKit/Source/platform/audio/AudioDestination.cpp:123: Bind(&AudioDestination::RequestRender, WTF::Unretained(this), On 2017/04/17 03:27:30, nhiroki wrote: > On ...
3 years, 8 months ago (2017-04-17 16:03:29 UTC) #26
o1ka
locking/threading/FIFO sgtm. A couple of questions: 1) Is the intention here to switch all WebAudio ...
3 years, 8 months ago (2017-04-18 14:14:58 UTC) #28
hongchan
Thanks olka@! > 1) Is the intention here to switch all WebAudio rendering to asynchronous, ...
3 years, 8 months ago (2017-04-18 18:16:09 UTC) #29
hongchan
nhiroki@ Could you help me with the unit test? I am getting the following result ...
3 years, 8 months ago (2017-04-18 19:55:39 UTC) #30
Raymond Toy
On Tue, Apr 18, 2017 at 11:16 AM, <hongchan@chromium.org> wrote: > Thanks olka@! > > ...
3 years, 8 months ago (2017-04-18 21:00:52 UTC) #31
Raymond Toy
On Tue, Apr 18, 2017 at 11:16 AM, <hongchan@chromium.org> wrote: > Thanks olka@! > > ...
3 years, 8 months ago (2017-04-18 21:00:52 UTC) #32
nhiroki
On 2017/04/18 19:55:39, hongchan wrote: > nhiroki@ > > Could you help me with the ...
3 years, 8 months ago (2017-04-19 10:10:57 UTC) #33
hongchan
o1ka@ rtoy@ PTAL at the new unit test: PushPullFIFOSmokeTest.cpp. If this makes sense to you, ...
3 years, 8 months ago (2017-04-20 18:01:37 UTC) #34
haraken
The threading implementation LGTM, although I want to have oika@ confirm it. https://codereview.chromium.org/2777903005/diff/280001/third_party/WebKit/Source/platform/BUILD.gn File third_party/WebKit/Source/platform/BUILD.gn ...
3 years, 8 months ago (2017-04-20 20:20:51 UTC) #35
hongchan
https://codereview.chromium.org/2777903005/diff/280001/third_party/WebKit/Source/platform/BUILD.gn File third_party/WebKit/Source/platform/BUILD.gn (right): https://codereview.chromium.org/2777903005/diff/280001/third_party/WebKit/Source/platform/BUILD.gn#newcode2166 third_party/WebKit/Source/platform/BUILD.gn:2166: "audio/PushPullFIFOSmokeTest.cpp", On 2017/04/20 20:20:51, haraken wrote: > On 2017/04/20 ...
3 years, 8 months ago (2017-04-20 20:35:09 UTC) #36
haraken
On 2017/04/20 20:35:09, hongchan wrote: > https://codereview.chromium.org/2777903005/diff/280001/third_party/WebKit/Source/platform/BUILD.gn > File third_party/WebKit/Source/platform/BUILD.gn (right): > > https://codereview.chromium.org/2777903005/diff/280001/third_party/WebKit/Source/platform/BUILD.gn#newcode2166 > ...
3 years, 8 months ago (2017-04-20 20:36:48 UTC) #37
Raymond Toy
https://codereview.chromium.org/2777903005/diff/280001/third_party/WebKit/Source/platform/audio/PushPullFIFOSmokeTest.cpp File third_party/WebKit/Source/platform/audio/PushPullFIFOSmokeTest.cpp (right): https://codereview.chromium.org/2777903005/diff/280001/third_party/WebKit/Source/platform/audio/PushPullFIFOSmokeTest.cpp#newcode72 third_party/WebKit/Source/platform/audio/PushPullFIFOSmokeTest.cpp:72: + (static_cast<double>(std::rand()) / RAND_MAX) * jitter_range_ms_; Maybe use std::uniform_real_distribution ...
3 years, 8 months ago (2017-04-21 16:26:57 UTC) #38
hongchan
@o1ka PTAL at the parameterized test cases in PS10. If you think we should add ...
3 years, 8 months ago (2017-04-21 20:44:02 UTC) #39
hongchan
I ran some benchmark to measure the overhead caused by the lock and the thread ...
3 years, 8 months ago (2017-04-24 20:53:09 UTC) #40
nhiroki
LGTM from threading pov https://codereview.chromium.org/2777903005/diff/300001/third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp File third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp (right): https://codereview.chromium.org/2777903005/diff/300001/third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp#newcode25 third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp:25: index_write_(0) { Optional: How about ...
3 years, 8 months ago (2017-04-25 00:35:51 UTC) #41
o1ka
Oh it turned out I reviewed it yesterday but forgot to publish comments. Sorry for ...
3 years, 8 months ago (2017-04-25 08:23:22 UTC) #42
hongchan
https://codereview.chromium.org/2777903005/diff/300001/third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp File third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp (right): https://codereview.chromium.org/2777903005/diff/300001/third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp#newcode25 third_party/WebKit/Source/platform/audio/PushPullFIFO.cpp:25: index_write_(0) { On 2017/04/25 00:35:51, nhiroki wrote: > Optional: ...
3 years, 8 months ago (2017-04-25 20:36:42 UTC) #43
o1ka
lgtm https://codereview.chromium.org/2777903005/diff/320001/third_party/WebKit/Source/platform/audio/PushPullFIFOSmokeTest.cpp File third_party/WebKit/Source/platform/audio/PushPullFIFOSmokeTest.cpp (right): https://codereview.chromium.org/2777903005/diff/320001/third_party/WebKit/Source/platform/audio/PushPullFIFOSmokeTest.cpp#newcode226 third_party/WebKit/Source/platform/audio/PushPullFIFOSmokeTest.cpp:226: {48000, 2, 8192, 10000, 256, 0, 128, 1} ...
3 years, 8 months ago (2017-04-26 12:32:57 UTC) #44
Raymond Toy
lgtm with typo nit. Be sure to add a test for 44.1 kHz. https://codereview.chromium.org/2777903005/diff/320001/third_party/WebKit/Source/platform/audio/PushPullFIFO.h File ...
3 years, 8 months ago (2017-04-26 19:12:00 UTC) #49
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2777903005/360001
3 years, 7 months ago (2017-04-27 22:34:14 UTC) #65
commit-bot: I haz the power
3 years, 7 months ago (2017-04-28 01:53:26 UTC) #68
Message was sent while issue was closed.
Committed patchset #13 (id:360001) as
https://chromium.googlesource.com/chromium/src/+/1492075fce7add79a11e13a3c40d...

Powered by Google App Engine
This is Rietveld 408576698