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

Issue 2665693002: Moves channel-dependent audio input processing to separate encoder task queue (Closed)

Created:
3 years, 10 months ago by henrika_webrtc
Modified:
3 years, 8 months ago
Reviewers:
the sun, tommi, aleloi
CC:
webrtc-reviews_webrtc.org, tommi
Target Ref:
refs/heads/master
Project:
webrtc
Visibility:
Public.

Description

Moves channel-dependent audio input processing to separate encoder task queue. First approach to remove parts of the heavy load done for encoding, and preparation for sending, from native audio thread to separate task queue. With this change we will give the native input audio thread more time to "relax" between successive audio captures. Separate profiling done on Android has verified that the change works well; the load is now redistributed and the load of the native AudioRecordThread is reduced. Similar conclusions should be valid for all other OS:es as well. BUG=NONE CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_compile_dbg,linux_android_rel_ng Review-Url: https://codereview.webrtc.org/2665693002 Cr-Commit-Position: refs/heads/master@{#17488} Committed: https://chromium.googlesource.com/external/webrtc/+/ec6fbd277623cc60007d6a57d91f1e6b78ad6b04

Patch Set 1 #

Total comments: 1

Patch Set 2 : BUILD changes #

Total comments: 7

Patch Set 3 : rebased #

Patch Set 4 : Rebased #

Patch Set 5 : Added time measurement (to be removed) #

Patch Set 6 : rebased #

Patch Set 7 : Added audio frame pool #

Patch Set 8 : Now works with pool of audio frames #

Patch Set 9 : Renamed APIs in audio frame pool #

Patch Set 10 : nit #

Patch Set 11 : Modified SwapQueue #

Patch Set 12 : nit #

Patch Set 13 : cleanup #

Total comments: 4

Patch Set 14 : Added PostTask helper #

Patch Set 15 : Fixed critical section #

Patch Set 16 : Fix for Mac #

Patch Set 17 : Increased prio of queue #

Total comments: 10

Patch Set 18 : Removed frame pool #

Patch Set 19 : reverted swap queue changes #

Patch Set 20 : Moved resampling to queue #

Patch Set 21 : nit #

Patch Set 22 : rebased #

Patch Set 23 : Improves life-time handling of channel object #

Patch Set 24 : nit #

Total comments: 6

Patch Set 25 : Removed logging #

Patch Set 26 : Final changes #

Patch Set 27 : rebased #

Patch Set 28 : Fixed dependency #

Total comments: 60

Patch Set 29 : Changes based on feedback from Fredrik and Tommi - part 1(2) #

Patch Set 30 : rebased #

Patch Set 31 : Changes based on feedback from Fredrik and Tommi - part 2(2) #

Patch Set 32 : StopSend is now void #

Total comments: 10

Patch Set 33 : Final feedback from Fredrik #

Total comments: 5

Patch Set 34 : Removed debug logs in ADB #

Total comments: 14

Patch Set 35 : Final comments from Tommi #

Unified diffs Side-by-side diffs Delta from patch set Stats (+259 lines, -317 lines) Patch
M webrtc/voice_engine/BUILD.gn View 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 chunk +1 line, -0 lines 0 comments Download
M webrtc/voice_engine/channel.h View 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 28 29 30 31 32 12 chunks +46 lines, -28 lines 0 comments Download
M webrtc/voice_engine/channel.cc View 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 28 29 30 31 32 33 34 12 chunks +88 lines, -80 lines 0 comments Download
M webrtc/voice_engine/shared_data.h View 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 28 3 chunks +19 lines, -11 lines 0 comments Download
M webrtc/voice_engine/shared_data.cc View 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 28 2 chunks +15 lines, -13 lines 0 comments Download
M webrtc/voice_engine/transmit_mixer.h View 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 28 2 chunks +1 line, -11 lines 0 comments Download
M webrtc/voice_engine/transmit_mixer.cc View 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 28 1 chunk +7 lines, -59 lines 0 comments Download
M webrtc/voice_engine/voe_base_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2 chunks +10 lines, -22 lines 0 comments Download
M webrtc/voice_engine/voe_base_impl.cc View 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 28 29 30 31 5 chunks +72 lines, -93 lines 0 comments Download

Messages

Total messages: 129 (85 generated)
henrika_webrtc
As discussed. PTAL. https://codereview.webrtc.org/2665693002/diff/1/webrtc/base/physicalsocketserver.cc File webrtc/base/physicalsocketserver.cc (right): https://codereview.webrtc.org/2665693002/diff/1/webrtc/base/physicalsocketserver.cc#newcode718 webrtc/base/physicalsocketserver.cc:718: // LOG_ERR(LS_WARNING) << "Assuming benign blocking ...
3 years, 10 months ago (2017-01-30 15:33:12 UTC) #3
the sun
https://codereview.webrtc.org/2665693002/diff/40001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/40001/webrtc/voice_engine/channel.cc#newcode404 webrtc/voice_engine/channel.cc:404: Channel* const channel_; We have us an ownership issue, ...
3 years, 10 months ago (2017-01-31 13:34:34 UTC) #17
tommi
https://codereview.webrtc.org/2665693002/diff/40001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/40001/webrtc/voice_engine/channel.cc#newcode2787 webrtc/voice_engine/channel.cc:2787: std::unique_ptr<AudioFrame> audio_source(new AudioFrame()); On 2017/01/31 13:34:33, the sun wrote: ...
3 years, 10 months ago (2017-01-31 14:51:18 UTC) #21
henrika_webrtc
Thanks for the comments. No low-hanging fruit but will try to provide changes. https://codereview.webrtc.org/2665693002/diff/40001/webrtc/voice_engine/channel.cc File ...
3 years, 10 months ago (2017-01-31 15:20:21 UTC) #22
henrika_webrtc
FYI, I have paused working on this CL. Will discuss with Fredrik how/if we shall ...
3 years, 9 months ago (2017-03-02 08:36:43 UTC) #23
henrika_webrtc
Hi again, seems like the priority of this work has bumped up. Please revisit and ...
3 years, 9 months ago (2017-03-22 11:53:19 UTC) #25
henrika_webrtc
Sorry but I am actually not sure yet that a pool of audio frames is ...
3 years, 9 months ago (2017-03-23 11:51:04 UTC) #38
the sun
nits https://codereview.webrtc.org/2665693002/diff/340001/webrtc/base/swap_queue_unittest.cc File webrtc/base/swap_queue_unittest.cc (right): https://codereview.webrtc.org/2665693002/diff/340001/webrtc/base/swap_queue_unittest.cc#newcode56 webrtc/base/swap_queue_unittest.cc:56: EXPECT_EQ(queue.Size(), 2u); nit: check capacity again here (guard ...
3 years, 9 months ago (2017-03-23 12:45:55 UTC) #39
aleloi
Task queue lifetime comments https://codereview.webrtc.org/2665693002/diff/340001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/340001/webrtc/voice_engine/channel.cc#newcode440 webrtc/voice_engine/channel.cc:440: }; Since the task operates ...
3 years, 9 months ago (2017-03-23 13:33:21 UTC) #42
henrika_webrtc
Thanks for feedback. Note that frame pool is now removed. Will upload new reference. Might ...
3 years, 9 months ago (2017-03-23 14:02:17 UTC) #45
henrika_webrtc
Now moved resampling to queue as well and also verified that the "PushCaptureData path" works.
3 years, 9 months ago (2017-03-23 15:35:35 UTC) #47
henrika_webrtc
What remains now is to ensure that any task does not try to access and ...
3 years, 9 months ago (2017-03-23 15:36:23 UTC) #48
henrika_webrtc
I have now uploaded a new version where I try to ensure that the task ...
3 years, 9 months ago (2017-03-24 14:15:31 UTC) #53
henrika_webrtc
...and we are green ;-)
3 years, 9 months ago (2017-03-24 15:45:46 UTC) #62
aleloi
Looks good! A few comments more. https://codereview.webrtc.org/2665693002/diff/480001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (left): https://codereview.webrtc.org/2665693002/diff/480001/webrtc/voice_engine/channel.cc#oldcode1118 webrtc/voice_engine/channel.cc:1118: This is a ...
3 years, 9 months ago (2017-03-24 16:59:50 UTC) #63
henrika_webrtc
Thanks Alex. Just added some comments. https://codereview.webrtc.org/2665693002/diff/480001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (left): https://codereview.webrtc.org/2665693002/diff/480001/webrtc/voice_engine/channel.cc#oldcode1118 webrtc/voice_engine/channel.cc:1118: Honestly don't know ...
3 years, 9 months ago (2017-03-24 17:09:36 UTC) #64
the sun
Good stuff! Have you measured if there is any change in latency (presumably an increase) ...
3 years, 9 months ago (2017-03-24 20:51:31 UTC) #65
henrika_webrtc
I have done some extended measurements on my Pixel device. I measure the time from ...
3 years, 9 months ago (2017-03-27 12:20:50 UTC) #66
henrika_webrtc
PTAL My plan was to remove some logs once OK from both reviewers.
3 years, 9 months ago (2017-03-27 12:22:05 UTC) #67
henrika_webrtc
Forgot, I should also move resampling to the queue. Stay tuned.
3 years, 9 months ago (2017-03-27 13:17:43 UTC) #68
henrika_webrtc
Discussed with Alex off-line. Costs one extra copy to do resampling on the queue. Will ...
3 years, 9 months ago (2017-03-27 14:30:04 UTC) #69
henrika_webrtc
Sorry for all the rounds. Moved audio frame out from queue task. Makes code for ...
3 years, 9 months ago (2017-03-27 15:29:05 UTC) #70
the sun
https://codereview.webrtc.org/2665693002/diff/560001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/560001/webrtc/voice_engine/channel.cc#newcode420 webrtc/voice_engine/channel.cc:420: bool Run() override { Given the simplicity, could you ...
3 years, 8 months ago (2017-03-28 12:57:50 UTC) #83
tommi
I just realized I had to stop reviewing a while ago. These comments may be ...
3 years, 8 months ago (2017-03-28 13:01:40 UTC) #85
henrika_webrtc
Tommi, sorry for all the rounds but the swap queue is no longer used ;-) ...
3 years, 8 months ago (2017-03-28 13:10:08 UTC) #86
henrika_webrtc
...hence, no need to review audio_device_buffer.h/.cc
3 years, 8 months ago (2017-03-28 13:13:41 UTC) #87
the sun
A few more comments https://codereview.webrtc.org/2665693002/diff/560001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/560001/webrtc/voice_engine/channel.cc#newcode465 webrtc/voice_engine/channel.cc:465: _lastLocalTimeStamp = timeStamp; Appears unused ...
3 years, 8 months ago (2017-03-28 13:28:29 UTC) #88
tommi
https://codereview.webrtc.org/2665693002/diff/560001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/560001/webrtc/voice_engine/channel.cc#newcode420 webrtc/voice_engine/channel.cc:420: bool Run() override { On 2017/03/28 12:57:50, the sun ...
3 years, 8 months ago (2017-03-28 13:47:20 UTC) #89
henrika_webrtc
FYI, uploaded parts of proposed changes 1(2). Will continue tomorrow. The changes are rather extensive. ...
3 years, 8 months ago (2017-03-28 15:59:58 UTC) #90
henrika_webrtc
Launched some try bots over night to check changes done so far.
3 years, 8 months ago (2017-03-28 16:11:10 UTC) #93
the sun
https://codereview.webrtc.org/2665693002/diff/560001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/560001/webrtc/voice_engine/channel.cc#newcode420 webrtc/voice_engine/channel.cc:420: bool Run() override { On 2017/03/28 13:47:20, tommi (webrtc) ...
3 years, 8 months ago (2017-03-28 23:05:40 UTC) #100
henrika_webrtc
Thanks guys, done my best to comply with as many change proposals as possible. Some ...
3 years, 8 months ago (2017-03-29 10:35:12 UTC) #101
henrika_webrtc
Asking for new round even if I have not implemented all proposed changes. See motivations ...
3 years, 8 months ago (2017-03-29 11:36:20 UTC) #106
the sun
lgtm & comments https://codereview.webrtc.org/2665693002/diff/640001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/640001/webrtc/voice_engine/channel.cc#newcode418 webrtc/voice_engine/channel.cc:418: : audio_frame_(std::move(audio_frame)), channel_(channel) {} super nit: ...
3 years, 8 months ago (2017-03-30 10:13:33 UTC) #111
henrika_webrtc
Done. Tommi: would you mind one last check ;-) https://codereview.webrtc.org/2665693002/diff/640001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/640001/webrtc/voice_engine/channel.cc#newcode418 webrtc/voice_engine/channel.cc:418: ...
3 years, 8 months ago (2017-03-30 11:16:31 UTC) #112
tommi
https://codereview.webrtc.org/2665693002/diff/680001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/680001/webrtc/voice_engine/channel.cc#newcode1146 webrtc/voice_engine/channel.cc:1146: RTC_DCHECK(encoder_queue); should we also add: RTC_DCHECK(!encoder_queue_); (note: that's making ...
3 years, 8 months ago (2017-03-31 09:44:10 UTC) #117
the sun
https://codereview.webrtc.org/2665693002/diff/680001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/680001/webrtc/voice_engine/channel.cc#newcode1245 webrtc/voice_engine/channel.cc:1245: channel_state_.SetSending(false); On 2017/03/31 09:44:10, tommi (webrtc) wrote: > It's ...
3 years, 8 months ago (2017-03-31 10:19:37 UTC) #118
aleloi
lgtm https://codereview.webrtc.org/2665693002/diff/660001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/660001/webrtc/voice_engine/channel.cc#newcode2728 webrtc/voice_engine/channel.cc:2728: // Add 10ms of raw (PCM) audio data ...
3 years, 8 months ago (2017-03-31 10:34:40 UTC) #119
the sun
https://codereview.webrtc.org/2665693002/diff/660001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/660001/webrtc/voice_engine/channel.cc#newcode2848 webrtc/voice_engine/channel.cc:2848: // a shared helper. On 2017/03/31 10:34:40, aleloi wrote: ...
3 years, 8 months ago (2017-03-31 10:49:20 UTC) #120
tommi
sorry, I meant to hit the 'lgtm' button in the last round, so doing that ...
3 years, 8 months ago (2017-03-31 10:58:52 UTC) #121
the sun
https://codereview.webrtc.org/2665693002/diff/680001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/680001/webrtc/voice_engine/channel.cc#newcode1245 webrtc/voice_engine/channel.cc:1245: channel_state_.SetSending(false); On 2017/03/31 10:58:52, tommi (webrtc) wrote: > On ...
3 years, 8 months ago (2017-03-31 11:04:10 UTC) #122
henrika_webrtc
Thanks all. Landing a compromise solution. https://codereview.webrtc.org/2665693002/diff/660001/webrtc/voice_engine/channel.cc File webrtc/voice_engine/channel.cc (right): https://codereview.webrtc.org/2665693002/diff/660001/webrtc/voice_engine/channel.cc#newcode2728 webrtc/voice_engine/channel.cc:2728: // Add 10ms ...
3 years, 8 months ago (2017-03-31 11:42:47 UTC) #123
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.webrtc.org/2665693002/700001
3 years, 8 months ago (2017-03-31 11:43:35 UTC) #126
commit-bot: I haz the power
3 years, 8 months ago (2017-03-31 12:43:45 UTC) #129
Message was sent while issue was closed.
Committed patchset #35 (id:700001) as
https://chromium.googlesource.com/external/webrtc/+/ec6fbd277623cc60007d6a57d...

Powered by Google App Engine
This is Rietveld 408576698