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

Unverified Commit 62c1b384 authored by Michael Bestas's avatar Michael Bestas Committed by Michael Bestas
Browse files

Revert "Revert "Stagefright: Allow setting high-framerates in CameraSource""

* This revert was required when using the old HFR/HSR code which
  is now replaced by MediaRecorder.setCaptureRate and setVideoFrameRate API.
  It's no longer needed as the old code was not forward ported to N
  and it breaks HSR functionality

This reverts commit 40358289.

Change-Id: I30f081d7c8a7582b9e78551c8bf1624f34d290a1
parent 83fc6e96
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -336,6 +336,12 @@ status_t CameraSource::isCameraColorFormatSupported(
    return OK;
}

static int32_t getHighSpeedFrameRate(const CameraParameters& params) {
    const char* hsr = params.get("video-hsr");
    int32_t rate = (hsr != NULL && strncmp(hsr, "off", 3)) ? atoi(hsr) : 0;
    return rate > 240 ? 240 : rate;
}

/*
 * Configure the camera to use the requested video size
 * (width and height) and/or frame rate. If both width and
@@ -388,6 +394,10 @@ status_t CameraSource::configureCamera(
                params->get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES);
        CHECK(supportedFrameRates != NULL);
        ALOGV("Supported frame rates: %s", supportedFrameRates);
        if (getHighSpeedFrameRate(*params)) {
            ALOGI("Use default 30fps for HighSpeed %dfps", frameRate);
            frameRate = 30;
        }
        char buf[4];
        snprintf(buf, 4, "%d", frameRate);
        if (strstr(supportedFrameRates, buf) == NULL) {
@@ -489,6 +499,8 @@ status_t CameraSource::checkFrameRate(
        ALOGE("Failed to retrieve preview frame rate (%d)", frameRateActual);
        return UNKNOWN_ERROR;
    }
    int32_t highSpeedRate = getHighSpeedFrameRate(params);
    frameRateActual = highSpeedRate ? highSpeedRate : frameRateActual;

    // Check the actual video frame rate against the target/requested
    // video frame rate.