From d9ef0e085dfa82ecfc449a8fa29eba564b13ac72 Mon Sep 17 00:00:00 2001 From: Shuzhen Wang Date: Mon, 16 Jul 2018 10:22:21 -0700 Subject: [PATCH] Camera: Mark stream as ABANDONED if dequeueBuffer returns DEAD_OBJECT When consumer surface is destroyed, dequeueBuffer may return DEAD_OBJECT. We need to treat this condition as ABANDONED so that camera service stops repeating request. Otherwise, we may run into infinite loop. Test: Camera CTS Bug: 111384143 Bug: 111381452 Change-Id: If3348119521e9805085321c7f20abd7cc7f5dd43 --- .../camera/libcameraservice/device3/Camera3OutputStream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp index b3c3717c3d..2c020a2797 100644 --- a/services/camera/libcameraservice/device3/Camera3OutputStream.cpp +++ b/services/camera/libcameraservice/device3/Camera3OutputStream.cpp @@ -564,7 +564,7 @@ status_t Camera3OutputStream::getBufferLockedCommon(ANativeWindowBuffer** anb, i // Only transition to STATE_ABANDONED from STATE_CONFIGURED. (If it is STATE_PREPARING, // let prepareNextBuffer handle the error.) - if (res == NO_INIT && mState == STATE_CONFIGURED) { + if ((res == NO_INIT || res == DEAD_OBJECT) && mState == STATE_CONFIGURED) { mState = STATE_ABANDONED; }