summaryrefslogtreecommitdiff
path: root/libs/gui/ConsumerBase.cpp
diff options
context:
space:
mode:
author Dan Stoza <stoza@google.com> 2017-06-26 14:27:18 -0700
committer Dan Stoza <stoza@google.com> 2017-06-26 14:27:18 -0700
commit95971c8172495f7b6a0ede1a3508472b9a4e7b36 (patch)
tree1de55d3c919e9d0c075b9841f1a124dd15e914f7 /libs/gui/ConsumerBase.cpp
parenta17b14eb92f6c21a9cea97ed0ca30df74da9fc29 (diff)
libgui: New mutex for ConsumerBase frame callbacks
Adds a new mutex to protect ConsumerBase's mFrameAvailableListener separately from the main mMutex. This prevents deadlocks when trying to perform callbacks in response to other calls that come through ConsumerBase. Bug: 62915791 Test: EncodeVirtualDisplayWithCompositionTest# testRenderingMaxResolutionRemotely Change-Id: I244dc2d83488e452d9690c0d7847c9ff15a95dbb
Diffstat (limited to 'libs/gui/ConsumerBase.cpp')
-rw-r--r--libs/gui/ConsumerBase.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index c2b10a91dd..3d3637648c 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -106,7 +106,7 @@ void ConsumerBase::onFrameAvailable(const BufferItem& item) {
sp<FrameAvailableListener> listener;
{ // scope for the lock
- Mutex::Autolock lock(mMutex);
+ Mutex::Autolock lock(mFrameAvailableMutex);
listener = mFrameAvailableListener.promote();
}
@@ -121,7 +121,7 @@ void ConsumerBase::onFrameReplaced(const BufferItem &item) {
sp<FrameAvailableListener> listener;
{
- Mutex::Autolock lock(mMutex);
+ Mutex::Autolock lock(mFrameAvailableMutex);
listener = mFrameAvailableListener.promote();
}
@@ -185,7 +185,7 @@ bool ConsumerBase::isAbandoned() {
void ConsumerBase::setFrameAvailableListener(
const wp<FrameAvailableListener>& listener) {
CB_LOGV("setFrameAvailableListener");
- Mutex::Autolock lock(mMutex);
+ Mutex::Autolock lock(mFrameAvailableMutex);
mFrameAvailableListener = listener;
}