Argus: libnvargus_socketclient.so is not working

When the application is linked against libnvargus_socketclient.so instead of libnvargus.so, it is not possible to capture any images. The FrameConsumer::acquireFrame() method always returns an error STATUS_DISCONNECTED even for the first frame in any CaptureSession.

Before that, the application calls IEGLOutputStream::waitUntilConnected() successfully to ensure that the producer has actually connected, so this error seems unexpected.

The same code runs successfully when linking against libnvargus.so and not using nvargus-daemon.

The error exists at least in L4T releases R32.1 and R32.2.

hello stefan.zegenhagen,

you should provide the commands you’re working with.
please also share your environment setups and the failure messages for checking.
thanks

Our application does the following steps to set-up 4 parallel capture sessions, using the appropriate Argus APIs:

  1. selects a camera device
  2. creates a capture session for the selected camera device
  3. selects a suitable sensor mode
  4. creates stream settings for the capture session
  5. configures the streeam settings for I420 output with metadata enabled
  6. creates an EGLOutputStream output stream from the stream settings
  7. creates a capture request for CAPTURE_INTEND_VIDEO_RECORD
  8. configures the capture request with the selected sensor mode, frame rate and output stream
  9. creates a FrameConsumer from the output stream
  10. calls ICaptureSession::repeat() with our request
  11. calls IEGLOutputStream::waitUntilConnected()
  12. repeatedly calls IFrameConsumer::acquireFrame()

The code is based on the available examples and works when linking against libnvargus.so as already mentioned, but fails when linking against libnvargus_socketclient.so. The status returned by IFrameConsumer::acquireFrame() is 8, which maps to STATUS_DISCONNECTED.

hello stefan.zegenhagen,

you might still narrow down for the root-cause.
could you please reproduce the issue with default argus application,
please have a try with multi-session mode or launch four argus instances for verification.
thanks

Hi Jerry,

I think we found the problem in our code.

Reason was that our code destroyed the CameraProvider object after setting up the captures, e.g. the following code statements were in the constructor of a class:

UniqueObj<CameraProvider> cp = CameraProvider::create();
ICameraProvider * icp = interface_cast<ICameraProvider>(cp.get());
setupCaptures(icp);
startCaptures();
return;

The return from the constructor expects the cameras to be running but also implicitly destroys the UniqueObj object. Apparently this causes some cleanup in nvargus-dameon that breaks at least the EGLStreams. It is unknown to me why the code works when linking against libargus.so and is not using nvargus-daemon.

Please note that the Argus documentation does not mention that a reference to the object must be held for all the time that capture sessions are active. Usually the documentation talks about the life-cycles of the objects. Misleadingly the documentation indicates that most objects are reference counted and destroyed automatically when no longer needed, so the programmer doesn’t need to care and keep pointers in variables unless otherwise noted.