Loading services/camera/libcameraservice/device3/Camera3Device.cpp +24 −12 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ Camera3Device::Camera3Device(int id): mNextResultFrameNumber(0), mNextReprocessResultFrameNumber(0), mNextShutterFrameNumber(0), mNextReprocessShutterFrameNumber(0), mListener(NULL) { ATRACE_CALL(); Loading Loading @@ -2534,10 +2535,28 @@ void Camera3Device::notifyError(const camera3_error_msg_t &msg, void Camera3Device::notifyShutter(const camera3_shutter_msg_t &msg, NotificationListener *listener) { ssize_t idx; // Set timestamp for the request in the in-flight tracking // and get the request ID to send upstream { Mutex::Autolock l(mInFlightLock); idx = mInFlightMap.indexOfKey(msg.frame_number); if (idx >= 0) { InFlightRequest &r = mInFlightMap.editValueAt(idx); // Verify ordering of shutter notifications { Mutex::Autolock l(mOutputLock); // TODO: need to track errors for tighter bounds on expected frame number. if (r.hasInputBuffer) { if (msg.frame_number < mNextReprocessShutterFrameNumber) { SET_ERR("Shutter notification out-of-order. Expected " "notification for frame %d, got frame %d", mNextReprocessShutterFrameNumber, msg.frame_number); return; } mNextReprocessShutterFrameNumber = msg.frame_number + 1; } else { if (msg.frame_number < mNextShutterFrameNumber) { SET_ERR("Shutter notification out-of-order. Expected " "notification for frame %d, got frame %d", Loading @@ -2546,14 +2565,7 @@ void Camera3Device::notifyShutter(const camera3_shutter_msg_t &msg, } mNextShutterFrameNumber = msg.frame_number + 1; } // Set timestamp for the request in the in-flight tracking // and get the request ID to send upstream { Mutex::Autolock l(mInFlightLock); idx = mInFlightMap.indexOfKey(msg.frame_number); if (idx >= 0) { InFlightRequest &r = mInFlightMap.editValueAt(idx); } ALOGVV("Camera %d: %s: Shutter fired for frame %d (id %d) at %" PRId64, mId, __FUNCTION__, Loading services/camera/libcameraservice/device3/Camera3Device.h +3 −0 Original line number Diff line number Diff line Loading @@ -771,7 +771,10 @@ class Camera3Device : uint32_t mNextResultFrameNumber; // the minimal frame number of the next reprocess result uint32_t mNextReprocessResultFrameNumber; // the minimal frame number of the next non-reprocess shutter uint32_t mNextShutterFrameNumber; // the minimal frame number of the next reprocess shutter uint32_t mNextReprocessShutterFrameNumber; List<CaptureResult> mResultQueue; Condition mResultSignal; NotificationListener *mListener; Loading Loading
services/camera/libcameraservice/device3/Camera3Device.cpp +24 −12 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ Camera3Device::Camera3Device(int id): mNextResultFrameNumber(0), mNextReprocessResultFrameNumber(0), mNextShutterFrameNumber(0), mNextReprocessShutterFrameNumber(0), mListener(NULL) { ATRACE_CALL(); Loading Loading @@ -2534,10 +2535,28 @@ void Camera3Device::notifyError(const camera3_error_msg_t &msg, void Camera3Device::notifyShutter(const camera3_shutter_msg_t &msg, NotificationListener *listener) { ssize_t idx; // Set timestamp for the request in the in-flight tracking // and get the request ID to send upstream { Mutex::Autolock l(mInFlightLock); idx = mInFlightMap.indexOfKey(msg.frame_number); if (idx >= 0) { InFlightRequest &r = mInFlightMap.editValueAt(idx); // Verify ordering of shutter notifications { Mutex::Autolock l(mOutputLock); // TODO: need to track errors for tighter bounds on expected frame number. if (r.hasInputBuffer) { if (msg.frame_number < mNextReprocessShutterFrameNumber) { SET_ERR("Shutter notification out-of-order. Expected " "notification for frame %d, got frame %d", mNextReprocessShutterFrameNumber, msg.frame_number); return; } mNextReprocessShutterFrameNumber = msg.frame_number + 1; } else { if (msg.frame_number < mNextShutterFrameNumber) { SET_ERR("Shutter notification out-of-order. Expected " "notification for frame %d, got frame %d", Loading @@ -2546,14 +2565,7 @@ void Camera3Device::notifyShutter(const camera3_shutter_msg_t &msg, } mNextShutterFrameNumber = msg.frame_number + 1; } // Set timestamp for the request in the in-flight tracking // and get the request ID to send upstream { Mutex::Autolock l(mInFlightLock); idx = mInFlightMap.indexOfKey(msg.frame_number); if (idx >= 0) { InFlightRequest &r = mInFlightMap.editValueAt(idx); } ALOGVV("Camera %d: %s: Shutter fired for frame %d (id %d) at %" PRId64, mId, __FUNCTION__, Loading
services/camera/libcameraservice/device3/Camera3Device.h +3 −0 Original line number Diff line number Diff line Loading @@ -771,7 +771,10 @@ class Camera3Device : uint32_t mNextResultFrameNumber; // the minimal frame number of the next reprocess result uint32_t mNextReprocessResultFrameNumber; // the minimal frame number of the next non-reprocess shutter uint32_t mNextShutterFrameNumber; // the minimal frame number of the next reprocess shutter uint32_t mNextReprocessShutterFrameNumber; List<CaptureResult> mResultQueue; Condition mResultSignal; NotificationListener *mListener; Loading