Switching Argus camera on/off with Argus

Hi Folks,

We have two cameras on our TX2. We are currently operating both cameras in following fashion -

Cam1 --> encoder --> encoded bitstream
         |
         |--> GPU --> CPU (frame processing, and data annotation ) -->
                                                                      | 
    Cam2 --> encoder --> encoded bitstream                            |--> select either cam source --> encoder --> encoded bitstream
         |                                                            | 
         |--> GPU --> CPU (frame processing, and data annotation ) -->

Please note that based on activity in either camera we select of of those cams to be finally encoded out. In order to optimize system load, I would like to shut off one of the cameras and then wake it up upon need. I am planning to use following APIs for this purpose

// initilization
UniqueObj<Request> request(iSession->createRequest(CAPTURE_INTENT_VIDEO_RECORD));

// to start the camera 
   if (iCaptureSessionCamera0->repeat(requestCamera0.get()) != STATUS_OK)
      ORIGINATE_ERROR("Failed to start repeat capture request for preview");

// to 'pause' camera 
   // Stop the capture requests and wait until they are complete.
   iCaptureSessionCamera0->stopRepeat();

// to 'resume' camera 
   if (iCaptureSessionCamera0->repeat(requestCamera0.get()) != STATUS_OK)
      ORIGINATE_ERROR("Failed to start repeat capture request for preview");

WIll this work ? Would you recommend a specific tegra_multimedia_api example that I can follow for my purpose ?

Thanks

Hi,
Your proposal is working well. We have verified below command/patch:

09_camera_jpeg_capture$ ./camera_jpeg_capture --disable-jpg --cap-time 5
diff --git a/multimedia_api/ll_samples/samples/09_camera_jpeg_capture/main.cpp b/multimedia_api/ll_samples/samples/09_camera_jpeg_capture/main.cpp
index 7d74f6e..d642a1b 100644
--- a/multimedia_api/ll_samples/samples/09_camera_jpeg_capture/main.cpp
+++ b/multimedia_api/ll_samples/samples/09_camera_jpeg_capture/main.cpp
@@ -424,6 +424,19 @@ static bool execute(NvEglRenderer *renderer)
     iCaptureSession->stopRepeat();
     iCaptureSession->waitForIdle();
 
+    PRODUCER_PRINT("Pause for 3 second\n");
+    sleep(3);
+
+    if (iCaptureSession->repeat(request.get()) != STATUS_OK)
+        ORIGINATE_ERROR("Failed to start repeat capture request");
+
+    // Wait for CAPTURE_TIME seconds.
+    sleep(CAPTURE_TIME);
+
+    // Stop the repeating request and wait for idle.
+    iCaptureSession->stopRepeat();
+    iCaptureSession->waitForIdle();
+
     // Destroy the output stream to end the consumer thread.
     previewStream.reset();
     if (DO_JPEG_ENCODE)

Hi DaneLLL

THanks for your help.

Could you please confirm whether VI/ISP in active or inactive during sleep suration of 3 sec ? Would like to make sure that there is not camera write traffic going into global memory, for the duration of “pause”.

Thanks

Hi,
VI/ISP is in inactive after calling

iCaptureSession->stopRepeat();
iCaptureSession->waitForIdle();