diff options
author | Yin-Chia Yeh <yinchiayeh@google.com> | 2014-06-13 14:53:05 -0700 |
---|---|---|
committer | Yin-Chia Yeh <yinchiayeh@google.com> | 2014-06-20 14:56:14 -0700 |
commit | 8684b7f7977f535260367040931c1fd994cca3b4 (patch) | |
tree | b4c4b84eaa0efe0863d09d2292a0f37c1d550213 /services/camera/libcameraservice/device3 | |
parent | 3a227969f604d7c6a24a795661a13f70a5f37e1f (diff) | |
download | frameworks_av-8684b7f7977f535260367040931c1fd994cca3b4.zip frameworks_av-8684b7f7977f535260367040931c1fd994cca3b4.tar.gz frameworks_av-8684b7f7977f535260367040931c1fd994cca3b4.tar.bz2 |
Camera2: Fix lastFrameNumber counter in flush case
Decrement the counter for those repeating requests never
sent to device.
Change-Id: I2064e51cb5d509d86dbde4a89e8157de33f574b0
Diffstat (limited to 'services/camera/libcameraservice/device3')
-rw-r--r-- | services/camera/libcameraservice/device3/Camera3Device.cpp | 23 | ||||
-rw-r--r-- | services/camera/libcameraservice/device3/Camera3Device.h | 3 |
2 files changed, 26 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index 16d6f42..a5839ae 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -2126,6 +2126,17 @@ status_t Camera3Device::RequestThread::setRepeatingRequests( return OK; } +bool Camera3Device::RequestThread::isRepeatingRequestLocked(const sp<CaptureRequest> requestIn) { + if (mRepeatingRequests.empty()) { + return false; + } + int32_t requestId = requestIn->mResultExtras.requestId; + const RequestList &repeatRequests = mRepeatingRequests; + // All repeating requests are guaranteed to have same id so only check first quest + const sp<CaptureRequest> firstRequest = *repeatRequests.begin(); + return (firstRequest->mResultExtras.requestId == requestId); +} + status_t Camera3Device::RequestThread::clearRepeatingRequests(/*out*/int64_t *lastFrameNumber) { Mutex::Autolock l(mRequestLock); mRepeatingRequests.clear(); @@ -2140,6 +2151,18 @@ status_t Camera3Device::RequestThread::clear(/*out*/int64_t *lastFrameNumber) { Mutex::Autolock l(mRequestLock); ALOGV("RequestThread::%s:", __FUNCTION__); mRepeatingRequests.clear(); + + // Decrement repeating frame count for those requests never sent to device + // TODO: Remove this after we have proper error handling so these requests + // will generate an error callback. This might be the only place calling + // isRepeatingRequestLocked. If so, isRepeatingRequestLocked should also be removed. + const RequestList &requests = mRequestQueue; + for (RequestList::const_iterator it = requests.begin(); + it != requests.end(); ++it) { + if (isRepeatingRequestLocked(*it)) { + mRepeatingLastFrameNumber--; + } + } mRequestQueue.clear(); mTriggerMap.clear(); if (lastFrameNumber != NULL) { diff --git a/services/camera/libcameraservice/device3/Camera3Device.h b/services/camera/libcameraservice/device3/Camera3Device.h index 00ae771..8e238e5 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.h +++ b/services/camera/libcameraservice/device3/Camera3Device.h @@ -430,6 +430,9 @@ class Camera3Device : // Relay error to parent device object setErrorState void setErrorState(const char *fmt, ...); + // If the input request is in mRepeatingRequests. Must be called with mRequestLock hold + bool isRepeatingRequestLocked(const sp<CaptureRequest>); + wp<Camera3Device> mParent; wp<camera3::StatusTracker> mStatusTracker; camera3_device_t *mHal3Device; |