This is the first part of a series implementing an asynchronous MFT wrapper around the synchronous session transforms. The idea is to use the async MFT behavior for all the session transforms.
I believe this is generally useful, and goes in the direction of support native async MFT, although there is none at the moment, and it will also improve the behavior of the session with decoder transforms. These MFT do not generate a sample for each input samples, and may require more input to be requested. Using the async MFT behavior, we would generate METransformInputNeeded events when appropriate, and the session would react to them and request more samples from upstream.
Similarly, producing output will trigger METransformOutputAvailable events, and the session can react to these events and push the samples downstream if there were requested, or queue them.
Moreover, for very large video decoding or video processing, the synchronous transform may be performing slowly, and this currently blocks the session callbacks, causing stutter in the playback. Using the async MFT, we can process samples asynchronously, in the multi threaded queue.
The complete async_transform implementation can be seen in the https://gitlab.winehq.org/rbernon/wine/-/commits/mr/mf-async-transform branch. I also have a local tree with fully working decoder MFTs, but it requires more changes elsewhere and some media source refactor.