You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. use the sample Samples\Video\Player
2. use a real hardware camera, e.g.Basler ace USB3 (will not show up with avi /
file accessing simulators). Should come up with many cameras as it is not
Basler camera specific
3. run sample
What is the expected output? What do you see instead?
No live image is shown. After a call to
GetPinCapabilitiesAndConfigureSizeAndRate() , the camera is exclusivliy locked,
streamConfig internally holds a ref count to the filter subsystem and the
camera cannot be opened again. (i guess the player first builds up a temporary
graph to fetch camera capabilities)
What version of the product are you using?
svn trunk as of 12.1.2015
Please provide any additional information below.
The fix is easy:
just use
Marshal.ReleaseComObject(streamConfigObject);
<code>
at the end of GetPinCapabilitiesAndConfigureSizeAndRate(...), e.g.:
// Configure specified pin and collect its capabilities if required
private void GetPinCapabilitiesAndConfigureSizeAndRate( ICaptureGraphBuilder2 graphBuilder, IBaseFilter baseFilter,
Guid pinCategory, VideoCapabilities resolutionToSet, ref VideoCapabilities[] capabilities )
{
object streamConfigObject;
graphBuilder.FindInterface( pinCategory, MediaType.Video, baseFilter, typeof( IAMStreamConfig ).GUID, out streamConfigObject );
if ( streamConfigObject != null )
{
IAMStreamConfig streamConfig = null;
try
{
streamConfig = (IAMStreamConfig) streamConfigObject;
}
catch ( InvalidCastException )
{
}
if ( streamConfig != null )
{
if ( capabilities == null )
{
try
{
// get all video capabilities
capabilities = AForge.Video.DirectShow.VideoCapabilities.FromStreamConfig( streamConfig );
}
catch
{
}
}
// check if it is required to change capture settings
if ( resolutionToSet != null )
{
SetResolution( streamConfig, resolutionToSet );
}
}
// release interface was missing here, Cameras could be left locked if not released
Marshal.ReleaseComObject(streamConfigObject);
}
// if failed resolving capabilities, then just create empty capabilities array,
// so we don't try again
if ( capabilities == null )
{
capabilities = new VideoCapabilities[0];
}
}
</code>
best regards,
Timm von der Mehden
Software Developer
Basler AG
An der Strusbek 60-62
22926 Ahrensburg
Germany
www.baslerweb.com
Original issue reported on code.google.com by vdMeh...@gmail.com on 13 Jan 2015 at 8:37
The text was updated successfully, but these errors were encountered:
Fixed leak of "streamConfigObject" in
VideoCaptureDevice.GetPinCapabilitiesAndConfigureSizeAndRate().
SVN revision on Google Project: 1733.
Git SHA-1 on GitHub: 50e95424cd5b5b185d5a77305c088b45cdd2f2d7
Original comment by andrew.k...@gmail.com on 28 Jan 2015 at 11:13
Original issue reported on code.google.com by
vdMeh...@gmail.com
on 13 Jan 2015 at 8:37The text was updated successfully, but these errors were encountered: