I found that the ringbuffer size depends on the way how I open the camera. Here is a very short example:
using Stemmer.Cvb;
using Stemmer.Cvb.Driver;
using System;
namespace ConsoleCamera2
{
class Program
{
static void Main(string[] args)
{
// Ringbuffer depth is whatever is set in GenICam.ini (NumBuffer).
Device device = DeviceFactory.Open("%CVB%drivers\\GenICam.vin");
// Ringbuffer depth is 3 if the camera is opened through foundDevices.
// DiscoveryInformationList foundDevices = DeviceFactory.Discover();
// Device device = DeviceFactory.Open(foundDevices[0]);
var depth = device.Stream.RingBuffer.Count;
Console.WriteLine($"Ringbuffer depth: {depth}");
Console.ReadLine();
}
}
}
Is this behavior intentional? Where is it documented?
Thanks in advance for your advice.
The difference is most certainly what @Chris mentioned. Today, CVB basically supports two different acquisition stacks (“stack” in the sense that there is a pile of dynamically loaded binaries involved in making happen what you want). They are denoted by the (currently) two different enum values in the AcquisitionStack enumeration (PreferVin and PreferGenTL) that may be passed as a 2nd argument to the DeviceFactory.Open method:
PreferVin
Tells to use the acquisition stack that has been around sind version 9 (for veterans: The functions G2Grab, G2Wait and G2Freeze are the key functions here…). This acquisition stack will be the only one that works with legacy drivers (file extension *.vin - with the notorious exception of the GenICam.vin.
PreferGenTL
Tells to make use of the stack that has been added in version 13.4 - this stack supports more up-to-date GenICam features like multi part images or flow sets and will only work with the GenICam.vin (which, despite the file extension, is not a legacy entity).
The GenICam.ini file located in the folder %CVBDATA%Drivers will only be evaluated when opening with the Legacy Vin stack - but not when opening the GenTL stack. In the latter case the driver will be opened with a default number of buffers (usually 3) - unless you use the Discover method to get a list of devices and then change the settings of the device before opening it.
So I agree with Chris’s assessment that the difference you see is to be attributed to a difference in the driver stack that is being used. You can validate our assumption by specifying AcquisitionStack.PreferVin/AcquisitionStack.PreferGenTL explicitly in the Open call.
Also, the exact version of that you are using would be interesting to us: The default should actually be AcquisitionStack.PreferVin if you don’t specify anything else - at least in CVB 14.0 and higher, but I vaguely remember that at some point, the GenTL stack would have been the default.
Thank you @illusive and @Chris ,
I’m now setting NumBuffer and PacketSize using the SetParameter method on the devices found before opening them. It works as desired now. The CVB version is 14.0.9.
If I understand Setting PacketSize with Device.Discover correctly, the values in the GenICam.ini file are completely ignored, if the Discover interface is used. So the information is here, you just have to find and understand it .
Thanks again.