Bug 224031

Summary: Previous artwork isn't cleared when NowPlaying info doesn't contain an artwork
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: New BugsAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: eric.carlson, ews-watchlist, glenn, jer.noble, philipj, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Jean-Yves Avenard [:jya] 2021-03-31 17:53:34 PDT
Previous artwork isn't cleared when no NowPlaying info doesn't contain an artwork
Comment 1 Jean-Yves Avenard [:jya] 2021-03-31 17:55:07 PDT
<rdar://76044544>
Comment 2 Jean-Yves Avenard [:jya] 2021-03-31 17:58:59 PDT
Created attachment 424850 [details]
Patch
Comment 3 Jean-Yves Avenard [:jya] 2021-03-31 18:12:49 PDT
Created attachment 424854 [details]
Patch
Comment 4 Jean-Yves Avenard [:jya] 2021-03-31 18:55:46 PDT
Created attachment 424860 [details]
Patch
Comment 5 Eric Carlson 2021-04-01 08:15:31 PDT
Comment on attachment 424860 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=424860&action=review

> Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:322
> +    MRMediaRemoteSetNowPlayingInfoWithMergePolicy(info.get(), MRMediaRemoteMergePolicyReplace);

This is fine for now, but I assume it is more expensive so we should see if passing MRMediaRemoteMergePolicyUpdate when the artwork doesn't change works.
Comment 6 EWS 2021-04-01 08:19:45 PDT
Committed r275360: <https://commits.webkit.org/r275360>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 424860 [details].
Comment 7 Jean-Yves Avenard [:jya] 2021-04-01 15:30:13 PDT
(In reply to Eric Carlson from comment #5)
> Comment on attachment 424860 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=424860&action=review
> 
> > Source/WebCore/platform/audio/cocoa/MediaSessionManagerCocoa.mm:322
> > +    MRMediaRemoteSetNowPlayingInfoWithMergePolicy(info.get(), MRMediaRemoteMergePolicyReplace);
> 
> This is fine for now, but I assume it is more expensive so we should see if
> passing MRMediaRemoteMergePolicyUpdate when the artwork doesn't change works.

The recommendation to use the replace policy came from the MR team and I specifically asked about the extra overhead due to this. 

But the update policy is only designed to publish one field at the time and re-use and only replace the fields we've already passed. 

The way webkit uses MR is by publishing all its info each time, it never updates as such.

Also, looking at the MR source code update vs replace doesn't add any overhead really. It's a simple test that either use the CFDictionary it receives or update the cached one with the new values found in the new one.
Ultimately you end up with a complete CFDictionary of things being sent to the MR listeners. 

What we could do however is stop sending the artwork all the time and use the update policy instead.