By using Directshow.NET and c# I have developed an application which shows camera preview. Everything is working fine since 1 year but suddenly client complaint about black camera preview.
After some digging to issue I come to know that anti-virus program is blocking camera usages by my application. After adding my application in exclusion list of that anti-virus program makes application to work as like before.
In program I have properly thrown exception for HRESULT
like below:
try
{
//FilterGraph creation
//CaptureGraphBuilder2 creation
//AddSourceFilterForMoniker()
//SampleGrabber configuration
//VMR9 configuration
hr = mediaControl.Run();
DsError.ThrowExceptionForHR(hr);
}
catch(Exception ex)
{
//logging part
}
Still there is nothing in log, even I debug that application on that particular machine but program executes successfully. So the question is, To avoid such issues how can I make sure that camera preview is actually started? Is there any way to check that stream is not blocked.