I understand sensor gain and exposure couldn’t be modified during streaming. But how can I set them without reset everything? Following are some steps I took.
Scenario 1 (single capture) works fine:
- Create
CameraProvider
- Get `CameraDevice
- Create
CaptureSession
- Create
Request
- Create
OutputStreamSettings
- Set output stream settings, such as pixel format, resolution
- Create
OutputStream
- Create
FrameConsumer
- Enable
OutputStream
- Get
SourceSettings
- Set
GainRange
andExposureTimeRange
- Start single capture
iCaptureSession->capture(request.get())
- Get the frame
iFrameConsumer->acquireFrame()
- Reset all pointers and done.
Scenario 2 (streaming with everything torn down) works fine:
- Same steps in scenario 1 until step 11 (set gain and exposure)
- Change gain and exposure ranges
- Create event queue
- Send repeat request
iCaptureSession->repeat(request.get())
- Start a thread to wait for events and acquire frames
- Stop the capture
iCaptureSession->stopRepeat()
andiCaptureSession->waitForIdle()
- Reset all pointers, such as output stream, request, frame consumer and etc.
- Repeat above steps with different gain and exposure ranges.
Scenario 3 (streaming without tearing down everything) doesn’t work:
- Same steps in scenario 1 until step 11 (set gain and exposure)
- Change gain and exposure ranges
- Create event queue
- Send repeat request
iCaptureSession->repeat(request.get())
- Start a thread to wait for events and acquire frames
- Stop the capture
iCaptureSession->stopRepeat()
andiCaptureSession->waitForIdle()
- Repeat above steps from 2 to 6 with different gain and exposure ranges
In scenario 3, it doesn’t seem to actually change the gain and exposure. May I ask what I missed or make it wrong? How can I change the gain and exposure without resetting all pointers?