Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0cec0cb authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Camera2: Only _some_ FPS values in the old API are scaled.

The (deprecated) single-FPS parameter is not scaled by 1000.

Bug: 7230239
Change-Id: I5664cce90f9cb01e57e39f1a1f7c8eb730501da3
parent 12d3e887
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -170,15 +170,16 @@ status_t Parameters::initialize(const CameraMetadata *info) {
    // PREVIEW_FRAME_RATE / SUPPORTED_PREVIEW_FRAME_RATES are deprecated, but
    // still have to do something sane for them

    // NOTE: Not scaled like FPS range values are.
    params.set(CameraParameters::KEY_PREVIEW_FRAME_RATE,
            previewFpsRange[0] * kFpsToApiScale);
            previewFpsRange[0]);

    {
        String8 supportedPreviewFrameRates;
        for (size_t i=0; i < availableFpsRanges.count; i += 2) {
            if (i != 0) supportedPreviewFrameRates += ",";
            supportedPreviewFrameRates += String8::format("%d",
                    availableFpsRanges.data.i32[i] * kFpsToApiScale);
                    availableFpsRanges.data.i32[i]);
        }
        params.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES,
                supportedPreviewFrameRates);
@@ -946,7 +947,7 @@ status_t Parameters::set(const String8& params) {
    // Deprecated, only use if the preview fps range is unchanged this time.
    // The single-value FPS is the same as the minimum of the range.
    if (!fpsRangeChanged) {
        validatedParams.previewFps = newParams.getPreviewFrameRate() / kFpsToApiScale;
        validatedParams.previewFps = newParams.getPreviewFrameRate();
        if (validatedParams.previewFps != previewFps) {
            camera_metadata_ro_entry_t availableFrameRates =
                staticInfo(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
+2 −0
Original line number Diff line number Diff line
@@ -223,6 +223,8 @@ struct Parameters {
    // Map from camera orientation + facing to gralloc transform enum
    static int degToTransform(int degrees, bool mirror);

    // API specifies FPS ranges are done in fixed point integer, with LSB = 0.001.
    // Note that this doesn't apply to the (deprecated) single FPS value.
    static const int kFpsToApiScale = 1000;

    // Transform between (-1000,-1000)-(1000,1000) normalized coords from camera