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

Issue 2763383002: Switching AudioInputDeviceManager from using AudioManager interface to AudioSystem one. (Closed)

Created:
3 years, 9 months ago by o1ka
Modified:
3 years, 8 months ago
CC:
audio-mojo-cl_google.com, chfremer+watch_chromium.org, chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, Max Morin, miu+watch_chromium.org, posciak+watch_chromium.org, xjz+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Switching AudioInputDeviceManager from using AudioManager interface to AudioSystem one. 1) AudioSystem::GetAssociatedOutputDeviceID() is added + unit tests for it; 2) DeviceOpener helper for AudioInputDeviceManager is introduced, which operates on audio thread and navigates through a sequence of calls to AudioSystem, to receive the reply asynchronously and make the next request until the whole device opening sequence is completed. 3) I chose to make DeviceOpener to work on audio thread to reduce the number of thread hops. But it comes with a cost of accessing AudioSystem on audio thread. To make that work correctly during shutdown, weak pointer access to AudioSystem is added + deleter which destroys it on audio thread. Alternatively, we can make all the requests to AudioSystem from IO thread - then we don't need to care about AudioSystem lifetime, but will be hopping between audio thread and IO several times. 4) AudioInputDeviceManager unit tests are updated to take threading into account. 5) Now we have multiple post-reply events in the device opening sequence instead of one synchronous call. "Media.AudioInputDeviceManager.OpenOnDeviceThreadTime" metric already exists to measure the time of device opening. I reused it, so we'll be able to measure the effect of the change. 6) In the future this sequence of posts and replies will be a series of Mojo IPC exchanges. So we may reconsider the interface later to minimize IPC hops if the metric is seriously affected after switching to Mojo. BUG=672468 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel TBR=alokp@chromium.org Review-Url: https://codereview.chromium.org/2763383002 Cr-Commit-Position: refs/heads/master@{#463640} Committed: https://chromium.googlesource.com/chromium/src/+/3dfb4cfaa34efcf58fbf79206197e94402266f18

Patch Set 1 #

Total comments: 4

Patch Set 2 : (fails on Mac in content_unittests) #

Total comments: 4

Patch Set 3 : WeakPtr removed; combined GetInputDeviceInfo operation introduced #

Total comments: 20

Patch Set 4 : fix for AudioManager destruction in tests (will be overriden by alokp@ CL) #

Total comments: 1

Patch Set 5 : review comments addressed #

Total comments: 15

Patch Set 6 : Comments updated #

Patch Set 7 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+268 lines, -140 lines) Patch
M content/browser/browser_main_loop.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M content/browser/renderer_host/media/audio_input_device_manager.h View 1 4 chunks +12 lines, -16 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_device_manager.cc View 1 2 3 4 5 7 chunks +56 lines, -81 lines 0 comments Download
M content/browser/renderer_host/media/audio_input_device_manager_unittest.cc View 1 2 3 4 9 chunks +33 lines, -11 lines 0 comments Download
M content/browser/renderer_host/media/media_stream_manager.cc View 1 chunk +1 line, -2 lines 0 comments Download
M content/browser/speech/speech_recognizer_impl_unittest.cc View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M media/audio/audio_manager.cc View 1 2 3 4 5 1 chunk +12 lines, -14 lines 0 comments Download
M media/audio/audio_system.h View 1 2 3 4 5 6 2 chunks +20 lines, -6 lines 0 comments Download
M media/audio/audio_system_impl.h View 1 2 3 4 5 6 1 chunk +7 lines, -2 lines 0 comments Download
M media/audio/audio_system_impl.cc View 1 2 3 4 5 6 4 chunks +52 lines, -5 lines 0 comments Download
M media/audio/audio_system_impl_unittest.cc View 1 2 3 4 5 6 4 chunks +60 lines, -1 line 0 comments Download
M media/audio/mock_audio_manager.h View 3 chunks +5 lines, -0 lines 0 comments Download
M media/audio/mock_audio_manager.cc View 2 chunks +8 lines, -1 line 0 comments Download

Dependent Patchsets:

Messages

Total messages: 55 (23 generated)
o1ka
guidou@, dalecurtis@ - PTAL https://codereview.chromium.org/2763383002/diff/1/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/1/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode209 content/browser/renderer_host/media/audio_input_device_manager.cc:209: UMA_HISTOGRAM_TIMES("Media.AudioInputDeviceManager.OpenOnDeviceThreadTime", TODO: Make sure UMA ...
3 years, 9 months ago (2017-03-22 17:09:33 UTC) #6
Max Morin
I think it makes sense to supply this information when enumerating, rather than having the ...
3 years, 9 months ago (2017-03-22 17:46:25 UTC) #9
o1ka
On 2017/03/22 17:46:25, Max Morin wrote: > I think it makes sense to supply this ...
3 years, 9 months ago (2017-03-22 17:59:34 UTC) #10
o1ka
I see some tests are failing with shutdown issues, but still let's discuss the approach. ...
3 years, 9 months ago (2017-03-22 18:06:49 UTC) #11
DaleCurtis
Please redesign to avoid externally vended WeakPtrs. They should really only be used for internal ...
3 years, 9 months ago (2017-03-22 19:08:34 UTC) #12
o1ka
On 2017/03/22 19:08:34, DaleCurtis wrote: > Please redesign to avoid externally vended WeakPtrs. They should ...
3 years, 9 months ago (2017-03-23 14:58:55 UTC) #13
DaleCurtis
On 2017/03/23 at 14:58:55, olka wrote: > On 2017/03/22 19:08:34, DaleCurtis wrote: > > Please ...
3 years, 9 months ago (2017-03-23 17:35:20 UTC) #14
o1ka
On 2017/03/23 17:35:20, DaleCurtis wrote: > On 2017/03/23 at 14:58:55, olka wrote: > > On ...
3 years, 9 months ago (2017-03-23 18:42:00 UTC) #15
DaleCurtis
You're missing that I forgot alokp@ deleted all that code :) Sorry for the confusion. ...
3 years, 9 months ago (2017-03-23 19:00:38 UTC) #17
alokp
On 2017/03/23 19:00:38, DaleCurtis wrote: > You're missing that I forgot alokp@ deleted all that ...
3 years, 9 months ago (2017-03-23 21:04:40 UTC) #18
DaleCurtis
On 2017/03/23 at 21:04:40, alokp wrote: > On 2017/03/23 19:00:38, DaleCurtis wrote: > > You're ...
3 years, 9 months ago (2017-03-23 23:03:41 UTC) #19
alokp
On 2017/03/23 23:03:41, DaleCurtis wrote: > On 2017/03/23 at 21:04:40, alokp wrote: > > On ...
3 years, 9 months ago (2017-03-24 04:40:54 UTC) #20
o1ka
On 2017/03/24 04:40:54, alokp wrote: > On 2017/03/23 23:03:41, DaleCurtis wrote: > > On 2017/03/23 ...
3 years, 9 months ago (2017-03-24 13:59:22 UTC) #21
o1ka
On 2017/03/24 13:59:22, o1ka wrote: > On 2017/03/24 04:40:54, alokp wrote: > > On 2017/03/23 ...
3 years, 9 months ago (2017-03-27 09:12:45 UTC) #22
o1ka
PTAL, see my comments https://codereview.chromium.org/2763383002/diff/40001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/40001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode96 content/browser/renderer_host/media/audio_input_device_manager.cc:96: device.id, base::Bind(&AudioInputDeviceManager::OpenedOnIOThread, this, Since AudioSystem ...
3 years, 8 months ago (2017-03-28 16:40:16 UTC) #25
o1ka
still need to fix shutdown in content unittests on Mac - PTAL anyways
3 years, 8 months ago (2017-03-28 17:26:24 UTC) #26
DaleCurtis
https://codereview.chromium.org/2763383002/diff/40001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/40001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode96 content/browser/renderer_host/media/audio_input_device_manager.cc:96: device.id, base::Bind(&AudioInputDeviceManager::OpenedOnIOThread, this, On 2017/03/28 at 16:40:16, o1ka wrote: ...
3 years, 8 months ago (2017-03-28 18:22:11 UTC) #27
o1ka
Please see my questions and answers. https://codereview.chromium.org/2763383002/diff/40001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/40001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode96 content/browser/renderer_host/media/audio_input_device_manager.cc:96: device.id, base::Bind(&AudioInputDeviceManager::OpenedOnIOThread, this, ...
3 years, 8 months ago (2017-03-30 15:11:53 UTC) #30
Guido Urdaneta
https://codereview.chromium.org/2763383002/diff/20001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/20001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode80 content/browser/renderer_host/media/audio_input_device_manager.cc:80: audio_system_->GetAssociatedOutputDeviceID( If the device is fake, does GetAssociatedOutputDeviceID do ...
3 years, 8 months ago (2017-04-03 13:04:39 UTC) #33
Guido Urdaneta
https://codereview.chromium.org/2763383002/diff/40001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/40001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode96 content/browser/renderer_host/media/audio_input_device_manager.cc:96: device.id, base::Bind(&AudioInputDeviceManager::OpenedOnIOThread, this, On 2017/04/03 13:04:39, Guido Urdaneta wrote: ...
3 years, 8 months ago (2017-04-03 20:13:08 UTC) #34
o1ka
Addressed the comments; the CL is pending AudioManager/AudioSystem lifetime fixes. https://codereview.chromium.org/2763383002/diff/20001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/20001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode80 ...
3 years, 8 months ago (2017-04-05 14:21:22 UTC) #35
o1ka
Dear reviewers, I have a question on this CL: AudioManager/AudioSystem lifetime issue is not specific ...
3 years, 8 months ago (2017-04-06 13:15:39 UTC) #40
Guido Urdaneta
https://codereview.chromium.org/2763383002/diff/80001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/80001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode76 content/browser/renderer_host/media/audio_input_device_manager.cc:76: // AudioInputDeviceManager destruction on the main thread. Update the ...
3 years, 8 months ago (2017-04-06 14:26:41 UTC) #41
DaleCurtis
https://codereview.chromium.org/2763383002/diff/80001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/80001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode176 content/browser/renderer_host/media/audio_input_device_manager.cc:176: info.device.input.sample_rate = input_params.sample_rate(); We have the copy constructor enabled ...
3 years, 8 months ago (2017-04-06 18:37:17 UTC) #42
o1ka
Updated comments, replied to the questions. https://codereview.chromium.org/2763383002/diff/80001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/80001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode76 content/browser/renderer_host/media/audio_input_device_manager.cc:76: // AudioInputDeviceManager destruction ...
3 years, 8 months ago (2017-04-07 12:22:17 UTC) #43
DaleCurtis
Okay, this lgtm if you don't see anyone else introducing issues around this before it's ...
3 years, 8 months ago (2017-04-10 19:40:00 UTC) #44
Guido Urdaneta
content/browser/renderer_host/media lgtm https://codereview.chromium.org/2763383002/diff/80001/content/browser/renderer_host/media/audio_input_device_manager.cc File content/browser/renderer_host/media/audio_input_device_manager.cc (right): https://codereview.chromium.org/2763383002/diff/80001/content/browser/renderer_host/media/audio_input_device_manager.cc#newcode79 content/browser/renderer_host/media/audio_input_device_manager.cc:79: audio_system_->GetAssociatedOutputDeviceID( On 2017/04/07 12:22:17, o1ka wrote: > ...
3 years, 8 months ago (2017-04-11 09:44:56 UTC) #45
o1ka
Thanks dalecurtis@ and guidou@. kinuko@chromium.org: Please RS content/browser/speech/speech_recognizer_impl_unittest.cc and content/browser/browser_main_loop.h.
3 years, 8 months ago (2017-04-11 09:48:38 UTC) #47
kinuko
lgtm
3 years, 8 months ago (2017-04-11 14:04:42 UTC) #48
o1ka
On 2017/04/11 14:04:42, kinuko wrote: > lgtm Thanks kinuko@
3 years, 8 months ago (2017-04-11 14:15:17 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/2763383002/120001
3 years, 8 months ago (2017-04-11 14:15:53 UTC) #51
commit-bot: I haz the power
3 years, 8 months ago (2017-04-11 15:44:33 UTC) #55
Message was sent while issue was closed.
Committed patchset #7 (id:120001) as
https://chromium.googlesource.com/chromium/src/+/3dfb4cfaa34efcf58fbf79206197...

Powered by Google App Engine
This is Rietveld 408576698