On Wed Nov 20 14:30:21 2024 +0000, Rémi Bernon wrote:
Perhaps but it still feels brittle that fixing the media session requires some cooperation from the media source. Some tests with a mock media source that doesn't send any event in response to IMFMediaSource_Start, and making the same media session calls (SetTopology, Start, ClearTopologies, SetTopology, Start again) as the game would show if the session is able to handle the missing events or not. If native is indeed hanging too in that scenario, then yes the media source would also need some changes. Otherwise they don't seem necessary.
I confirmed that native hangs if `MESourceStarted` is not sent and events are halted as we'd expect for a shutdown source. I tested this by wrapping the native media source in a custom one, which also required wrapping streams returned by `MENewStream` so their `GetMediaSource()` returns the wrapper. The wrapper intercepts `MESourceStarted` and blocks forwarding.
I also tested reusing the session after a source is forcibly shutdown. This requires calling `ClearTopologies()`. Clearing the current topology is not enough.
I have this working in Wine; I need to make sure the details are correct or reasonably close to it for review.