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

Issue 1570043002: Implement MediaSession on top of the WebMediaPlayerDelegate. (Closed)

Created:
4 years, 11 months ago by DaleCurtis
Modified:
4 years, 11 months ago
CC:
avayvod+watch_chromium.org, chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, jam, mcasas+watch_chromium.org, mkwst+moarreviews-renderer_chromium.org, posciak+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@media_session
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement MediaSession on top of the WebMediaPlayerDelegate. Extracts the existing MediaSession usage from the browser media player manager and moves it into the WebMediaPlayerDelegate where it can be shared by both the desktop and android media players. Notes: - Removes RenderFrameObserver from all WebMediaPlayers since the delegate observer interface handles all of their needs. - The MediaStream WebMediaPlayer now has MediaSession support. - Currently the WMPI has no concept of requesting permission to play, the WMPA behavior has been preserved via a request to the MediaWebContentsObserverAndroid from BrowserMediaPlayerManager. - Fixes flakiness issues with the MediaSession tests which were not completely waiting for playback to start before moving on with test expectations. - Extracts misplaced delegate messages from frame_messages.h and puts them in their own media_player_delegate_messages.h file. - During the message move, cleans up the player_cookie (a int64_t pointer) in favor of a plain int. Renames messages for the better. - Removes all delegate calls from the cast adapter since they are always remote type which should be ignored anyways. - |has_audio| is sticky in the MediaSessionController since WMPA can't be relied upon to provide a true value and plumbing the value from every MediaPlayerAndroid is non-trivial. - Fixes MediaSession ContentShellTests which were passing on the bots by happy circumstance -- the bots do not appear able to play the .ogg files checked in -- instead instantly ending. Test were fixed by adding .mp3 variants. BUG=529887, 580626 TEST=new tests, existing MediaSession tests pass with and without the unified media pipeline flag, manual verification of background behavior. Committed: https://crrev.com/bb3eaacc70007d44dc7788fcbbe106977f49b066 Cr-Commit-Position: refs/heads/master@{#371870}

Patch Set 1 #

Total comments: 12

Patch Set 2 : Merge. Cleanup. Fix RequestPlay. #

Total comments: 5

Patch Set 3 : Rebase. Minor cleanup. #

Patch Set 4 : Fix all the things. #

Patch Set 5 : Rebase yet again. #

Total comments: 44

Patch Set 6 : Address comments. #

Total comments: 6

Patch Set 7 : Comments. Fix test? #

Total comments: 18

Patch Set 8 : Comments. Switch to mp3. #

Total comments: 2

Patch Set 9 : Reorder. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1023 lines, -295 lines) Patch
M chrome/browser/media/android/remote/remote_media_player_manager.h View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/media/android/remote/remote_media_player_manager.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -12 lines 0 comments Download
M content/browser/media/android/browser_media_player_manager.h View 1 2 3 4 5 6 7 6 chunks +7 lines, -10 lines 0 comments Download
M content/browser/media/android/browser_media_player_manager.cc View 1 2 3 4 5 8 chunks +9 lines, -50 lines 0 comments Download
A content/browser/media/android/media_session_controller.h View 1 2 3 4 5 6 7 1 chunk +69 lines, -0 lines 0 comments Download
A content/browser/media/android/media_session_controller.cc View 1 2 3 4 5 6 7 1 chunk +109 lines, -0 lines 0 comments Download
A content/browser/media/android/media_session_controller_unittest.cc View 1 2 3 4 5 6 7 1 chunk +216 lines, -0 lines 0 comments Download
M content/browser/media/android/media_web_contents_observer_android.h View 1 2 3 4 5 6 7 8 4 chunks +31 lines, -0 lines 0 comments Download
M content/browser/media/android/media_web_contents_observer_android.cc View 1 2 3 4 5 6 7 8 6 chunks +95 lines, -0 lines 0 comments Download
M content/browser/media/media_web_contents_observer.h View 1 2 3 4 5 6 7 8 2 chunks +11 lines, -8 lines 0 comments Download
M content/browser/media/media_web_contents_observer.cc View 1 2 3 4 5 6 7 8 5 chunks +47 lines, -38 lines 0 comments Download
M content/browser/web_contents/web_contents_impl_unittest.cc View 1 2 3 4 5 6 chunks +16 lines, -17 lines 0 comments Download
M content/common/content_message_generator.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M content/common/frame_messages.h View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -10 lines 0 comments Download
A content/common/media/media_player_delegate_messages.h View 1 2 3 4 5 1 chunk +49 lines, -0 lines 0 comments Download
M content/common/media/media_player_messages_android.h View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_common.gypi View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M content/content_tests.gypi View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M content/public/browser/web_contents_observer.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java View 1 2 3 2 chunks +14 lines, -1 line 0 comments Download
M content/renderer/media/android/renderer_media_player_manager.h View 1 2 3 4 5 1 chunk +2 lines, -1 line 0 comments Download
M content/renderer/media/android/renderer_media_player_manager.cc View 1 2 3 4 5 2 chunks +3 lines, -1 line 0 comments Download
M content/renderer/media/android/webmediaplayer_android.h View 1 2 3 4 5 6 8 chunks +29 lines, -15 lines 0 comments Download
M content/renderer/media/android/webmediaplayer_android.cc View 1 2 3 4 5 6 14 chunks +72 lines, -25 lines 0 comments Download
M content/renderer/media/renderer_webmediaplayer_delegate.h View 1 2 3 4 5 2 chunks +17 lines, -7 lines 0 comments Download
M content/renderer/media/renderer_webmediaplayer_delegate.cc View 1 2 3 4 5 2 chunks +63 lines, -19 lines 0 comments Download
M content/renderer/media/webmediaplayer_ms.h View 1 2 3 4 5 6 6 chunks +21 lines, -8 lines 0 comments Download
M content/renderer/media/webmediaplayer_ms.cc View 1 2 3 4 5 11 chunks +39 lines, -20 lines 0 comments Download
A content/test/data/android/media/audio-1second.mp3 View 1 2 3 4 5 6 7 Binary file 0 comments Download
A content/test/data/android/media/audio-2seconds.mp3 View 1 2 3 4 5 6 7 Binary file 0 comments Download
A content/test/data/android/media/audio-6seconds.mp3 View 1 2 3 4 5 6 7 Binary file 0 comments Download
M content/test/data/android/media/media-session.html View 1 2 3 4 5 6 7 1 chunk +3 lines, -0 lines 0 comments Download
M ipc/ipc_message_start.h View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M media/blink/renderer_media_player_interface.h View 1 2 3 4 5 2 chunks +3 lines, -1 line 0 comments Download
M media/blink/webmediaplayer_cast_android.h View 1 2 3 4 5 3 chunks +5 lines, -4 lines 0 comments Download
M media/blink/webmediaplayer_cast_android.cc View 1 2 3 4 5 8 chunks +8 lines, -19 lines 0 comments Download
M media/blink/webmediaplayer_delegate.h View 1 2 3 4 5 6 1 chunk +21 lines, -11 lines 0 comments Download
M media/blink/webmediaplayer_impl.h View 1 2 3 4 5 6 3 chunks +15 lines, -0 lines 0 comments Download
M media/blink/webmediaplayer_impl.cc View 1 2 3 4 5 13 chunks +41 lines, -15 lines 0 comments Download

Messages

Total messages: 81 (33 generated)
DaleCurtis
Mounir, as discussed this morning -- let me know your high level feedback. I'm especially ...
4 years, 11 months ago (2016-01-08 01:56:37 UTC) #2
mlamouri (slow - plz ping)
On 2016/01/08 at 01:56:37, dalecurtis wrote: > Mounir, as discussed this morning -- let me ...
4 years, 11 months ago (2016-01-08 15:08:43 UTC) #8
whywhat
On 2016/01/08 at 15:08:43, mlamouri wrote: > On 2016/01/08 at 01:56:37, dalecurtis wrote: > > ...
4 years, 11 months ago (2016-01-08 15:21:57 UTC) #9
mlamouri (slow - plz ping)
On 2016/01/08 at 15:21:57, avayvod wrote: > On 2016/01/08 at 15:08:43, mlamouri wrote: > > ...
4 years, 11 months ago (2016-01-08 15:29:45 UTC) #10
DaleCurtis
Well focus or permission, it's a rose by any other name :) In both cases ...
4 years, 11 months ago (2016-01-08 18:42:18 UTC) #11
Tima Vaisburd
On 2016/01/08 15:08:43, Mounir Lamouri wrote: > What's happening is that, on > Android, we ...
4 years, 11 months ago (2016-01-08 19:50:59 UTC) #12
mlamouri (slow - plz ping)
On 2016/01/08 at 18:42:18, dalecurtis wrote: > Well focus or permission, it's a rose by ...
4 years, 11 months ago (2016-01-11 17:14:37 UTC) #13
mlamouri (slow - plz ping)
I've created a CL that add an UMA to check how ofter requestAudioFocus() fails.
4 years, 11 months ago (2016-01-11 17:31:52 UTC) #14
mlamouri (slow - plz ping)
On 2016/01/11 at 17:31:52, Mounir Lamouri wrote: > I've created a CL that add an ...
4 years, 11 months ago (2016-01-11 17:32:00 UTC) #15
DaleCurtis
On 2016/01/11 17:14:37, Mounir Lamouri wrote: > I understand. That sounds painful but ultimately, if ...
4 years, 11 months ago (2016-01-12 02:09:08 UTC) #16
mlamouri (slow - plz ping)
https://codereview.chromium.org/1570043002/diff/1/content/browser/media/android/media_web_contents_observer_android.cc File content/browser/media/android/media_web_contents_observer_android.cc (right): https://codereview.chromium.org/1570043002/diff/1/content/browser/media/android/media_web_contents_observer_android.cc#newcode25 content/browser/media/android/media_web_contents_observer_android.cc:25: class MediaSessionController : public MediaSessionObserver { Maybe this could ...
4 years, 11 months ago (2016-01-14 15:43:08 UTC) #17
DaleCurtis
Just comments for now. I'll clean up after branch cut. https://codereview.chromium.org/1570043002/diff/1/content/browser/media/android/media_web_contents_observer_android.cc File content/browser/media/android/media_web_contents_observer_android.cc (right): https://codereview.chromium.org/1570043002/diff/1/content/browser/media/android/media_web_contents_observer_android.cc#newcode25 ...
4 years, 11 months ago (2016-01-14 18:21:18 UTC) #18
DaleCurtis
Actually had time to cleanup today; still haven't pulled out MediaSessionController into a new file ...
4 years, 11 months ago (2016-01-14 23:15:54 UTC) #21
mlamouri (slow - plz ping)
Could you rebase and run the tests? I think it's bitrotted :( https://codereview.chromium.org/1570043002/diff/1/content/browser/media/android/media_web_contents_observer_android.cc File content/browser/media/android/media_web_contents_observer_android.cc ...
4 years, 11 months ago (2016-01-19 16:59:11 UTC) #22
DaleCurtis
Didn't have time to do any further cleanup today, just rebased. https://codereview.chromium.org/1570043002/diff/1/content/browser/media/android/media_web_contents_observer_android.cc File content/browser/media/android/media_web_contents_observer_android.cc (right): ...
4 years, 11 months ago (2016-01-20 00:43:58 UTC) #23
DaleCurtis
Mounir, can you give this another look today? Thanks!
4 years, 11 months ago (2016-01-21 04:33:27 UTC) #24
mlamouri (slow - plz ping)
I've been testing the change and there seems to be a lot of small bugs. ...
4 years, 11 months ago (2016-01-21 17:26:01 UTC) #25
DaleCurtis
Thanks for the testing. I think I know the root cause there. I'll clean this ...
4 years, 11 months ago (2016-01-21 18:26:25 UTC) #26
DaleCurtis
PTAL. All MediaSession tests now pass (including some new ones) and I've manually verified the ...
4 years, 11 months ago (2016-01-22 02:18:34 UTC) #29
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1570043002/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1570043002/100001
4 years, 11 months ago (2016-01-22 02:33:47 UTC) #33
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: ios_dbg_simulator_ninja on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/ios_dbg_simulator_ninja/builds/120387) ios_rel_device_ninja on ...
4 years, 11 months ago (2016-01-22 02:35:59 UTC) #35
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1570043002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1570043002/120001
4 years, 11 months ago (2016-01-22 04:40:02 UTC) #37
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/linux_android_rel_ng/builds/12114)
4 years, 11 months ago (2016-01-22 08:53:50 UTC) #40
mlamouri (slow - plz ping)
It sgtm apart from from the fact that you don't try to add to the ...
4 years, 11 months ago (2016-01-22 16:58:31 UTC) #41
nasko
https://codereview.chromium.org/1570043002/diff/120001/content/browser/media/android/media_web_contents_observer_android.cc File content/browser/media/android/media_web_contents_observer_android.cc (right): https://codereview.chromium.org/1570043002/diff/120001/content/browser/media/android/media_web_contents_observer_android.cc#newcode139 content/browser/media/android/media_web_contents_observer_android.cc:139: // TODO(dalecurtis): These should no longer be FrameHostMsg. Well, ...
4 years, 11 months ago (2016-01-22 17:28:33 UTC) #42
DaleCurtis
Hmm, Mounir can you talk a bit more about the device you're testing on and ...
4 years, 11 months ago (2016-01-22 17:59:44 UTC) #43
DaleCurtis
Also the resume on return for WMPI is an intentional decision (pre-existing this change), we ...
4 years, 11 months ago (2016-01-22 18:00:37 UTC) #44
DaleCurtis
All comments addressed. Tests should be fixed. Was able to reproduce the issue with the ...
4 years, 11 months ago (2016-01-23 02:11:00 UTC) #52
sandersd (OOO until July 31)
lgtm for webmediaplayer_impl. https://codereview.chromium.org/1570043002/diff/200001/media/blink/webmediaplayer_delegate.h File media/blink/webmediaplayer_delegate.h (right): https://codereview.chromium.org/1570043002/diff/200001/media/blink/webmediaplayer_delegate.h#newcode44 media/blink/webmediaplayer_delegate.h:44: // call RemoveObserver() to unsubscribe from ...
4 years, 11 months ago (2016-01-25 19:11:00 UTC) #53
DaleCurtis
Thanks for review. Comments addressed, single failing test should be resolved as well. https://codereview.chromium.org/1570043002/diff/200001/media/blink/webmediaplayer_delegate.h File ...
4 years, 11 months ago (2016-01-25 21:49:47 UTC) #55
Tima Vaisburd
https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/browser_media_player_manager.cc File content/browser/media/android/browser_media_player_manager.cc (right): https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/browser_media_player_manager.cc#newcode555 content/browser/media/android/browser_media_player_manager.cc:555: AddPlayer(player); Do we need consistency between |players_| and |player_id_to_delegate_id_map_| ...
4 years, 11 months ago (2016-01-26 07:10:14 UTC) #59
DaleCurtis
Hmm, last test is being a pain to fix -- locally the test runs fine, ...
4 years, 11 months ago (2016-01-26 16:17:58 UTC) #60
DaleCurtis
adb log timestamps are accurate, chromium timestamps show exactly: 2295444368 - 2295291954 = 152ms have ...
4 years, 11 months ago (2016-01-26 16:25:18 UTC) #61
Tima Vaisburd
https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/browser_media_player_manager.cc File content/browser/media/android/browser_media_player_manager.cc (right): https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/browser_media_player_manager.cc#newcode555 content/browser/media/android/browser_media_player_manager.cc:555: AddPlayer(player); On 2016/01/26 16:17:58, DaleCurtis wrote: > On 2016/01/26 ...
4 years, 11 months ago (2016-01-26 18:44:20 UTC) #62
mlamouri (slow - plz ping)
lgtm with the session_type bug fixed. https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/media_session_controller.cc File content/browser/media/android/media_session_controller.cc (right): https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/media_session_controller.cc#newcode41 content/browser/media/android/media_session_controller.cc:41: // the BrowserMediaPlayerManagers. ...
4 years, 11 months ago (2016-01-26 21:02:50 UTC) #63
DaleCurtis
(no changes, just comments) https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/media_session_controller.cc File content/browser/media/android/media_session_controller.cc (right): https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/media_session_controller.cc#newcode69 content/browser/media/android/media_session_controller.cc:69: // We already have a ...
4 years, 11 months ago (2016-01-26 21:23:33 UTC) #64
DaleCurtis
https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/media_session_controller.cc File content/browser/media/android/media_session_controller.cc (right): https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/media_session_controller.cc#newcode69 content/browser/media/android/media_session_controller.cc:69: // We already have a session of the correct ...
4 years, 11 months ago (2016-01-26 21:35:08 UTC) #65
DaleCurtis
https://codereview.chromium.org/1570043002/diff/260001/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java File content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java (right): https://codereview.chromium.org/1570043002/diff/260001/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java#newcode102 content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java:102: && DOMUtils.getCurrentTime(webContents, id) > 0; On 2016/01/26 21:23:33, DaleCurtis ...
4 years, 11 months ago (2016-01-26 21:59:27 UTC) #66
Tima Vaisburd
On 2016/01/26 21:59:27, DaleCurtis wrote: > https://codereview.chromium.org/1570043002/diff/260001/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java > File > content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java > (right): > > ...
4 years, 11 months ago (2016-01-26 22:12:20 UTC) #67
DaleCurtis
https://codereview.chromium.org/1570043002/diff/260001/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java File content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java (right): https://codereview.chromium.org/1570043002/diff/260001/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java#newcode102 content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java:102: && DOMUtils.getCurrentTime(webContents, id) > 0; On 2016/01/26 21:59:27, DaleCurtis ...
4 years, 11 months ago (2016-01-27 00:17:08 UTC) #68
DaleCurtis
nasko@, timav@ PTAL. Thanks! https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/browser_media_player_manager.cc File content/browser/media/android/browser_media_player_manager.cc (right): https://codereview.chromium.org/1570043002/diff/260001/content/browser/media/android/browser_media_player_manager.cc#newcode555 content/browser/media/android/browser_media_player_manager.cc:555: AddPlayer(player); On 2016/01/26 18:44:20, Tima ...
4 years, 11 months ago (2016-01-27 02:25:13 UTC) #69
DaleCurtis
https://codereview.chromium.org/1570043002/diff/260001/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java File content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java (right): https://codereview.chromium.org/1570043002/diff/260001/content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java#newcode102 content/public/test/android/javatests/src/org/chromium/content/browser/test/util/DOMUtils.java:102: && DOMUtils.getCurrentTime(webContents, id) > 0; On 2016/01/27 02:25:13, DaleCurtis ...
4 years, 11 months ago (2016-01-27 02:31:12 UTC) #71
Tima Vaisburd
MediaPlayerManager lgtm
4 years, 11 months ago (2016-01-27 02:43:07 UTC) #72
nasko
LGTM https://codereview.chromium.org/1570043002/diff/280001/content/browser/media/media_web_contents_observer.h File content/browser/media/media_web_contents_observer.h (right): https://codereview.chromium.org/1570043002/diff/280001/content/browser/media/media_web_contents_observer.h#newcode58 content/browser/media/media_web_contents_observer.h:58: void OnMediaPaused(RenderFrameHost* render_frame_host, nit: Order would be nice ...
4 years, 11 months ago (2016-01-27 18:19:55 UTC) #73
DaleCurtis
Thanks for reviews everyone! https://codereview.chromium.org/1570043002/diff/280001/content/browser/media/media_web_contents_observer.h File content/browser/media/media_web_contents_observer.h (right): https://codereview.chromium.org/1570043002/diff/280001/content/browser/media/media_web_contents_observer.h#newcode58 content/browser/media/media_web_contents_observer.h:58: void OnMediaPaused(RenderFrameHost* render_frame_host, On 2016/01/27 ...
4 years, 11 months ago (2016-01-27 19:37:27 UTC) #74
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1570043002/300001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1570043002/300001
4 years, 11 months ago (2016-01-27 19:38:48 UTC) #77
commit-bot: I haz the power
Committed patchset #9 (id:300001)
4 years, 11 months ago (2016-01-27 21:10:33 UTC) #79
commit-bot: I haz the power
4 years, 11 months ago (2016-01-27 21:11:32 UTC) #81
Message was sent while issue was closed.
Patchset 9 (id:??) landed as
https://crrev.com/bb3eaacc70007d44dc7788fcbbe106977f49b066
Cr-Commit-Position: refs/heads/master@{#371870}

Powered by Google App Engine
This is Rietveld 408576698