Quantcast
Channel: Media Foundation Development for Windows Desktop forum
Viewing all articles
Browse latest Browse all 1079

Media Foundation Worker Thread Exception Handling?

$
0
0

Media Foundation Worker Thread Exception Handling?

How can I implement an exception handling on Media Foundation worker threads?

In DirectShow in PushSource filters I use:
 LONG WINAPI ExceptionFilterFunc(LPEXCEPTION_POINTERS ppp) // as handler

 SetUnhandledExceptionFilter(&ExceptionFilterFunc);  // on start of thread

This way I can receive any exception in that handler which works fine.

But on Media Foundation worker threads (and on use of third-party PushSource-Filters on DirectShow)
normally I don't start the thread somewhere. So for example in the CPlayer Sample (using Media Session)
there's nowhere a worker thread started, but of course its there, when I use the callback.

So how do I access them to add an exception handler?

 Yet on any third-party Dshow SourcePush filters, where my own Sink-Filter is added in the graph, I simply also setup exception handling by SetUnhandledExceptionFilter when my SinkFilter first time processes the Receive method. So only a few moments then the worker thread runs without an handler, but then it has same handler as if it was setup on start of that thread. (That does not ensure to avoid exceptions which already raise on processing first frame by a third-party SourcePush Filter)

(mftrace.exe is a good thing, but its not the solution for the final release version of the app,

where simply the exception should be found BEFORE the full app crashes)

MF runs much safer than DShow, but there is no guarantee for 100% safe processing ever, so if such a worker thread crashes I simply want the APP to exit that thread returning an ExitCode. The APP then can continue with other actions or it can restart the session with another attempt or with other parameters..





Viewing all articles
Browse latest Browse all 1079

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>