Thank you for your question. I think you found an interesting problem.
This is the case with the current design. If you dig into the code of
getClosestSupportedDeviceFrameRate, you'll see that it prioritizes the range that intersects with the target fps [14, 14]. Therefore, only [10, 30] and [8, 30] are considered, and [10, 30] is ultimately chosen. This results in a final video of 30fps. This is indeed controversial and can be improved. But honestly, even if CameraX modifies the logic for this case, the automatic selection mechanism is still unreliable. There will always be ambiguous situations, such as the target is [14, 14], and the device supports both [12, 12] and [16, 16]. Unless CameraX provide more advanced APIs to meet FPS requirements (if needed, please file a feature request
here). So for now, it is still recommended that applications use their own logic to select one from
cameraInfo.supportedFrameRateRanges and then set to the frame rate API.
Regarding the
Camera2Interop method, although you can bypass the CameraX logic and directly set FPS, if you set a fps range that are not in the
available FPS list, it may not be guaranteed to work properly on all devices. It depends on the devices.
By the way, I am a little curious why such a special fps is set. [15, 15] seems to be more common?