Question about CameraProvider in Libargus API

It seems that the CameraProvider is singleton. When the create function is called, if there is already one, then the function will return the existing one. Otherwise, the function will create one and return it. Is that true?

What if there are multiple processes using Libargus API? For example, one application uses Libargus API to stream. After it runs, I start another application to do single capture. (The first step of each application is to create a CameraProvider. The last step of each application is to reset the CameraProvider.) When the second application starts, will it get a different CameraProvider or the same one as the first application? If it is the same one, then when the second application finishes, it reset the CameraProvider. Will that affect the first application?

How about multiple threads in the same application?

Suppose you can’t create CameraProvider for the same sensor again if it doesn’t terminal.

Thanks

From the sample code: “13_argus_multi_camera”, it seems that I can get multiple camera devices from one single CameraProvider. Assume I have an application which takes an index of camera devices as an argument. The application can be used to capture images and stream from a specific camera device. This application starts from creating a CameraProvider and then get the camera device corresponding to the input index. And when everything is done, the application will reset the CameraProvider.

Following is the scenario:

  1. I start this application with index 1 to keep streaming images forever from camera 1.
  2. I start another instance of this application with index 2 to capture one image from camera 2. When the image is captured, the application exits.

My questions are:

  1. In the above scenario, since the second instance of the application finishes and reset the CameraProvider before the first instance of the application completes, will that affect the first instance of the application? Can the first instance of the application still keep streaming?
  2. If that does affect the first instance of the application, is there any way or workaround to make this scenario work?

Thanks a lot!

Please reference to /usr/src/jetson_multimedia_api/argus/samples/multiSensor this sample create one sensor index for JPEG and another for preview that should be match for your case.

Thanks

I have checked the sample code. Essentially, only the main thread will create and reset the CameraProvider. Both JPEG and preview threads just use it.

What if I open two terminals and run this application in both terminals? Each application will create and reset the CameraProvider. Will that work?

For example. In terminal 1, I run this sample application with camera 1 as JPEG capture and camera 2 as preview capture. And in terminal 2, I run the same sample application with camera 3 as JPEG capture and camera 4 as preview capture. Will that work?

While the application running in terminal 1, I shut down the application in terminal 2. Will the application running in terminal 1 keep running without any problem?

Yes, it’s working and without problem to close each one.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.