This is all mfplat code, so adding Nikolay as reviewer. I didn't notice any obvious errors from a quick review, though.
I did notice a failure while running the tests: the media source was somehow being leaked in test_media_session_events() [last release returned 1]. I can't reproduce it, though, even by running the test in a loop. Hence I don't know if it's preëxisting or not.