Merge "Camera: fix status tracker race condition"

gugelfrei
Treehugger Robot 7 years ago committed by Gerrit Code Review
commit 980796c318

@ -2326,7 +2326,11 @@ status_t Camera3Device::registerInFlight(uint32_t frameNumber,
if (res < 0) return res; if (res < 0) return res;
if (mInFlightMap.size() == 1) { if (mInFlightMap.size() == 1) {
mStatusTracker->markComponentActive(mInFlightStatusId); // hold mLock to prevent race with disconnect
Mutex::Autolock l(mLock);
if (mStatusTracker != nullptr) {
mStatusTracker->markComponentActive(mInFlightStatusId);
}
} }
return OK; return OK;
@ -2353,7 +2357,11 @@ void Camera3Device::removeInFlightMapEntryLocked(int idx) {
// Indicate idle inFlightMap to the status tracker // Indicate idle inFlightMap to the status tracker
if (mInFlightMap.size() == 0) { if (mInFlightMap.size() == 0) {
mStatusTracker->markComponentIdle(mInFlightStatusId, Fence::NO_FENCE); // hold mLock to prevent race with disconnect
Mutex::Autolock l(mLock);
if (mStatusTracker != nullptr) {
mStatusTracker->markComponentIdle(mInFlightStatusId, Fence::NO_FENCE);
}
} }
} }

Loading…
Cancel
Save