Rigbuffer size depends on how device is opened

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.

Hi @B9611

the reason you see differences in Rinbuffersize is, that when loading the driver direktly, the setup configured in the inifile is being loaded.

However, when you load the driver by the device you found through disvocery, we dont necessarily need the driver to be cofigured (could be a new camera that was never on the machine).
If you wish to change values on the device loaded that way, you will need to use the “SetValue()” method of the DiscoveryInformation class:
https://help.commonvisionblox.com/NextGen/14.0/cvbnet/d1/d19/struct_stemmer_1_1_cvb_1_1_driver_1_1_discovery_information.html

The names and values are equal to what you can see in the GenICam.ini.

Give it a try and let me know if this solved your question.

Hi @Chris and @B9611,

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 :cvb: to use the acquisition stack that has been around sind version 9 (for :cvb: 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 :cvb: 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 :cvb: 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.

2 Likes

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 :wink: .
Thanks again.

2 Likes