Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed Camera2 crash on first camera start.
When camera enters video preview mode, it uses current window size to select the best matching video preview size to request from the camera HAL. However, if video preview mode is the initial mode in which the camera starts, there's a race condition between preview size selection and camera app layout completion. If preview size selection code is run first, it will get zero window size and subsequently will crash. It's not clear what's really the "best" fix in this situation (= waiting for layout to complete would introduce extra latency in the camera startup process), so current work-around just checks whether window size is already defined and if not - uses display size instead. This makes sense because normally camera window is running full-screen anyway, so window size will match display size. Change-Id: Ie8555025902ba8ae6f719d45371145126290bb7c
- Loading branch information