These changes are the documented way to implement IMFMediaEventGenerator for a media source. On top of !6783 it seems to greatly reduce the chance of hanging while switching characters in Killsquad if tracing is not enabled.
-- v3: winegstreamer: Enqueue an event if a media source start/pause/stop async command fails due to shutdown. mf: Handle media source Start() failure due to source shutdown. mf: Handle media source event subscription failure due to source shutdown. mf: Handle media source BeginGetEvent() failure due to shutdown. mf: Handle media source EndGetEvent() failure due to shutdown. mf/tests: Add tests for shutting down a media source used in a session. winegstreamer: Return the result code from media_source_Pause(). rtworkq: Do not cancel pending callbacks when closing a thread pool. mfplat/tests: Add a test for calling MFUnlockWorkQueue() with pending items.