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.
-- v4: winegstreamer: Send media source shutdown notification via IMFMediaShutdownNotify. mf: Introduce IMFMediaShutdownNotify for notification of media source 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().