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

Issue 1302423006: Ensure that data is not overwritten in the audio input shared memory ring buffer that sits on the b… (Closed)

Created:
5 years, 3 months ago by Henrik Grunell
Modified:
5 years, 3 months ago
CC:
chromium-reviews, posciak+watch_chromium.org, jam, mcasas+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_chromium.org, asvitkine+watch_chromium.org, wjia+watch_chromium.org, miu+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Ensure that data is not overwritten in the audio input shared memory ring buffer that sits on the browser/renderer boundary. This is for "low-latency" audio input streams only. * The reading side (renderer) signals back to the writing side over the socket that it has read a buffer. * The writing side receives the verifications and checks that there is room in the ring buffer before writing so that no data is overwritten. * If the ring buffer is full, log error and drop the data. * Report UMA stats of how many drops we had when the audio input stream is destroyed. * Make SyncSocket::Peek virtual to be able to override in test mocks. * Some refactoring of AudioInputSyncWriter to be able to test it. * Add a new unit test for AudioInputSyncWriter. BUG=523224 NOTRY=true Committed: https://crrev.com/8d9071da52c70d300bfc0cdc0448c564b39764f4 Cr-Commit-Position: refs/heads/master@{#348156}

Patch Set 1 #

Total comments: 8

Patch Set 2 : Code review + rebase. #

Total comments: 7

Patch Set 3 : Code review and rebase. Added unit test, and refactorings for that. #

Total comments: 6

Patch Set 4 : Code review. Unit test improvement. Changed read verification algorithm. #

Total comments: 12

Patch Set 5 : Code review. #

Total comments: 6

Patch Set 6 : Code review. #

Total comments: 2

Patch Set 7 : Code review. Compile fixes. Updated comment in sync_socket.h. #

Patch Set 8 : Rebase #

Patch Set 9 : Tracking down compile errors. #

Total comments: 1

Patch Set 10 : Fixed aligment of data buffer in unit test. Some other Win compile fixes. Rebase. #

Patch Set 11 : Fixed log call expectations for Android in unit test. Rebase. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+430 lines, -36 lines) Patch
M base/sync_socket.h View 1 2 3 4 5 6 1 chunk +2 lines, -4 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_renderer_host.cc View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/renderer_host/media/audio_input_sync_writer.h View 1 2 3 4 5 4 chunks +32 lines, -13 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_sync_writer.cc View 1 2 3 4 5 6 7 8 9 5 chunks +95 lines, -14 lines 0 comments Download
A content/browser/renderer_host/media/audio_input_sync_writer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +265 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -0 lines 0 comments Download
M media/audio/audio_device_thread.cc View 1 chunk +9 lines, -2 lines 0 comments Download
M media/audio/audio_input_controller.h View 1 2 3 4 5 6 7 8 9 1 chunk +1 line, -1 line 0 comments Download
M media/audio/audio_input_device.cc View 1 chunk +1 line, -1 line 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 2 3 4 5 6 7 8 9 10 2 chunks +22 lines, -0 lines 0 comments Download

Messages

Total messages: 47 (10 generated)
Henrik Grunell
There's two "TODO BEFORE COMMIT" in the code, input is welcome.
5 years, 3 months ago (2015-08-27 14:48:19 UTC) #2
tommi (sloooow) - chröme
I'm heading out the door right now, will take a look later. Could we do ...
5 years, 3 months ago (2015-08-27 15:19:47 UTC) #3
Henrik Grunell
On 2015/08/27 15:19:47, tommi wrote: > I'm heading out the door right now, will take ...
5 years, 3 months ago (2015-08-27 15:34:59 UTC) #4
DaleCurtis
Did you consider just using the output system as is with the modification that you ...
5 years, 3 months ago (2015-08-27 16:43:10 UTC) #5
DaleCurtis
https://codereview.chromium.org/1302423006/diff/1/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/1/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode59 content/browser/renderer_host/media/audio_input_sync_writer.cc:59: // TODO BEFORE COMMIT: Maybe percentage makes more sense ...
5 years, 3 months ago (2015-08-27 16:43:39 UTC) #6
henrika (OOO until Aug 14)
Nice work Henrik. Have you tested this scheme under high load and what is the ...
5 years, 3 months ago (2015-08-28 07:56:25 UTC) #7
Henrik Grunell
On 2015/08/27 16:43:10, DaleCurtis wrote: > Did you consider just using the output system as ...
5 years, 3 months ago (2015-08-28 11:18:39 UTC) #8
Henrik Grunell
https://codereview.chromium.org/1302423006/diff/1/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/1/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode20 content/browser/renderer_host/media/audio_input_sync_writer.cc:20: const base::TimeDelta kReadCheckTimeout = On 2015/08/28 07:56:25, henrika wrote: ...
5 years, 3 months ago (2015-08-28 12:21:57 UTC) #9
tommi (sloooow) - chröme
looks good - would be great to see some sort of a test https://codereview.chromium.org/1302423006/diff/20001/content/browser/renderer_host/media/audio_input_sync_writer.cc File ...
5 years, 3 months ago (2015-08-28 13:43:06 UTC) #10
DaleCurtis
On 2015/08/28 11:18:39, Henrik Grunell wrote: > On 2015/08/27 16:43:10, DaleCurtis wrote: > > Did ...
5 years, 3 months ago (2015-08-28 16:39:21 UTC) #11
Henrik Grunell
On 2015/08/28 16:39:21, DaleCurtis wrote: > On 2015/08/28 11:18:39, Henrik Grunell wrote: > > On ...
5 years, 3 months ago (2015-09-02 14:09:22 UTC) #12
Henrik Grunell
https://codereview.chromium.org/1302423006/diff/20001/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/20001/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode21 content/browser/renderer_host/media/audio_input_sync_writer.cc:21: // blocking the soundcard thread and wait before dropping ...
5 years, 3 months ago (2015-09-02 14:27:55 UTC) #13
DaleCurtis
https://codereview.chromium.org/1302423006/diff/40001/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/40001/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode21 content/browser/renderer_host/media/audio_input_sync_writer.cc:21: const base::TimeDelta kReadCheckTimeout = This is a static initializer, ...
5 years, 3 months ago (2015-09-02 16:18:50 UTC) #14
Henrik Grunell
thestig@: please review base/sync_socket.h Tommi and Dale: please review. Code review fixes. Unit test improvement. ...
5 years, 3 months ago (2015-09-03 14:32:33 UTC) #16
tommi (sloooow) - chröme
https://codereview.chromium.org/1302423006/diff/60001/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/60001/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode121 content/browser/renderer_host/media/audio_input_sync_writer.cc:121: ++write_count_; here we increment write_count_ without having actually written ...
5 years, 3 months ago (2015-09-03 14:55:13 UTC) #17
Henrik Grunell
https://codereview.chromium.org/1302423006/diff/60001/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/60001/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode121 content/browser/renderer_host/media/audio_input_sync_writer.cc:121: ++write_count_; On 2015/09/03 14:55:13, tommi wrote: > here we ...
5 years, 3 months ago (2015-09-03 15:29:51 UTC) #18
tommi (sloooow) - chröme
https://codereview.chromium.org/1302423006/diff/60001/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/60001/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode129 content/browser/renderer_host/media/audio_input_sync_writer.cc:129: size_t bytes_received = socket_->ReceiveWithTimeout( On 2015/09/03 15:29:51, Henrik Grunell ...
5 years, 3 months ago (2015-09-03 15:47:53 UTC) #19
DaleCurtis
https://codereview.chromium.org/1302423006/diff/80001/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/80001/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode125 content/browser/renderer_host/media/audio_input_sync_writer.cc:125: while (true) { If you don't want to use ...
5 years, 3 months ago (2015-09-03 16:50:40 UTC) #20
Lei Zhang
base/ lgtm
5 years, 3 months ago (2015-09-03 16:52:24 UTC) #21
Henrik Grunell
jwd@: please review tools/metrics/histograms/histograms.xml Tommi: ptal. https://codereview.chromium.org/1302423006/diff/60001/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/60001/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode129 content/browser/renderer_host/media/audio_input_sync_writer.cc:129: size_t bytes_received = ...
5 years, 3 months ago (2015-09-04 11:52:53 UTC) #23
Henrik Grunell
On 2015/09/04 11:52:53, Henrik Grunell wrote: > jwd@: please review tools/metrics/histograms/histograms.xml > > Tommi: ptal. ...
5 years, 3 months ago (2015-09-04 11:53:24 UTC) #24
DaleCurtis
The Peek() comment isn't accurate anymore, it was written before we had a posix impl: ...
5 years, 3 months ago (2015-09-04 17:15:02 UTC) #25
jwd
https://codereview.chromium.org/1302423006/diff/100001/tools/metrics/histograms/histograms.xml File tools/metrics/histograms/histograms.xml (right): https://codereview.chromium.org/1302423006/diff/100001/tools/metrics/histograms/histograms.xml#newcode16654 tools/metrics/histograms/histograms.xml:16654: + The number of input audio read verifications that ...
5 years, 3 months ago (2015-09-04 19:20:34 UTC) #26
Henrik Grunell
On 2015/09/04 17:15:02, DaleCurtis wrote: > The Peek() comment isn't accurate anymore, it was written ...
5 years, 3 months ago (2015-09-06 12:42:38 UTC) #27
Henrik Grunell
thestig@: Updated comment in base/sync_socket.h, apparently obsolete information. Ptal. Tommi & Dale: ptal. (jwd@: ptal ...
5 years, 3 months ago (2015-09-06 12:45:09 UTC) #28
tommi (sloooow) - chröme
lgtm
5 years, 3 months ago (2015-09-06 17:20:07 UTC) #29
jwd
lgtm
5 years, 3 months ago (2015-09-08 15:10:25 UTC) #30
Henrik Grunell
Dale: I assume you want a final look on this CL?
5 years, 3 months ago (2015-09-08 20:03:15 UTC) #31
DaleCurtis
lgtm https://codereview.chromium.org/1302423006/diff/160001/content/browser/renderer_host/media/audio_input_sync_writer.cc File content/browser/renderer_host/media/audio_input_sync_writer.cc (right): https://codereview.chromium.org/1302423006/diff/160001/content/browser/renderer_host/media/audio_input_sync_writer.cc#newcode132 content/browser/renderer_host/media/audio_input_sync_writer.cc:132: scoped_ptr<uint32_t[]> indices(new uint32_t[number_of_indices_available]); I'd allocate this once at ...
5 years, 3 months ago (2015-09-08 22:53:47 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1302423006/180001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1302423006/180001
5 years, 3 months ago (2015-09-09 16:24:20 UTC) #35
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_rel_ng/builds/104779)
5 years, 3 months ago (2015-09-09 17:52:00 UTC) #37
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1302423006/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1302423006/200001
5 years, 3 months ago (2015-09-10 13:56:00 UTC) #40
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/102240)
5 years, 3 months ago (2015-09-10 14:52:43 UTC) #42
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1302423006/200001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1302423006/200001
5 years, 3 months ago (2015-09-10 15:19:24 UTC) #44
commit-bot: I haz the power
Committed patchset #11 (id:200001)
5 years, 3 months ago (2015-09-10 15:24:52 UTC) #45
commit-bot: I haz the power
Patchset 11 (id:??) landed as https://crrev.com/8d9071da52c70d300bfc0cdc0448c564b39764f4 Cr-Commit-Position: refs/heads/master@{#348156}
5 years, 3 months ago (2015-09-10 15:25:40 UTC) #46
commit-bot: I haz the power
5 years, 3 months ago (2015-09-23 12:10:49 UTC) #47
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/8d9071da52c70d300bfc0cdc0448c564b39764f4
Cr-Commit-Position: refs/heads/master@{#348156}

Powered by Google App Engine
This is Rietveld 408576698