Make media session property setter more resilient
ClosedPublic

Authored by broulik on Dec 3 2018, 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
Lint Skipped
Unit
Unit Tests Skipped
broulik created this revision.Dec 3 2018, 8:10 AM
Restricted Application added a project: Plasma. · View Herald TranscriptDec 3 2018, 8:10 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Dec 3 2018, 8:10 AM
fvogt added a comment.Dec 3 2018, 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.Dec 3 2018, 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.Dec 3 2018, 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.Dec 3 2018, 8:36 AM
This revision was automatically updated to reflect the committed changes.