Sets processingEvsFrames earlier to fix conflicts
Bug: 160184397
Bug: 162599435
Test: m -j
Change-Id: I8eab57c363721030851220b8dd1e3a3981ac4e2b
Merged-In: I8eab57c363721030851220b8dd1e3a3981ac4e2b
(cherry picked from commit b2c160992a55ece5347e0c4aac0bb25cf736fc91)
diff --git a/surround_view/service-impl/SurroundView2dSession.cpp b/surround_view/service-impl/SurroundView2dSession.cpp
index dfc2587..15a85a3 100644
--- a/surround_view/service-impl/SurroundView2dSession.cpp
+++ b/surround_view/service-impl/SurroundView2dSession.cpp
@@ -77,9 +77,14 @@
{
scoped_lock<mutex> lock(mSession->mAccessLock);
if (mSession->mProcessingEvsFrames) {
- LOG(WARNING) << "EVS frames are being processed. Skip frames:" << mSession->mSequenceId;
+ LOG(WARNING) << "EVS frames are being processed. Skip frames:"
+ << mSession->mSequenceId;
mCamera->doneWithFrame_1_1(buffers);
return {};
+ } else {
+ // Sets the flag to true immediately so the new coming frames will
+ // be skipped.
+ mSession->mProcessingEvsFrames = true;
}
}
@@ -103,10 +108,6 @@
mCamera->doneWithFrame_1_1(buffers);
// Notify the session that a new set of frames is ready
- {
- scoped_lock<mutex> lock(mSession->mAccessLock);
- mSession->mProcessingEvsFrames = true;
- }
mSession->mFramesSignal.notify_all();
return {};
diff --git a/surround_view/service-impl/SurroundView3dSession.cpp b/surround_view/service-impl/SurroundView3dSession.cpp
index 4e0d53a..99800d9 100644
--- a/surround_view/service-impl/SurroundView3dSession.cpp
+++ b/surround_view/service-impl/SurroundView3dSession.cpp
@@ -85,6 +85,10 @@
<< mSession->mSequenceId;
mCamera->doneWithFrame_1_1(buffers);
return {};
+ } else {
+ // Sets the flag to true immediately so the new coming frames will
+ // be skipped.
+ mSession->mProcessingEvsFrames = true;
}
}
@@ -108,10 +112,6 @@
mCamera->doneWithFrame_1_1(buffers);
// Notify the session that a new set of frames is ready
- {
- scoped_lock<mutex> lock(mSession->mAccessLock);
- mSession->mProcessingEvsFrames = true;
- }
mSession->mFramesSignal.notify_all();
return {};