mpris-receiver: Deregister callbacks when clearing players
Summary
Main issue
In essence, clearing players
field inside onActiveSessionsChanged
is not enough - we need to also deregister the MprisReceiverCallback
from MediaController
to ensure the MprisReceiverPlayer
is truly destroyed.
Details
- Spotify has a bad habit of causing lots of calls to
onActiveSessionsChanged
on song change. In each call, we clear the existing players and create new instances ofMprisReceiverPlayer
andMprisReceiverCallback
to track media changes. - Each
MprisReceiverCallback
instance gets registered withMediaController
insidecreatePlayer
. - Inside
onActiveSessionsChanged
, if the underlyingMediaController
object remained alive, we would now end up with two instances ofMprisReceiverCallback
that internally reference the sameMprisReceiverPlayer
object.
Fix
Deregister the callbacks inside onActiveSessionsChanged
before clearing players
hashmap.
Test Plan
- Add log line
Log.d(TAG, "sending Metadata");
just abovedevice.sendPacket(np);
insidesendMetadata
ofMprisReceiverPlugin
. - Start playing a song on spotify, and after a few secs, hit Next.\
- Monitor our logcat.
Before:
Relevant logcat after Next was pressed
2023-06-25 18:56:57.395 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.403 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.413 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.422 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.436 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.454 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.484 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.499 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.524 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.544 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.554 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.562 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.569 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.579 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.592 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.603 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.613 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.629 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.641 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.653 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.666 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.671 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.679 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.686 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.694 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.699 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.704 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.713 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.719 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.724 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.730 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.743 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.750 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.759 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.770 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.785 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.793 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.799 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.808 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.812 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.819 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.831 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.838 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.844 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.849 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.855 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.861 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.866 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.872 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.877 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.884 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.892 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.898 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.903 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.907 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.913 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.917 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.921 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.928 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.934 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.938 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.944 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.949 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.954 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.959 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.966 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.971 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.976 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.983 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.990 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:57.995 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.000 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.007 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.013 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.021 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.026 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.032 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.041 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.047 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.055 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.062 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.067 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.072 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.078 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.083 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.088 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.096 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.106 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.114 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.120 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.127 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.135 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.143 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.149 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.157 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.164 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.174 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.180 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.186 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.195 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.201 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.209 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.216 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.223 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.231 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.238 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.243 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.251 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.262 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.269 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.275 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.281 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.287 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.294 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.302 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.310 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.319 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.327 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.337 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.345 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.350 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.357 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.363 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.369 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.374 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.382 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.389 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.398 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.404 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.411 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.419 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.427 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.434 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.441 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.449 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.453 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.458 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.464 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.471 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.475 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.483 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.490 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.497 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.502 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.510 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.519 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.532 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.536 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.543 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.552 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.560 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.567 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.574 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.580 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.587 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.592 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.599 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.606 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.613 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.620 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.626 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.633 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.642 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.652 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.659 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.667 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.675 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.683 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.690 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.699 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.706 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.712 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.718 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.726 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.734 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.742 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.748 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.753 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.759 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.765 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.774 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.781 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.787 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.794 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.801 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.806 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.811 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.817 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.823 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.831 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.839 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.847 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.854 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.862 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.870 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.875 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.879 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.886 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.892 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.898 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.904 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.911 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.919 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.927 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.934 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.939 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.945 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.953 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.959 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.969 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.979 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.986 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:58.993 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.001 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.007 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.014 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.021 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.027 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.034 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.040 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.046 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.053 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.060 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.067 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.075 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.083 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.092 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.099 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.107 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.114 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.121 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.129 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.136 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.142 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:56:59.226 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.228 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.229 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.231 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.233 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.234 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.234 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.235 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.236 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.236 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.237 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.237 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.238 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.238 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.239 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:56:59.239 31955-31955 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
After:
Relevant logcat after Next was pressed
2023-06-25 18:54:57.412 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.534 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.547 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.558 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.567 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.579 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.590 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.595 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.603 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendMetadata
2023-06-25 18:54:57.655 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.656 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.667 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.678 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.680 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.683 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.701 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.711 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.714 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.716 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.726 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.729 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.739 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.742 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.743 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
2023-06-25 18:54:57.746 30742-30742 MprisReceiver org.kde.kdeconnect_tp D sendPlayerList
Future work
There are still some redundant calls to sendMetadata
. These are coming from multiple calls to onPlaybackStateChanged
from Spotify. To reduce these, we'd need to add a debouncer.
Another thing- we can see that sendPlayerList
packet is also being sent quite a lot.
- We probably need to be smarter about creating new instances of
MprisReceiverPlayer
insideonActiveSessionsChanged
instead of the nuke-all-and-rebuild approach we have today. - Maybe we can implement a debouncer inside
onActiveSessionsChanged
to avoid sending too many packets.
Edited by Krut Patel