Bug 221431 - [Mac] Connect MediaSession with MediaRemote and NowPlaying
Summary: [Mac] Connect MediaSession with MediaRemote and NowPlaying
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Eric Carlson
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-02-04 15:35 PST by Eric Carlson
Modified: 2021-02-09 14:51 PST (History)
12 users (show)

See Also:


Attachments
Patch (93.34 KB, patch)
2021-02-04 16:01 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch (91.77 KB, patch)
2021-02-04 16:45 PST, Eric Carlson
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (91.83 KB, patch)
2021-02-04 17:35 PST, Eric Carlson
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (91.79 KB, patch)
2021-02-04 17:42 PST, Eric Carlson
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (92.10 KB, patch)
2021-02-04 17:54 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch (91.71 KB, patch)
2021-02-05 04:48 PST, Eric Carlson
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (91.75 KB, patch)
2021-02-05 05:13 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch (91.79 KB, patch)
2021-02-05 10:33 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch for landing (91.55 KB, patch)
2021-02-05 14:25 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch (1.67 KB, patch)
2021-02-08 13:14 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch (2.78 KB, patch)
2021-02-08 17:17 PST, Eric Carlson
no flags Details | Formatted Diff | Diff
Patch (2.40 KB, patch)
2021-02-09 08:19 PST, Eric Carlson
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (2.40 KB, patch)
2021-02-09 08:29 PST, Eric Carlson
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Carlson 2021-02-04 15:35:28 PST
Connect MediaSession with MediaRemote and NowPlaying
Comment 1 Radar WebKit Bug Importer 2021-02-04 15:35:36 PST
<rdar://problem/74000363>
Comment 2 Eric Carlson 2021-02-04 16:01:22 PST
Created attachment 419333 [details]
Patch
Comment 3 Eric Carlson 2021-02-04 16:45:33 PST
Created attachment 419338 [details]
Patch
Comment 4 Eric Carlson 2021-02-04 17:35:23 PST
Created attachment 419344 [details]
Patch
Comment 5 Eric Carlson 2021-02-04 17:42:40 PST
Created attachment 419345 [details]
Patch
Comment 6 Eric Carlson 2021-02-04 17:54:38 PST
Created attachment 419347 [details]
Patch
Comment 7 Eric Carlson 2021-02-05 04:48:48 PST
Created attachment 419388 [details]
Patch
Comment 8 Eric Carlson 2021-02-05 05:13:38 PST
Created attachment 419392 [details]
Patch
Comment 9 Eric Carlson 2021-02-05 10:33:29 PST
Created attachment 419429 [details]
Patch
Comment 10 Jer Noble 2021-02-05 11:02:40 PST
View in context: https://bugs.webkit.org/attachment.cgi?id=419392&action=review

r=me, with just a couple nits.

> Source/WebCore/Modules/mediasession/MediaSession.cpp:54
> +        static const MapEntry entries[] = {

I think this could be `constexpr` rather than just `const`.

> Source/WebCore/Modules/mediasession/MediaSession.cpp:68
> +        HashMap<MediaSessionAction, PlatformMediaSession::RemoteControlCommandType, WTF::IntHash<MediaSessionAction>, WTF::StrongEnumHashTraits<MediaSessionAction>> map;
> +        for (auto& entry : entries)
> +            map.add(entry.action, entry.command);
> +        return map;

I _think_ this whole section could just be written as:

using ActionToCommandMap = HashMap<MediaSessionAction, PlatformMediaSession::RemoteControlCommandType, WTF::IntHash<MediaSessionAction>, WTF::StrongEnumHashTraits<MediaSessionAction>>;
return ActionToCommandMap {
    { MediaSessionAction::Play, PlatformMediaSession::PlayCommand },
...
};

Since HashMap has a constructor that takes an initializer list, but NBD.

> Source/WebCore/platform/mac/RemoteCommandListenerMac.mm:45
> +        static const MapEntry entries[] = {

Same comment about `constexpr` and maybe just using an initializer list here.
Comment 11 Eric Carlson 2021-02-05 14:25:53 PST
Created attachment 419462 [details]
Patch for landing
Comment 12 EWS 2021-02-05 15:19:02 PST
Committed r272445: <https://trac.webkit.org/changeset/272445>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419462 [details].
Comment 13 Eric Carlson 2021-02-08 13:14:45 PST
Reopening to attach new patch.
Comment 14 Eric Carlson 2021-02-08 13:14:47 PST
Created attachment 419618 [details]
Patch
Comment 15 EWS 2021-02-08 13:47:00 PST
Committed r272547: <https://commits.webkit.org/r272547>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419618 [details].
Comment 16 Eric Carlson 2021-02-08 17:17:05 PST
Reopening to attach new patch.
Comment 17 Eric Carlson 2021-02-08 17:17:07 PST
Created attachment 419657 [details]
Patch
Comment 18 EWS 2021-02-08 17:47:09 PST
Committed r272563: <https://commits.webkit.org/r272563>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419657 [details].
Comment 19 Eric Carlson 2021-02-09 08:19:51 PST
Reopening to attach new patch.
Comment 20 Eric Carlson 2021-02-09 08:19:53 PST
Created attachment 419718 [details]
Patch
Comment 21 EWS 2021-02-09 08:21:09 PST
/Volumes/Data/worker/Commit-Queue/build/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).
Comment 22 Eric Carlson 2021-02-09 08:29:30 PST
Created attachment 419719 [details]
Patch
Comment 23 EWS 2021-02-09 09:20:46 PST
commit-queue failed to commit attachment 419719 [details] to WebKit repository. To retry, please set cq+ flag again.
Comment 24 EWS 2021-02-09 10:33:31 PST
Committed r272589: <https://commits.webkit.org/r272589>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 419719 [details].
Comment 25 Alex Christensen 2021-02-09 14:51:15 PST
r272615