diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2013-09-20 16:32:26 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2013-09-20 16:32:26 -0700 |
commit | 70b054021a3a22622c2710267362c5e235ed73bd (patch) | |
tree | 24341d0e6cc5882b0d105b1bda2969fedcf831f3 /services | |
parent | 0181fde7bd20238cb13ae2665f0e5bfe7c2d9ac8 (diff) | |
download | frameworks_av-70b054021a3a22622c2710267362c5e235ed73bd.zip frameworks_av-70b054021a3a22622c2710267362c5e235ed73bd.tar.gz frameworks_av-70b054021a3a22622c2710267362c5e235ed73bd.tar.bz2 |
Camera2/3: Properly disambiguate FPS range vs. single FPS setting
The camera1 API allows for either setPreviewFrameRate or
setPreviewFPSRange, so both values may or may not change in a single
setParameter call.
The disambiguation of which setting has been changed since the last
setParameter() call was not fully correct, so a sequence of changes
that only changed setPreviewFPSRange or didn't change either could be
interpreted as as a change to setPreviewFrameRate.
Bug: 10842868
Change-Id: I40baeced80a58f09f8a1742ece8dd5e141e9c1e3
Diffstat (limited to 'services')
-rw-r--r-- | services/camera/libcameraservice/api1/client2/Parameters.cpp | 23 | ||||
-rw-r--r-- | services/camera/libcameraservice/api1/client2/Parameters.h | 1 |
2 files changed, 19 insertions, 5 deletions
diff --git a/services/camera/libcameraservice/api1/client2/Parameters.cpp b/services/camera/libcameraservice/api1/client2/Parameters.cpp index 0705791..a6c1083 100644 --- a/services/camera/libcameraservice/api1/client2/Parameters.cpp +++ b/services/camera/libcameraservice/api1/client2/Parameters.cpp @@ -184,6 +184,7 @@ status_t Parameters::initialize(const CameraMetadata *info) { // NOTE: Not scaled like FPS range values are. previewFps = fpsFromRange(previewFpsRange[0], previewFpsRange[1]); + lastSetPreviewFps = previewFps; params.set(CameraParameters::KEY_PREVIEW_FRAME_RATE, previewFps); @@ -1152,6 +1153,12 @@ status_t Parameters::set(const String8& paramString) { validatedParams.previewFps = fpsFromRange(validatedParams.previewFpsRange[0], validatedParams.previewFpsRange[1]); + + // Update our last-seen single preview FPS, needed for disambiguating + // when the application is intending to use the deprecated single-FPS + // setting vs. the range FPS setting + validatedParams.lastSetPreviewFps = newParams.getPreviewFrameRate(); + newParams.setPreviewFrameRate(validatedParams.previewFps); } @@ -1187,12 +1194,15 @@ status_t Parameters::set(const String8& paramString) { } } - // PREVIEW_FRAME_RATE - // 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. + // PREVIEW_FRAME_RATE 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. To detect whether the application has changed the value of + // previewFps, compare against their last-set preview FPS instead of the + // single FPS we may have synthesized from a range FPS set. if (!fpsRangeChanged) { validatedParams.previewFps = newParams.getPreviewFrameRate(); - if (validatedParams.previewFps != previewFps || recordingHintChanged) { + if (validatedParams.previewFps != lastSetPreviewFps || + recordingHintChanged) { camera_metadata_ro_entry_t availableFrameRates = staticInfo(ANDROID_CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES); /** @@ -1263,7 +1273,10 @@ status_t Parameters::set(const String8& paramString) { String8::format("%d,%d", validatedParams.previewFpsRange[0] * kFpsToApiScale, validatedParams.previewFpsRange[1] * kFpsToApiScale)); - + // Update our last-seen single preview FPS, needed for disambiguating + // when the application is intending to use the deprecated single-FPS + // setting vs. the range FPS setting + validatedParams.lastSetPreviewFps = validatedParams.previewFps; } // PICTURE_SIZE diff --git a/services/camera/libcameraservice/api1/client2/Parameters.h b/services/camera/libcameraservice/api1/client2/Parameters.h index b9ca7bf..0505b0e 100644 --- a/services/camera/libcameraservice/api1/client2/Parameters.h +++ b/services/camera/libcameraservice/api1/client2/Parameters.h @@ -46,6 +46,7 @@ struct Parameters { int previewWidth, previewHeight; int32_t previewFpsRange[2]; + int lastSetPreviewFps; // the last single FPS value seen in a set call int previewFps; // deprecated, here only for tracking changes int previewFormat; |