Ok, so I ran into a problem that wasn't too varied before, but not with WPF, so make the following (very hacky) sentence with a pinch of salt.
The following method basically creates a completely separate application stream for running directshow commands, but tells direct show to use the Windows control handle located in your WPF application.
So, first we need a dummy form of WinForms, which we can use to make calls, but this will never be displayed:
The next step is to create a thread on which we can put a message loop:
So, once the dummy form (and its stream) has been created, you can call the MTA calls in the application stream, as shown below:
Then, when you're done with Directshow stuff, disable a separate application stream like this:
//to end the separate thread and application loop, //just close your invisible form dumbForm.Close();
The advantage of this approach is that you carefully create a sandbox in a separate thread. The disadvantage is the Invoke call context switch, as well as the overhead of having another application flow. You may have been lucky with this in your current architecture, but this should help.
Let me know how you are doing, I am intrigued by how well this works.
Kazar source share