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

Issue 896673003: Propagate audible state from player to the containing tab (Closed)

Created:
5 years, 10 months ago by Tima Vaisburd
Modified:
5 years, 9 months ago
CC:
chromium-reviews, creis+watch_chromium.org, posciak+watch_chromium.org, avayvod+watch_chromium.org, nasko+codewatch_chromium.org, jam, mcasas+watch_chromium.org, feature-media-reviews_chromium.org, darin-cc_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

Propagate audible state from player to the containing tab. This is part 1 (chromium), part 2 (clank) is https://chrome-internal-review.googlesource.com/#/c/195455/ This CL is only about propagation/plumbing. Neither the reporting of audible state my players nor the consumption (UI notification) are implemented. This patch creates a new object AudioMonitorAndroid and attaches it to MediaWebContentsObserver. The AudioMonitorAndroid maintains the audible state for the tab. It receives notifications from MediaPlayerAndroid objects and sends the resulting notification to the WebContents. BUG=414810 Committed: https://crrev.com/6ad356d3e845ed9b67c5fb799b2ee8290f317268 Cr-Commit-Position: refs/heads/master@{#318823}

Patch Set 1 #

Total comments: 21

Patch Set 2 : Addressed Min comments except processing SetVolume() #

Patch Set 3 : Changed SetVolume() to report audible status. #

Total comments: 10

Patch Set 4 : Back to one volume variable, simplified SetVolume() in MediaPlayerBridge. #

Patch Set 5 : Rebased #

Patch Set 6 : Fixed MediaSourcePlayerTest compilation. #

Total comments: 16

Patch Set 7 : Kept base::WeakPtrFactory the last member as required by android_clank_dbg_recipe #

Patch Set 8 : Addressed Ted's comments and compiled IsAudible() only under OS_ANDROID #

Total comments: 11

Patch Set 9 : Addressing some of Daniel's comments #

Patch Set 10 : AudioStreamMonitor and corresponding Android monitor now have common base class #

Total comments: 18

Patch Set 11 : Addressed comments by Daniel and Min #

Total comments: 2

Patch Set 12 : Fixed implementation of nativeIsPlayingAudio() #

Total comments: 10

Patch Set 13 : Excluded AudioStreamMonitor unittest on Android #

Total comments: 8

Patch Set 14 : Addressed Min's comments #

Patch Set 15 : Fixed Windows compilation. #

Patch Set 16 : Added missing copyright notice #

Unified diffs Side-by-side diffs Delta from patch set Stats (+369 lines, -70 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/android/chrome_web_contents_delegate_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +7 lines, -0 lines 0 comments Download
A content/browser/android/media_players_observer.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +51 lines, -0 lines 0 comments Download
A content/browser/android/media_players_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +60 lines, -0 lines 0 comments Download
M content/browser/media/android/browser_media_player_manager.h View 1 2 3 4 5 6 7 8 9 6 chunks +13 lines, -3 lines 0 comments Download
M content/browser/media/android/browser_media_player_manager.cc View 1 2 3 4 5 6 7 8 9 5 chunks +15 lines, -4 lines 0 comments Download
A content/browser/media/audio_state_provider.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +57 lines, -0 lines 0 comments Download
A content/browser/media/audio_state_provider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +30 lines, -0 lines 0 comments Download
M content/browser/media/audio_stream_monitor.h View 1 2 3 4 5 6 7 8 9 10 6 chunks +8 lines, -21 lines 0 comments Download
M content/browser/media/audio_stream_monitor.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +22 lines, -13 lines 0 comments Download
M content/browser/media/audio_stream_monitor_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +7 lines, -1 line 0 comments Download
M content/browser/media/media_web_contents_observer.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 2 chunks +7 lines, -0 lines 0 comments Download
M content/browser/media/media_web_contents_observer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +22 lines, -2 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +8 lines, -6 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 7 chunks +11 lines, -5 lines 0 comments Download
M content/browser/web_contents/web_contents_impl_unittest.cc View 1 2 3 4 5 6 7 8 9 10 8 chunks +11 lines, -11 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +1 line, -0 lines 0 comments Download
M media/base/android/media_player_android.h View 1 2 3 4 5 6 7 8 9 2 chunks +4 lines, -0 lines 0 comments Download
M media/base/android/media_player_android.cc View 1 2 3 4 5 6 2 chunks +7 lines, -0 lines 0 comments Download
M media/base/android/media_player_bridge.cc View 1 2 3 4 chunks +19 lines, -4 lines 0 comments Download
M media/base/android/media_player_manager.h View 1 chunk +3 lines, -0 lines 0 comments Download
M media/base/android/media_source_player_unittest.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 56 (15 generated)
qinmin
looks pretty good, some comments https://codereview.chromium.org/896673003/diff/1/content/browser/android/audio_monitor_android.cc File content/browser/android/audio_monitor_android.cc (right): https://codereview.chromium.org/896673003/diff/1/content/browser/android/audio_monitor_android.cc#newcode14 content/browser/android/audio_monitor_android.cc:14: , is_audible_(false) { "," ...
5 years, 10 months ago (2015-02-03 20:33:25 UTC) #2
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/1/content/browser/android/audio_monitor_android.cc File content/browser/android/audio_monitor_android.cc (right): https://codereview.chromium.org/896673003/diff/1/content/browser/android/audio_monitor_android.cc#newcode14 content/browser/android/audio_monitor_android.cc:14: , is_audible_(false) { On 2015/02/03 20:33:24, qinmin wrote: > ...
5 years, 10 months ago (2015-02-03 23:53:05 UTC) #3
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/1/media/base/android/media_player_bridge.cc File media/base/android/media_player_bridge.cc (right): https://codereview.chromium.org/896673003/diff/1/media/base/android/media_player_bridge.cc#newcode375 media/base/android/media_player_bridge.cc:375: void MediaPlayerBridge::SetVolume(double volume) { On 2015/02/03 23:53:05, Tima Vaisburd ...
5 years, 10 months ago (2015-02-04 03:04:48 UTC) #4
qinmin
https://codereview.chromium.org/896673003/diff/2/content/browser/android/audio_monitor_android.cc File content/browser/android/audio_monitor_android.cc (right): https://codereview.chromium.org/896673003/diff/2/content/browser/android/audio_monitor_android.cc#newcode14 content/browser/android/audio_monitor_android.cc:14: is_audible_(false) { nit: align this with web_contents_ above https://codereview.chromium.org/896673003/diff/2/content/browser/android/audio_monitor_android.cc#newcode39 ...
5 years, 10 months ago (2015-02-04 03:27:54 UTC) #5
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/2/media/base/android/media_player_bridge.h File media/base/android/media_player_bridge.h (right): https://codereview.chromium.org/896673003/diff/2/media/base/android/media_player_bridge.h#newcode179 media/base/android/media_player_bridge.h:179: double initial_volume_; On 2015/02/04 03:27:54, qinmin wrote: > why ...
5 years, 10 months ago (2015-02-04 17:39:01 UTC) #6
qinmin
https://codereview.chromium.org/896673003/diff/2/media/base/android/media_player_bridge.h File media/base/android/media_player_bridge.h (right): https://codereview.chromium.org/896673003/diff/2/media/base/android/media_player_bridge.h#newcode179 media/base/android/media_player_bridge.h:179: double initial_volume_; On 2015/02/04 17:39:01, Tima Vaisburd wrote: > ...
5 years, 10 months ago (2015-02-04 19:16:17 UTC) #7
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/2/content/browser/android/audio_monitor_android.cc File content/browser/android/audio_monitor_android.cc (right): https://codereview.chromium.org/896673003/diff/2/content/browser/android/audio_monitor_android.cc#newcode14 content/browser/android/audio_monitor_android.cc:14: is_audible_(false) { On 2015/02/04 03:27:54, qinmin wrote: > nit: ...
5 years, 10 months ago (2015-02-05 23:22:27 UTC) #9
qinmin
lgtm
5 years, 10 months ago (2015-02-06 00:10:00 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896673003/70001
5 years, 10 months ago (2015-02-06 00:54:54 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: ios_rel_device_ninja_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_rel_device_ninja_ng/builds/7987)
5 years, 10 months ago (2015-02-06 00:57:43 UTC) #14
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896673003/90001
5 years, 10 months ago (2015-02-06 01:16:06 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/40864)
5 years, 10 months ago (2015-02-06 01:22:54 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896673003/110001
5 years, 10 months ago (2015-02-06 01:53:51 UTC) #21
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/40881)
5 years, 10 months ago (2015-02-06 01:59:58 UTC) #23
Tima Vaisburd
Dan, could you, please, review this CL? You are the owner of some parts it ...
5 years, 10 months ago (2015-02-06 02:19:32 UTC) #25
Tima Vaisburd
5 years, 10 months ago (2015-02-06 23:18:36 UTC) #27
Ted C
overall seems reasonable to me...I'm sad that we can't reuse the audio_stream_monitor_.WasRecentlyAudible(); from WebContentsImpl::WasRecentlyAudible, but ...
5 years, 10 months ago (2015-02-07 00:07:15 UTC) #28
Tima Vaisburd
> I'm sad that we can't reuse the > audio_stream_monitor_.WasRecentlyAudible() [...] > but I'll defer ...
5 years, 10 months ago (2015-02-07 03:00:23 UTC) #29
Ted C
lgtm
5 years, 10 months ago (2015-02-09 23:26:23 UTC) #30
no sievers
https://codereview.chromium.org/896673003/diff/150001/content/browser/android/audio_monitor_android.cc File content/browser/android/audio_monitor_android.cc (right): https://codereview.chromium.org/896673003/diff/150001/content/browser/android/audio_monitor_android.cc#newcode40 content/browser/android/audio_monitor_android.cc:40: for (const auto& player_status : audio_status_map_) { Does this ...
5 years, 10 months ago (2015-02-10 01:33:03 UTC) #31
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/150001/content/browser/android/audio_monitor_android.cc File content/browser/android/audio_monitor_android.cc (right): https://codereview.chromium.org/896673003/diff/150001/content/browser/android/audio_monitor_android.cc#newcode40 content/browser/android/audio_monitor_android.cc:40: for (const auto& player_status : audio_status_map_) { On 2015/02/10 ...
5 years, 10 months ago (2015-02-11 03:34:05 UTC) #33
no sievers
https://codereview.chromium.org/896673003/diff/150001/content/browser/android/audio_monitor_android.cc File content/browser/android/audio_monitor_android.cc (right): https://codereview.chromium.org/896673003/diff/150001/content/browser/android/audio_monitor_android.cc#newcode40 content/browser/android/audio_monitor_android.cc:40: for (const auto& player_status : audio_status_map_) { On 2015/02/11 ...
5 years, 10 months ago (2015-02-12 19:01:11 UTC) #34
Tima Vaisburd
On 2015/02/12 19:01:11, sievers wrote: > https://codereview.chromium.org/896673003/diff/150001/content/browser/android/audio_monitor_android.cc > File content/browser/android/audio_monitor_android.cc (right): > > https://codereview.chromium.org/896673003/diff/150001/content/browser/android/audio_monitor_android.cc#newcode40 > ...
5 years, 10 months ago (2015-02-24 03:03:00 UTC) #35
Tima Vaisburd
5 years, 10 months ago (2015-02-24 03:03:20 UTC) #37
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/190001/content/browser/media/audio_state_provider.h File content/browser/media/audio_state_provider.h (right): https://codereview.chromium.org/896673003/diff/190001/content/browser/media/audio_state_provider.h#newcode25 content/browser/media/audio_state_provider.h:25: static bool audio_state_available(); Does it have to be static?
5 years, 10 months ago (2015-02-24 03:06:50 UTC) #38
qinmin
https://codereview.chromium.org/896673003/diff/190001/content/browser/media/audio_state_provider.h File content/browser/media/audio_state_provider.h (right): https://codereview.chromium.org/896673003/diff/190001/content/browser/media/audio_state_provider.h#newcode25 content/browser/media/audio_state_provider.h:25: static bool audio_state_available(); On 2015/02/24 03:06:50, Tima Vaisburd wrote: ...
5 years, 10 months ago (2015-02-24 18:02:19 UTC) #39
no sievers
https://codereview.chromium.org/896673003/diff/190001/content/browser/android/media_players_observer.cc File content/browser/android/media_players_observer.cc (right): https://codereview.chromium.org/896673003/diff/190001/content/browser/android/media_players_observer.cc#newcode7 content/browser/android/media_players_observer.cc:7: #include <climits> nit: space after line 7 https://codereview.chromium.org/896673003/diff/190001/content/browser/android/media_players_observer.cc#newcode32 content/browser/android/media_players_observer.cc:32: ...
5 years, 10 months ago (2015-02-25 21:22:04 UTC) #40
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/190001/content/browser/android/media_players_observer.cc File content/browser/android/media_players_observer.cc (right): https://codereview.chromium.org/896673003/diff/190001/content/browser/android/media_players_observer.cc#newcode7 content/browser/android/media_players_observer.cc:7: #include <climits> On 2015/02/25 21:22:03, sievers wrote: > nit: ...
5 years, 9 months ago (2015-02-28 03:16:06 UTC) #41
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/210001/content/browser/media/audio_stream_monitor_unittest.cc File content/browser/media/audio_stream_monitor_unittest.cc (right): https://codereview.chromium.org/896673003/diff/210001/content/browser/media/audio_stream_monitor_unittest.cc#newcode56 content/browser/media/audio_stream_monitor_unittest.cc:56: web_contents->SetAudioStateProviderForTesting( Is it better to keep this test on ...
5 years, 9 months ago (2015-03-02 18:37:30 UTC) #42
no sievers
https://codereview.chromium.org/896673003/diff/230001/content/browser/android/media_players_observer.cc File content/browser/android/media_players_observer.cc (right): https://codereview.chromium.org/896673003/diff/230001/content/browser/android/media_players_observer.cc#newcode38 content/browser/android/media_players_observer.cc:38: DCHECK(num_erased_entries == 1); nit: DCHECK_EQ(1u, num_erased_entries); https://codereview.chromium.org/896673003/diff/230001/content/browser/media/media_web_contents_observer.cc File content/browser/media/media_web_contents_observer.cc ...
5 years, 9 months ago (2015-03-02 20:21:24 UTC) #43
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/230001/content/browser/media/media_web_contents_observer.cc File content/browser/media/media_web_contents_observer.cc (right): https://codereview.chromium.org/896673003/diff/230001/content/browser/media/media_web_contents_observer.cc#newcode42 content/browser/media/media_web_contents_observer.cc:42: if (!static_cast<WebContentsImpl*>(web_contents())->IsBeingDestroyed()) { On 2015/03/02 20:21:24, sievers wrote: > ...
5 years, 9 months ago (2015-03-02 21:03:03 UTC) #44
no sievers
On 2015/03/02 21:03:03, Tima Vaisburd wrote: > https://codereview.chromium.org/896673003/diff/230001/content/browser/media/media_web_contents_observer.cc > File content/browser/media/media_web_contents_observer.cc (right): > > https://codereview.chromium.org/896673003/diff/230001/content/browser/media/media_web_contents_observer.cc#newcode42 ...
5 years, 9 months ago (2015-03-02 22:11:13 UTC) #45
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/230001/content/browser/android/media_players_observer.cc File content/browser/android/media_players_observer.cc (right): https://codereview.chromium.org/896673003/diff/230001/content/browser/android/media_players_observer.cc#newcode38 content/browser/android/media_players_observer.cc:38: DCHECK(num_erased_entries == 1); On 2015/03/02 20:21:24, sievers wrote: > ...
5 years, 9 months ago (2015-03-02 22:16:10 UTC) #46
Tima Vaisburd
On 2015/03/02 22:11:13, sievers wrote: > On 2015/03/02 21:03:03, Tima Vaisburd wrote: > > > ...
5 years, 9 months ago (2015-03-02 22:18:26 UTC) #47
no sievers
lgtm if Min is happy
5 years, 9 months ago (2015-03-02 22:19:41 UTC) #48
qinmin
lgtm % comments https://codereview.chromium.org/896673003/diff/250001/chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java File chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java (right): https://codereview.chromium.org/896673003/diff/250001/chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java#newcode74 chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java:74: protected static native boolean nativeIsPlayingAudio(WebContents webContents); ...
5 years, 9 months ago (2015-03-02 22:55:41 UTC) #49
Tima Vaisburd
https://codereview.chromium.org/896673003/diff/250001/chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java File chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java (right): https://codereview.chromium.org/896673003/diff/250001/chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java#newcode74 chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java:74: protected static native boolean nativeIsPlayingAudio(WebContents webContents); On 2015/03/02 22:55:41, ...
5 years, 9 months ago (2015-03-02 23:30:07 UTC) #50
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/896673003/310001
5 years, 9 months ago (2015-03-03 01:35:33 UTC) #53
commit-bot: I haz the power
Committed patchset #16 (id:310001)
5 years, 9 months ago (2015-03-03 03:07:50 UTC) #54
commit-bot: I haz the power
Patchset 16 (id:??) landed as https://crrev.com/6ad356d3e845ed9b67c5fb799b2ee8290f317268 Cr-Commit-Position: refs/heads/master@{#318823}
5 years, 9 months ago (2015-03-03 03:09:32 UTC) #55
aberent
5 years, 9 months ago (2015-03-03 11:21:10 UTC) #56
Message was sent while issue was closed.
A revert of this CL (patchset #16 id:310001) has been created in
https://codereview.chromium.org/972973002/ by aberent@chromium.org.

The reason for reverting is: This (Android only) change breaks the downstream
Android test CastSwitchVideoTest#testNewVideoNewPageSameTab.

Reverting as Android Sheriff.

BUG=463445.

Powered by Google App Engine
This is Rietveld 408576698