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

Issue 110173003: Refactor audio manager for Android to avoid heavy tasks at startup (Closed)

Created:
7 years ago by henrika (OOO until Aug 14)
Modified:
7 years ago
CC:
chromium-reviews, feature-media-reviews_chromium.org
Visibility:
Public.

Description

Refactor audio manager for Android to avoid heavy tasks at startup. Main goal of this CL is to avoid all demanding tasks (e.g. initiate audio routing, detect BT devices etc.) at Chrome startup. All we do now is to populate the list of available devices. BT support has been removed but will be added in an upcoming CL. BUG=324464 TEST=media_unittests --gtest-filter=AudioAndroid* R=bulach@chromium.org, tommi@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=240883

Patch Set 1 #

Patch Set 2 : First round #

Patch Set 3 : Removed BT usage and improved state handling #

Total comments: 83

Patch Set 4 : First review round #

Patch Set 5 : Simplified by removing use of updateState. It was redundant #

Patch Set 6 : Improved thread safety #

Total comments: 10

Patch Set 7 : improved the state machine #

Total comments: 9

Patch Set 8 : tommi@ #

Total comments: 4

Patch Set 9 : installed checkstyle #

Patch Set 10 : nits #

Total comments: 10

Patch Set 11 : Now uses HandlerThread #

Total comments: 5

Patch Set 12 : removed WithLock #

Patch Set 13 : nit #

Patch Set 14 : merged #

Total comments: 22

Patch Set 15 : removed mActive state #

Total comments: 18

Patch Set 16 : tommi@ again #

Patch Set 17 : bulach@ #

Patch Set 18 : has->had #

Total comments: 1

Patch Set 19 : nit #

Patch Set 20 : Fixed reported findbugs issues #

Patch Set 21 : rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+306 lines, -240 lines) Patch
M build/android/findbugs_filter/findbugs_known_bugs.txt View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1 chunk +0 lines, -2 lines 0 comments Download
M media/audio/android/audio_android_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2 chunks +53 lines, -0 lines 0 comments Download
M media/audio/android/audio_manager_android.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +3 lines, -2 lines 0 comments Download
M media/audio/android/audio_manager_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 chunks +40 lines, -16 lines 0 comments Download
M media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 chunks +210 lines, -220 lines 0 comments Download

Messages

Total messages: 48 (0 generated)
henrika (OOO until Aug 14)
What's new? BT support removed for now. Will be restored in separate CL. Starting Chrome ...
7 years ago (2013-12-10 16:23:18 UTC) #1
henrika (OOO until Aug 14)
tommi@: care to take a first round of sanity checks? Not done with thread safety ...
7 years ago (2013-12-10 16:34:47 UTC) #2
tommi (sloooow) - chröme
Great! Lots of comments but looks good. https://codereview.chromium.org/110173003/diff/40001/media/audio/android/audio_android_unittest.cc File media/audio/android/audio_android_unittest.cc (right): https://codereview.chromium.org/110173003/diff/40001/media/audio/android/audio_android_unittest.cc#newcode88 media/audio/android/audio_android_unittest.cc:88: // default ...
7 years ago (2013-12-10 21:19:10 UTC) #3
Jói
https://codereview.chromium.org/110173003/diff/40001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/40001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode224 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:224: * TODO(henrika): add comments... Before landing this patch? https://codereview.chromium.org/110173003/diff/40001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode551 ...
7 years ago (2013-12-11 10:52:03 UTC) #4
tommi (sloooow) - chröme
https://codereview.chromium.org/110173003/diff/40001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/40001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode574 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:574: private static boolean isNumeric(String str) { On 2013/12/11 10:52:04, ...
7 years ago (2013-12-11 12:34:25 UTC) #5
henrika (OOO until Aug 14)
Thanks. New round up for review. Passed on some questions since it was not "my ...
7 years ago (2013-12-11 13:16:37 UTC) #6
henrika (OOO until Aug 14)
One more detail. The current version does not select a device until SetAudioDevice is called ...
7 years ago (2013-12-11 13:25:53 UTC) #7
Jói
I have no further comments at the moment, but to be honest I didn't wrap ...
7 years ago (2013-12-11 13:58:35 UTC) #8
henrika (OOO until Aug 14)
Thanks Jói, uploaded a simplified version (still not thread safe) in the mean time.
7 years ago (2013-12-11 14:33:58 UTC) #9
henrika (OOO until Aug 14)
Added locks. Nothing done for the "additional thread comments" added by Tommi.
7 years ago (2013-12-11 14:48:10 UTC) #10
tommi (sloooow) - chröme
comments and suggestions specifically for the SettingsObserver set of variables. https://codereview.chromium.org/110173003/diff/100001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/100001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode112 ...
7 years ago (2013-12-11 15:54:52 UTC) #11
tommi (sloooow) - chröme
https://codereview.chromium.org/110173003/diff/100001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/100001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode184 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:184: mSettingsObserverThread = null; On 2013/12/11 15:54:52, tommi wrote: > ...
7 years ago (2013-12-11 15:57:00 UTC) #12
tommi (sloooow) - chröme
Looked at the new changes. Looking pretty good. https://codereview.chromium.org/110173003/diff/40001/media/audio/android/audio_manager_android.cc File media/audio/android/audio_manager_android.cc (right): https://codereview.chromium.org/110173003/diff/40001/media/audio/android/audio_manager_android.cc#newcode131 media/audio/android/audio_manager_android.cc:131: SetCommunicationAudioModeOn(true); ...
7 years ago (2013-12-11 17:25:04 UTC) #13
henrika (OOO until Aug 14)
#7 does not cover latest comments from tommi@. Improves the internal state machine and makes ...
7 years ago (2013-12-11 18:39:47 UTC) #14
tommi (sloooow) - chröme
https://codereview.chromium.org/110173003/diff/120001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/120001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode105 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:105: private int mActiveAudioDevice = DEVICE_INVALID; I'm not following why ...
7 years ago (2013-12-12 10:03:40 UTC) #15
henrika (OOO until Aug 14)
More changes based on great feedback from Tommi. https://codereview.chromium.org/110173003/diff/40001/media/audio/android/audio_manager_android.cc File media/audio/android/audio_manager_android.cc (right): https://codereview.chromium.org/110173003/diff/40001/media/audio/android/audio_manager_android.cc#newcode131 media/audio/android/audio_manager_android.cc:131: SetCommunicationAudioModeOn(true); ...
7 years ago (2013-12-12 10:57:59 UTC) #16
tommi (sloooow) - chröme
As discussed offline, I'm looking into one other way to clean up the SettingsObserver code. ...
7 years ago (2013-12-12 11:43:14 UTC) #17
henrika (OOO until Aug 14)
Nits and comments. Some questions as well. PTAL. https://codereview.chromium.org/110173003/diff/40001/media/audio/android/audio_manager_android.cc File media/audio/android/audio_manager_android.cc (right): https://codereview.chromium.org/110173003/diff/40001/media/audio/android/audio_manager_android.cc#newcode131 media/audio/android/audio_manager_android.cc:131: SetCommunicationAudioModeOn(true); ...
7 years ago (2013-12-12 12:53:11 UTC) #18
tommi (sloooow) - chröme
Since there's not a clear way to safely stop the current SettingsObserverThread, here's another suggestion ...
7 years ago (2013-12-12 14:29:45 UTC) #19
henrika (OOO until Aug 14)
One initial comment. Working on your change proposals now. https://codereview.chromium.org/110173003/diff/120001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/120001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode105 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:105: ...
7 years ago (2013-12-12 14:45:59 UTC) #20
tommi (sloooow) - chröme
https://codereview.chromium.org/110173003/diff/120001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/120001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode105 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:105: private int mActiveAudioDevice = DEVICE_INVALID; On 2013/12/12 14:46:00, henrika ...
7 years ago (2013-12-12 14:47:51 UTC) #21
henrika (OOO until Aug 14)
New version now using HandlerThread. Added logs to verify that volume changes are received correctly ...
7 years ago (2013-12-12 15:39:15 UTC) #22
henrika (OOO until Aug 14)
> Just some more info. ... > Start Youtube => now audio is mixed (Y+WebRTC). ...
7 years ago (2013-12-12 15:40:52 UTC) #23
tommi (sloooow) - chröme
excellent! thanks for the update :) https://codereview.chromium.org/110173003/diff/180001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/180001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode573 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:573: private int getNumOfAudioDevicesWithLock() ...
7 years ago (2013-12-12 15:48:11 UTC) #24
henrika (OOO until Aug 14)
I can verify that the mode is restored a few seconds after we close the ...
7 years ago (2013-12-12 15:52:11 UTC) #25
henrika (OOO until Aug 14)
comments only https://codereview.chromium.org/110173003/diff/180001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/180001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode573 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:573: private int getNumOfAudioDevicesWithLock() { I was asked ...
7 years ago (2013-12-12 16:01:20 UTC) #26
tommi (sloooow) - chröme
https://codereview.chromium.org/110173003/diff/180001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java File media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java (right): https://codereview.chromium.org/110173003/diff/180001/media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java#newcode573 media/base/android/java/src/org/chromium/media/AudioManagerAndroid.java:573: private int getNumOfAudioDevicesWithLock() { On 2013/12/12 16:01:21, henrika wrote: ...
7 years ago (2013-12-12 16:05:14 UTC) #27
henrika (OOO until Aug 14)
Adding bulach@ as OWNER. We are pretty close here but I need an owner as ...
7 years ago (2013-12-13 08:52:32 UTC) #28
henrika (OOO until Aug 14)
tommi@: Have done tests where I only create an output stream (which does not select ...
7 years ago (2013-12-13 10:43:12 UTC) #29
tommi (sloooow) - chröme
almost there :) https://codereview.chromium.org/110173003/diff/230001/media/audio/android/audio_android_unittest.cc File media/audio/android/audio_android_unittest.cc (right): https://codereview.chromium.org/110173003/diff/230001/media/audio/android/audio_android_unittest.cc#newcode561 media/audio/android/audio_android_unittest.cc:561: // Verify input device enumeration. nit: ...
7 years ago (2013-12-13 11:30:12 UTC) #30
tommi (sloooow) - chröme
On 2013/12/13 10:43:12, henrika wrote: > tommi@: Have done tests where I only create an ...
7 years ago (2013-12-13 11:37:27 UTC) #31
henrika (OOO until Aug 14)
On 2013/12/13 11:37:27, tommi wrote: > On 2013/12/13 10:43:12, henrika wrote: > > tommi@: Have ...
7 years ago (2013-12-13 12:13:38 UTC) #32
bulach
good stuff! mostly nits and suggestions below, I'm sure tommi is far more knowledgeable in ...
7 years ago (2013-12-13 13:49:48 UTC) #33
henrika (OOO until Aug 14)
Fixes based on latest round by Tommi. Marcus; you are next ;-) https://codereview.chromium.org/110173003/diff/230001/media/audio/android/audio_android_unittest.cc File media/audio/android/audio_android_unittest.cc ...
7 years ago (2013-12-13 14:15:26 UTC) #34
tommi (sloooow) - chröme
lgtm
7 years ago (2013-12-13 14:23:27 UTC) #35
henrika (OOO until Aug 14)
Thanks Marcus. Now more encapsulated and thread safe ;-) PTAL https://codereview.chromium.org/110173003/diff/250001/media/audio/android/audio_manager_android.cc File media/audio/android/audio_manager_android.cc (right): https://codereview.chromium.org/110173003/diff/250001/media/audio/android/audio_manager_android.cc#newcode130 ...
7 years ago (2013-12-13 14:58:42 UTC) #36
bulach
lgtm, tiny nit. thanks! https://codereview.chromium.org/110173003/diff/310001/media/audio/android/audio_android_unittest.cc File media/audio/android/audio_android_unittest.cc (right): https://codereview.chromium.org/110173003/diff/310001/media/audio/android/audio_android_unittest.cc#newcode95 media/audio/android/audio_android_unittest.cc:95: LOG(WARNING) << "No input devices ...
7 years ago (2013-12-13 15:17:05 UTC) #37
henrika (OOO until Aug 14)
Now it is perfect ;-)
7 years ago (2013-12-13 15:33:53 UTC) #38
tommi (sloooow) - chröme
w00t! ship it!
7 years ago (2013-12-13 15:35:25 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/henrika@chromium.org/110173003/330001
7 years ago (2013-12-13 15:44:00 UTC) #40
commit-bot: I haz the power
Retried try job too often on android_dbg for step(s) slave_steps http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=android_dbg&number=132728
7 years ago (2013-12-13 17:15:51 UTC) #41
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/henrika@chromium.org/110173003/330001
7 years ago (2013-12-13 17:25:57 UTC) #42
commit-bot: I haz the power
Retried try job too often on android_dbg for step(s) slave_steps http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=android_dbg&number=132771
7 years ago (2013-12-13 18:55:57 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/henrika@chromium.org/110173003/340001
7 years ago (2013-12-14 16:38:24 UTC) #44
commit-bot: I haz the power
Failed to apply patch for media/audio/android/audio_manager_android.cc: While running patch -p1 --forward --force --no-backup-if-mismatch; patching file ...
7 years ago (2013-12-14 16:38:29 UTC) #45
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/henrika@chromium.org/110173003/360001
7 years ago (2013-12-14 17:57:15 UTC) #46
commit-bot: I haz the power
Retried try job too often on linux_rel for step(s) browser_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=linux_rel&number=204218
7 years ago (2013-12-14 18:32:40 UTC) #47
henrika (OOO until Aug 14)
7 years ago (2013-12-16 13:54:11 UTC) #48
Message was sent while issue was closed.
Committed patchset #21 manually as r240883 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698