First of all, you must learn to use the mftrace tool . Most likely, he will immediately tell you about the problem.
But I guess the following problems are possible.
Perhaps some other attributes are required besides SampleTime / SampleDuration.
Perhaps SinkWriter needs a texture that it can read on the processor. To fix this, when a frame is available, create an intermediate texture of the same format + size, call CopyResource to copy the desktop to the intermediate texture, and then transfer this intermediate texture to MF.
Even if you use a hardware encoder, so the CPU never tries to read texture data, I do not consider it a good idea to directly transfer the texture of the desktop to MF.
When you set the D3D texture for the pattern, the data is not copied anywhere, the pattern just saves the texture.
MF works asynchronously, it can buffer several samples in its topological nodes if they want.
DD gives you data synchronously, you can only access text between calls to AcquireNextFrame and ReleaseFrame.
Sonts source share