summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangyeon Jo <changyeon@google.com>2023-06-16 01:40:32 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-06-16 01:40:32 +0000
commitca64f5b1403923849aa0be44c528b1476701eb79 (patch)
tree522d3931d1e16fea63578523852b2f033f13fdbd
parentcb0946d2c5af87f34c64a67fda765eb178186bde (diff)
parente0868c44840d50be13f22fa45a4f9e5b98f090a2 (diff)
Increase frame counters in the same critical section am: 928a4535c8 am: a343d0cf0c am: c070b5a14b am: 55baee93d6 am: e0868c4484
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2594993 Change-Id: Ic4cd9e7c9fe0bbb9693a0c23a9309aae5527bcea Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--automotive/evs/1.0/vts/functional/FrameHandler.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/automotive/evs/1.0/vts/functional/FrameHandler.cpp b/automotive/evs/1.0/vts/functional/FrameHandler.cpp
index 6a01a44dfe..4233430478 100644
--- a/automotive/evs/1.0/vts/functional/FrameHandler.cpp
+++ b/automotive/evs/1.0/vts/functional/FrameHandler.cpp
@@ -133,6 +133,9 @@ Return<void> FrameHandler::deliverFrame(const BufferDesc& bufferArg) {
// Local flag we use to keep track of when the stream is stopping
bool timeToStop = false;
+ // Another local flag telling whether or not current frame is displayed.
+ bool frameDisplayed = false;
+
if (bufferArg.memHandle.getNativeHandle() == nullptr) {
// Signal that the last frame has been received and the stream is stopped
timeToStop = true;
@@ -172,9 +175,7 @@ Return<void> FrameHandler::deliverFrame(const BufferDesc& bufferArg) {
} else {
// Everything looks good!
// Keep track so tests or watch dogs can monitor progress
- mLock.lock();
- mFramesDisplayed++;
- mLock.unlock();
+ frameDisplayed = true;
}
}
}
@@ -197,12 +198,15 @@ Return<void> FrameHandler::deliverFrame(const BufferDesc& bufferArg) {
}
- // Update our received frame count and notify anybody who cares that things have changed
+ // Update frame counters and notify anybody who cares that things have changed.
mLock.lock();
if (timeToStop) {
mRunning = false;
} else {
mFramesReceived++;
+ if (frameDisplayed) {
+ mFramesDisplayed++;
+ }
}
mLock.unlock();
mSignal.notify_all();