🚀 Build CaptureSession
with lazy-initialized Surfaces (performance)
#2518
Labels
✨ feature
Proposes a new feature or enhancement
💨 performance
This issue or pull requests addresses performance issues
What feature or enhancement are you suggesting?
The Camera2 framework allows creating
OutputConfiguration
s that do not have aSurface
yet.In this case, the
OutputConfiguration
is considered lazy, and cannot be streamed to yet (omit it from capture request), but it can already be used to initialize theCameraCaptureSession
, in which case the initialization of the actualSurface
can happen asynchronously/in parallel.This is especially useful for the Preview View, which can take a few milliseconds to initialize as this is scheduled on the UI Thread by Android OS.
If we implement this optimized flow in VisionCamera, we can speed up session creation even more by allowing the session to be started without a finalized Preview View yet, and then only finalize the configuration once the Preview View has actually been started.
Additionally, we currently always have two session configurations happening on load - one with all outputs but the preview, and one with all outputs including the preview. When we implement this optimized flow in VisionCamera we can skip the first call, effectively making this even faster than it already will be and lowering memory usage since we avoid unnecessary allocations.
There are two things that need to be done about this:
configureOutputs
call (as that will tear down every output and rebuild a session, effectively making this optimization useless)What Platforms whould this feature/enhancement affect?
Android
Alternatives/Workarounds
Works
Additional information
The text was updated successfully, but these errors were encountered: