Make media session property setter more resilient
ClosedPublic

Authored by broulik on Mon, Dec 3, 8:10 AM.

Details

Summary

Don't break when it's set to null to unset metadata.

BUG: 401636

Test Plan

https://www.youtube.com/tv (which I didn't know existed) now works and shows video title as metadata
Media Sessions demo page still works

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Mon, Dec 3, 8:10 AM
Restricted Application added a project: Plasma. · View Herald TranscriptMon, Dec 3, 8:10 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Mon, Dec 3, 8:10 AM
fvogt added a comment.Mon, Dec 3, 8:21 AM

Can host/mprisplugin.cpp deal with payload being null properly?

It can, processMetadata(data.value(QStringLiteral("metadata")).toObject()); turns it into an empty object when null (or anything but an Object)

fvogt added a comment.Mon, Dec 3, 8:32 AM

It can, processMetadata(data.value(QStringLiteral("metadata")).toObject()); turns it into an empty object when null (or anything but an Object)

Yes, but in there it calls data.value for multiple keys without checking anything - if that is intentional, it deserves a comment at least.

Yes, but in there it calls data.value for multiple keys without checking anything

Because it doesn't need to. It makes no difference whether the object is empty or has only one of the keys I read.

fvogt accepted this revision.Mon, Dec 3, 8:36 AM

Because it doesn't need to. It makes no difference whether the object is empty or has only one of the keys I read.

Of course, but it's not obvious that this behaviour is actually wanted there.

This revision is now accepted and ready to land.Mon, Dec 3, 8:36 AM
This revision was automatically updated to reflect the committed changes.