From 3c76fa3e73374dfe7bb93e1b03fed30749e1e4b9 Mon Sep 17 00:00:00 2001 From: Jianing Wei Date: Mon, 21 Apr 2014 11:34:34 -0700 Subject: [PATCH] CameraService: fix waitUntilIdle bug revealed by TestingCamera2. * clear mStreamingRequestList in flush * fix frame number checker in notify and processCaptureResult Bug: 14166437 Change-Id: I022421080d05138f9068c1b9b85d83bd613b04fb --- services/camera/libcameraservice/api2/CameraDeviceClient.cpp | 1 + services/camera/libcameraservice/device3/Camera3Device.cpp | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp index 3d85e90b0e..5a48a62ba7 100644 --- a/services/camera/libcameraservice/api2/CameraDeviceClient.cpp +++ b/services/camera/libcameraservice/api2/CameraDeviceClient.cpp @@ -497,6 +497,7 @@ status_t CameraDeviceClient::flush(int64_t* lastFrameNumber) { if (!mDevice.get()) return DEAD_OBJECT; + mStreamingRequestList.clear(); return mDevice->flush(lastFrameNumber); } diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index f965136819..25e97f3dc0 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -1749,13 +1749,14 @@ void Camera3Device::processCaptureResult(const camera3_capture_result *result) { gotResult = true; - if (frameNumber != mNextResultFrameNumber) { + // TODO: need to track errors for tighter bounds on expected frame number + if (frameNumber < mNextResultFrameNumber) { SET_ERR("Out-of-order capture result metadata submitted! " "(got frame number %d, expecting %d)", frameNumber, mNextResultFrameNumber); return; } - mNextResultFrameNumber++; + mNextResultFrameNumber = frameNumber + 1; CaptureResult captureResult; captureResult.mResultExtras = resultExtras; @@ -1889,13 +1890,14 @@ void Camera3Device::notify(const camera3_notify_msg *msg) { // Verify ordering of shutter notifications { Mutex::Autolock l(mOutputLock); - if (frameNumber != mNextShutterFrameNumber) { + // TODO: need to track errors for tighter bounds on expected frame number. + if (frameNumber < mNextShutterFrameNumber) { SET_ERR("Shutter notification out-of-order. Expected " "notification for frame %d, got frame %d", mNextShutterFrameNumber, frameNumber); break; } - mNextShutterFrameNumber++; + mNextShutterFrameNumber = frameNumber + 1; } CaptureResultExtras resultExtras; -- 2.11.0