I know 4/4 is backed by tests, but what race or deadlock is it trying to fix?
The situation is, we have a filter graph like this: [source(reader)] -> [dmo decoder] -> [renderer].
We have a worker thead in source filter, the thread will get samples from the allocator of decoder's input pin, fill the samples, then push samples downsteam. So it will call dmo_wrapper_sink_Receive() on dmo decoder filter.
And our main thread receive user inputs, it will skip the video if it got mouse click. So it will call Stop() on dmo decoder filter.
Receive() should wait for Stop() and fail eventually, the Receive() failure will then break the loop in worker thread, and make the thread terminate normally.
But if we don't sync Stop() with Receive(), the loop in worker thread will fail on sample allcating, because the allocator is decommited when calling Stop(), sample allcating failure will raise a error in the game.
So the point is: for kirikiri2 games, it expect a Receive() failure, but don't expect a sample allocating failure.