ARLM-Keller / aforge

Automatically exported from code.google.com/p/aforge
0 stars 0 forks source link

DisplayPropertyPage problem - Filter can't create twice #106

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
With some camera when I call DisplayPropertyPage it breaks on call
CreateFilter on string
device.Mon.BindToObject(null, null, ref iid, out source);
with error HRESULT E_FAIL
Is it possible to reuse sourceObject in DisplayPropertyPage from WorkerThread?

What is the expected output? What do you see instead?

What version of the product are you using?
2.0

Please provide any additional information below.

Original issue reported on code.google.com by dkolt...@gmail.com on 11 Aug 2009 at 4:41

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 18 Aug 2009 at 2:16

GoogleCodeExporter commented 8 years ago
Simple search shows that AForge.NET framework does not have code like:
device.Mon.BindToObject(null, null, ref iid, out source)

This means you have modified source. Issues of modified sources are not out 
issues.

So far I was unable to reproduce the issue on my camera. Will try later with 
other 
cameras. In the meanwhile, please, test with original unmodified sources.

Original comment by andrew.k...@gmail.com on 19 Aug 2009 at 1:37

GoogleCodeExporter commented 8 years ago
please see  svn/   branches/ 2.1/ Sources/ Video.DirectShow/ 
VideoCaptureDevice.cs
method DisplayPropertyPage. 
it calls method CreateFilter. See line:
//object sourceObject = FilterInfo.CreateFilter( deviceMoniker );

 svn/   branches/ 2.1/ Sources/ Video.DirectShow/ FilterInfo.cs
method CreateFilter
moniker.BindToObject( null, null, ref filterId, out filterObject );

This is original break point.
I think that error occurs when we call CreateFilter second time.
First time we call it in method WorkerThread (class VideoCaptureDevice)

This problem reproduce only with one camera, with other one it's ok. I think it
depends on camera driver. If it is posible to create twice filter, it's work ok.

Original comment by dkolt...@gmail.com on 19 Aug 2009 at 4:41

GoogleCodeExporter commented 8 years ago
Was unable to reproduce the issue on any of my cameras. It looks like it really 
depends on camera/driver.

I tried to create only one sourceObject and share it between two routines. 
However 
in this case OleCreatePropertyFrame() was always crashing with 
AccessViolationException. Maybe it is caused by the fact that the object is 
used 
from two threads. Or maybe there another bug somewhere in intreop.

If you could try investigating the issue and fixing it like you've suggested, 
it 
would be nice. I would appreciate for SVN patch file.

Original comment by andrew.k...@gmail.com on 4 Sep 2009 at 2:43

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 19 Sep 2009 at 7:12

GoogleCodeExporter commented 8 years ago
Hello,

If I give a patch, which probably fixes the issue, would you be able to apply 
it and 
test it? There is one more report describing similar issue, so it seems it 
would be 
better to fix it somehow. I got one idea to try. Did not make code yet, but 
will do 
it soon and looking for somebody who could test on the system, which reproduces 
the 
bug.

Original comment by andrew.k...@gmail.com on 5 Oct 2009 at 9:25

GoogleCodeExporter commented 8 years ago
Yes, I can test it. 
As I remember, in directshownet library (http://directshownet.sourceforge.net/) 
there
is no such bug.

Original comment by dkolt...@gmail.com on 5 Oct 2009 at 11:23

GoogleCodeExporter commented 8 years ago
Please, try the attached DLL. It checks if video source object fails to create 
twice, then it redirects request to background thread, so it could show 
property 
page using its own source object. I hope it will work ...

For safety we can even not trying to create second source object, but redirect 
requests to background thread if it is running (such version worked on my side, 
but 
I would like to try this one first, since it is better not to pass requests to 
background thread if driver can create two source objects).

Original comment by andrew.k...@gmail.com on 5 Oct 2009 at 2:49

Attachments:

GoogleCodeExporter commented 8 years ago
I'll try this dll as soon as posible, but may be it'll be next week.

Original comment by dkolt...@gmail.com on 5 Oct 2009 at 9:10

GoogleCodeExporter commented 8 years ago
This is fine. Just try it when you have a moment and access to that camera, 
which 
reproduces the issue.

Original comment by andrew.k...@gmail.com on 6 Oct 2009 at 8:18

GoogleCodeExporter commented 8 years ago
It needs to handle exceptions in FilterInfo.CreateFilter
You are waiting NULL after call FilterInfo.CreateFilter, but it fails with 
exception.
For my needs I replaced string "object sourceObject = FilterInfo.CreateFilter(
deviceMoniker );" with "object sourceObject = null;". It works. Thank you!

Original comment by dkolt...@gmail.com on 12 Oct 2009 at 6:13

GoogleCodeExporter commented 8 years ago
In the case if camera's driver does not allow several copies of video source 
object, 
we pass the request for displaying property page to background thread, which 
deals 
with video capture. Otherwise we create second source object and use it as 
before.

Committed in revision 1099. Will be released in 2.0.2 (or 2.1 - whatever 
happens 
sooner).

Original comment by andrew.k...@gmail.com on 13 Oct 2009 at 2:20

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 13 Oct 2009 at 2:22

GoogleCodeExporter commented 8 years ago

Original comment by andrew.k...@gmail.com on 5 Nov 2009 at 2:03