Remove check for new requested sync before flushing shadow queue
In transactionCommittedCallback, the code checks to make sure there are
no sync transactions still in flight and checks if no new requested sync
has come in before flushing shadow queue. The second check was intented
to give onFrameAvailable a chance to drop these sandwiched frames.
However, that can't happen because by the time onFrameAvailable is
called, there is no sync in flight and it doesn't consider the frames
sandwiched, but rather frames that were just submitted before the sync.
Therefore, it's safe to just remove this check and attempt to flush the
shadow queue. This fixes the ANR since it will ensure frames are flushed
if possible by the time onFrameAvailable is called. If we have actually
ran out of buffers, there's a guarantee that a release callback should
occur, which will then flush the shadow queue at that point.
Fixes: 293692258
Test: race condition hard to reproduce
Change-Id: If3568c1db6b4063ee1b4044067d298e5c2c8b6f1
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index 5c324b2..207fa4f 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -303,13 +303,8 @@
// frame numbers that were in a sync. We remove the frame from mSyncedFrameNumbers
// set and then check if it's empty. If there are no more pending syncs, we can
// proceed with flushing the shadow queue.
- // We also want to check if mSyncTransaction is null because it's possible another
- // sync request came in while waiting, but it hasn't started processing yet. In that
- // case, we don't actually want to flush the frames in between since they will get
- // processed and merged with the sync transaction and released earlier than if they
- // were sent to SF
mSyncedFrameNumbers.erase(currFrameNumber);
- if (mSyncedFrameNumbers.empty() && mSyncTransaction == nullptr) {
+ if (mSyncedFrameNumbers.empty()) {
flushShadowQueue();
}
} else {