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

Issue 1110833004: Move audio focus control from media/ to content/ and make it per WebContents. (Closed)

Created:
5 years, 7 months ago by mlamouri (slow - plz ping)
Modified:
5 years, 6 months ago
Reviewers:
Ted C, whywhat, qinmin, Torne
CC:
avayvod+watch_chromium.org, chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, mcasas+watch_chromium.org, philipj_slow, posciak+watch_chromium.org, wjia+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Move audio focus control from media/ to content/ and make it per WebContents. This CL is making each WebContents able to grab its own audio focus from the system instead of keeping the audio focus for Chromium regardless of the number of tab producing noise. This is improving Chromium integration in Android by having each tab behave as a user would expect an application to behave. For example, it is now possible to go to a music website, play something then go to Youtube and play a video. The video will automatically pause the music, the same way the native Youtube application would pause a music application. There is a slight "hack" where for sounds known to be short, the audio focus is requested as TRANSIENT_MAY_DUCK in order to not break running media for sound effects. BUG=486878 Committed: https://crrev.com/3d020b1e04e93bbd318105276a89dd3aa4af1a27 Cr-Commit-Position: refs/heads/master@{#331947}

Patch Set 1 #

Patch Set 2 : #

Total comments: 30

Patch Set 3 : rebase #

Patch Set 4 : review comments #

Total comments: 4

Patch Set 5 : with tests #

Total comments: 2

Patch Set 6 : review comments and compile #

Total comments: 11

Patch Set 7 : rebase #

Total comments: 1

Patch Set 8 : #

Patch Set 9 : fixed tests #

Total comments: 33

Patch Set 10 : review comments #

Patch Set 11 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1564 lines, -62 lines) Patch
M android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFullScreenTest.java View 1 2 3 4 9 chunks +10 lines, -10 lines 0 comments Download
M android_webview/javatests/src/org/chromium/android_webview/test/MultipleVideosTest.java View 1 2 3 4 2 chunks +4 lines, -4 lines 0 comments Download
M content/browser/android/browser_jni_registrar.cc View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/media/android/browser_media_player_manager.h View 1 2 3 4 3 chunks +8 lines, -1 line 0 comments Download
M content/browser/media/android/browser_media_player_manager.cc View 1 2 3 4 7 chunks +40 lines, -0 lines 0 comments Download
A content/browser/media/android/media_session.h View 1 2 3 4 5 6 7 8 9 1 chunk +134 lines, -0 lines 0 comments Download
A content/browser/media/android/media_session.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +183 lines, -0 lines 0 comments Download
A content/browser/media/android/media_session_browsertest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +544 lines, -0 lines 0 comments Download
A content/browser/media/android/media_session_observer.h View 1 2 3 4 1 chunk +24 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 1 chunk +3 lines, -0 lines 0 comments Download
M content/content_jni.gypi View 1 chunk +1 line, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 1 chunk +1 line, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/MediaSession.java View 1 2 3 4 5 6 7 8 9 1 chunk +88 lines, -0 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/common/ContentSwitches.java View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
A content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java View 1 2 3 4 5 6 7 8 9 10 1 chunk +371 lines, -0 lines 0 comments Download
M content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java View 1 2 3 4 1 chunk +47 lines, -10 lines 0 comments Download
A content/test/data/android/media/audio-1second.ogg View 1 2 3 4 5 6 7 8 9 10 Binary file 0 comments Download
A content/test/data/android/media/audio-2seconds.ogg View 1 2 3 4 5 6 7 8 Binary file 0 comments Download
A content/test/data/android/media/audio-6seconds.ogg View 1 2 3 4 5 6 7 8 Binary file 0 comments Download
A content/test/data/android/media/media-session.html View 1 2 3 4 5 6 7 8 9 10 1 chunk +27 lines, -0 lines 0 comments Download
A content/test/data/android/media/video-1second.mp4 View 1 2 3 4 5 6 7 8 9 10 Binary file 0 comments Download
A content/test/data/android/media/video-2seconds.mp4 View 1 2 3 4 5 6 7 8 Binary file 0 comments Download
A + content/test/data/android/media/video-6seconds.mp4 View 1 2 3 4 5 6 7 8 Binary file 0 comments Download
M media/base/android/java/src/org/chromium/media/MediaPlayerListener.java View 4 chunks +1 line, -30 lines 0 comments Download
M media/base/android/media_player_bridge.cc View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M media/base/android/media_player_listener.cc View 1 chunk +0 lines, -6 lines 0 comments Download
M media/base/android/media_player_manager.h View 1 1 chunk +6 lines, -0 lines 0 comments Download
M media/base/android/media_source_player.cc View 1 2 3 4 1 chunk +5 lines, -0 lines 0 comments Download
M media/base/android/media_source_player_unittest.cc View 1 2 3 4 5 chunks +56 lines, -1 line 0 comments Download

Messages

Total messages: 33 (6 generated)
mlamouri (slow - plz ping)
5 years, 7 months ago (2015-05-11 20:20:03 UTC) #2
mlamouri (slow - plz ping)
5 years, 7 months ago (2015-05-11 20:41:20 UTC) #3
whywhat
I believe this needs more testing (e.g. remote players, multi window scenarios) and some tests ...
5 years, 7 months ago (2015-05-12 12:50:47 UTC) #4
whywhat
I believe this needs more testing (e.g. remote players, multi window scenarios) and some tests ...
5 years, 7 months ago (2015-05-12 12:50:47 UTC) #5
qinmin
https://codereview.chromium.org/1110833004/diff/20001/content/browser/media/android/browser_media_player_manager.cc File content/browser/media/android/browser_media_player_manager.cc (right): https://codereview.chromium.org/1110833004/diff/20001/content/browser/media/android/browser_media_player_manager.cc#newcode274 content/browser/media/android/browser_media_player_manager.cc:274: void BrowserMediaPlayerManager::OnError(int player_id, int error) { what should happen ...
5 years, 7 months ago (2015-05-15 18:06:20 UTC) #6
mlamouri (slow - plz ping)
Review comments applied. PTAL. Will write some tests tomorrow. https://codereview.chromium.org/1110833004/diff/20001/content/browser/media/android/browser_media_player_manager.cc File content/browser/media/android/browser_media_player_manager.cc (right): https://codereview.chromium.org/1110833004/diff/20001/content/browser/media/android/browser_media_player_manager.cc#newcode164 content/browser/media/android/browser_media_player_manager.cc:164: ...
5 years, 7 months ago (2015-05-19 21:56:17 UTC) #7
qinmin
https://codereview.chromium.org/1110833004/diff/20001/content/browser/media/android/browser_media_player_manager.cc File content/browser/media/android/browser_media_player_manager.cc (right): https://codereview.chromium.org/1110833004/diff/20001/content/browser/media/android/browser_media_player_manager.cc#newcode352 content/browser/media/android/browser_media_player_manager.cc:352: player->GetDuration().InSeconds() > 5 ? MediaSession::Type::Content On 2015/05/19 21:56:15, Mounir ...
5 years, 7 months ago (2015-05-20 21:35:25 UTC) #8
mlamouri (slow - plz ping)
PTAL. This CL does contain tests. https://codereview.chromium.org/1110833004/diff/20001/content/browser/media/android/browser_media_player_manager.cc File content/browser/media/android/browser_media_player_manager.cc (right): https://codereview.chromium.org/1110833004/diff/20001/content/browser/media/android/browser_media_player_manager.cc#newcode352 content/browser/media/android/browser_media_player_manager.cc:352: player->GetDuration().InSeconds() > 5 ...
5 years, 7 months ago (2015-05-22 15:58:53 UTC) #9
mlamouri (slow - plz ping)
+torne@ for android_webview/
5 years, 7 months ago (2015-05-22 16:00:16 UTC) #11
Torne
android_webview LGTM
5 years, 7 months ago (2015-05-22 16:23:54 UTC) #12
qinmin
https://codereview.chromium.org/1110833004/diff/80001/content/browser/media/android/media_session.cc File content/browser/media/android/media_session.cc (right): https://codereview.chromium.org/1110833004/diff/80001/content/browser/media/android/media_session.cc#newcode83 content/browser/media/android/media_session.cc:83: // The session should be reset if a player ...
5 years, 7 months ago (2015-05-22 16:43:23 UTC) #13
mlamouri (slow - plz ping)
PTAL https://codereview.chromium.org/1110833004/diff/80001/content/browser/media/android/media_session.cc File content/browser/media/android/media_session.cc (right): https://codereview.chromium.org/1110833004/diff/80001/content/browser/media/android/media_session.cc#newcode83 content/browser/media/android/media_session.cc:83: // The session should be reset if a ...
5 years, 7 months ago (2015-05-22 19:01:59 UTC) #14
qinmin
https://codereview.chromium.org/1110833004/diff/100001/content/browser/media/android/media_session.h File content/browser/media/android/media_session.h (right): https://codereview.chromium.org/1110833004/diff/100001/content/browser/media/android/media_session.h#newcode42 content/browser/media/android/media_session.h:42: // Returns the MediaSession associated to this WebContents. Create ...
5 years, 7 months ago (2015-05-23 18:16:06 UTC) #15
mlamouri (slow - plz ping)
PTAL https://codereview.chromium.org/1110833004/diff/100001/content/browser/media/android/media_session.h File content/browser/media/android/media_session.h (right): https://codereview.chromium.org/1110833004/diff/100001/content/browser/media/android/media_session.h#newcode42 content/browser/media/android/media_session.h:42: // Returns the MediaSession associated to this WebContents. ...
5 years, 7 months ago (2015-05-23 20:05:28 UTC) #16
mlamouri (slow - plz ping)
On 2015/05/23 at 20:05:28, Mounir Lamouri wrote: > https://codereview.chromium.org/1110833004/diff/100001/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java#newcode25 > content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java:25: * Plays the media ...
5 years, 7 months ago (2015-05-24 17:09:43 UTC) #17
qinmin
https://codereview.chromium.org/1110833004/diff/120001/content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java File content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java (right): https://codereview.chromium.org/1110833004/diff/120001/content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java#newcode161 content/public/android/javatests/src/org/chromium/content/browser/MediaSessionTest.java:161: assertTrue(mAudioFocusChangeListener.waitForFocusStateChange(AudioManager.AUDIOFOCUS_LOSS)); From the trybots, the test is failing on ...
5 years, 7 months ago (2015-05-24 21:33:53 UTC) #18
mlamouri (slow - plz ping)
I solved the trybot issue. It appears that I was using media files that my ...
5 years, 7 months ago (2015-05-26 14:08:02 UTC) #19
Ted C
some general comments, but I will certainly defer to Min's final approval on the change ...
5 years, 7 months ago (2015-05-27 00:59:09 UTC) #20
mlamouri (slow - plz ping)
Review comments applied. PTAL. https://codereview.chromium.org/1110833004/diff/160001/content/browser/media/android/media_session.cc File content/browser/media/android/media_session.cc (right): https://codereview.chromium.org/1110833004/diff/160001/content/browser/media/android/media_session.cc#newcode55 content/browser/media/android/media_session.cc:55: void MediaSession::Initialize() { On 2015/05/27 ...
5 years, 6 months ago (2015-05-28 16:20:41 UTC) #21
qinmin
lgtm
5 years, 6 months ago (2015-05-28 17:46:04 UTC) #22
Ted C
lgtm https://codereview.chromium.org/1110833004/diff/160001/content/browser/media/android/media_session.cc File content/browser/media/android/media_session.cc (right): https://codereview.chromium.org/1110833004/diff/160001/content/browser/media/android/media_session.cc#newcode110 content/browser/media/android/media_session.cc:110: for (auto it = players_.begin(); it != players_.end(); ...
5 years, 6 months ago (2015-05-28 20:46:45 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1110833004/200001
5 years, 6 months ago (2015-05-29 09:30:15 UTC) #26
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_ozone_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_ozone_rel_ng/builds/22480)
5 years, 6 months ago (2015-05-29 10:04:04 UTC) #28
mlamouri (slow - plz ping)
https://codereview.chromium.org/1110833004/diff/160001/content/browser/media/android/media_session.cc File content/browser/media/android/media_session.cc (right): https://codereview.chromium.org/1110833004/diff/160001/content/browser/media/android/media_session.cc#newcode110 content/browser/media/android/media_session.cc:110: for (auto it = players_.begin(); it != players_.end(); ) ...
5 years, 6 months ago (2015-05-29 11:14:13 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1110833004/200001
5 years, 6 months ago (2015-05-29 11:27:33 UTC) #31
commit-bot: I haz the power
Committed patchset #11 (id:200001)
5 years, 6 months ago (2015-05-29 12:34:29 UTC) #32
commit-bot: I haz the power
5 years, 6 months ago (2015-05-29 12:35:19 UTC) #33
Message was sent while issue was closed.
Patchset 11 (id:??) landed as
https://crrev.com/3d020b1e04e93bbd318105276a89dd3aa4af1a27
Cr-Commit-Position: refs/heads/master@{#331947}

Powered by Google App Engine
This is Rietveld 408576698