free5lot / Camera_Net

A .NET library for Camera easy use via DirectShow
GNU Lesser General Public License v3.0
147 stars 76 forks source link

Can not stop properly in window 10 #12

Open LuckyTeng opened 6 years ago

LuckyTeng commented 6 years ago

I have a window10 tablet, it has front and rear camera, when I change one to another, it stop responding.

I think in CloseAll() function, it call StopWhenReady(), this is asyc call, and it behavior is different than prior.

And window 10 introduce a new service, "Camera Frame", it allows multiple apps to get the frame of camera at the same time.

So my solution is as below, remove StopWhenReady() in CloseAll():

try { //DX.MediaControl.StopWhenReady(); DX.MediaControl.Stop(); } It stop normally but the sideeffect is that SnapshotSourceImage() does't work.

Any perfect solution?

free5lot commented 6 years ago

Thank you for this information. I don't see why Stop() should affect SnapshotSourceImage(), if everything should be reinitialized every change of camera.

LuckyTeng commented 6 years ago

Yes, Stop() didn't affect SnapshotSourceImage() Buf if you stop "Camera Frame" service in Window 10, SnapshotSourceImage() will not work.

free5lot commented 6 years ago

Buf if you stop "Camera Frame" service in Window 10, SnapshotSourceImage() will not work.

I don't know the proper way to deal with this new service. If you ever find out please tell me.

LuckyTeng commented 6 years ago

I think the behavior of DirectX in windows 10 is changed, in order to let multi apps access the camera at the same time, "Camera Frame" service will capture the image save into buffer, and DirectX interface will access that buffer, but my working environment is windows 7, so I don't know how to handle it properly.