Merge commit '1cd2b06ca04caca7f942a8774436c9f224ca4bce' into HEAD
diff --git a/QCamera2/HAL3/QCamera3HWI.cpp b/QCamera2/HAL3/QCamera3HWI.cpp
index 8f92d11..c7342b8 100644
--- a/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/QCamera2/HAL3/QCamera3HWI.cpp
@@ -403,6 +403,7 @@
QCamera3HardwareInterface::~QCamera3HardwareInterface()
{
CDBG("%s: E", __func__);
+ bool hasPendingBuffers = (mPendingBuffersMap.num_buffers > 0);
/* Turn off current power hint before acquiring perfLock in case they
* conflict with each other */
@@ -473,6 +474,15 @@
/* Clean up all channels */
if (mCameraInitialized) {
if(!mFirstConfiguration){
+ clear_metadata_buffer(mParameters);
+
+ // Check if there is still pending buffer not yet returned.
+ if (hasPendingBuffers) {
+ uint8_t restart = TRUE;
+ ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_DAEMON_RESTART,
+ restart);
+ }
+
//send the last unconfigure
cam_stream_size_info_t stream_config_info;
memset(&stream_config_info, 0, sizeof(cam_stream_size_info_t));
@@ -481,6 +491,7 @@
m_bIs4KVideo ? 0 : MAX_INFLIGHT_REQUESTS;
ADD_SET_PARAM_ENTRY_TO_BATCH(mParameters, CAM_INTF_META_STREAM_INFO,
stream_config_info);
+
int rc = mCameraHandle->ops->set_parms(mCameraHandle->camera_handle, mParameters);
if (rc < 0) {
ALOGE("%s: set_parms failed for unconfigure", __func__);
@@ -515,6 +526,12 @@
pthread_cond_destroy(&mRequestCond);
pthread_mutex_destroy(&mMutex);
+
+ if (hasPendingBuffers) {
+ ALOGE("%s: Not all buffers were returned. Notified the camera daemon process to restart."
+ " Exiting here...", __func__);
+ exit(EXIT_FAILURE);
+ }
CDBG("%s: X", __func__);
}
diff --git a/QCamera2/stack/common/cam_intf.h b/QCamera2/stack/common/cam_intf.h
index 678ae26..52682c3 100644
--- a/QCamera2/stack/common/cam_intf.h
+++ b/QCamera2/stack/common/cam_intf.h
@@ -783,6 +783,7 @@
INCLUDE(CAM_INTF_META_LDAF_EXIF, uint32_t, 2);
INCLUDE(CAM_INTF_META_BLACK_LEVEL_SOURCE_PATTERN, cam_black_level_metadata_t, 1);
INCLUDE(CAM_INTF_META_BLACK_LEVEL_APPLIED_PATTERN, cam_black_level_metadata_t, 1);
+ INCLUDE(CAM_INTF_META_DAEMON_RESTART, uint8_t, 1);
} metadata_data_t;
/* Update clear_metadata_buffer() function when a new is_xxx_valid is added to
diff --git a/QCamera2/stack/common/cam_types.h b/QCamera2/stack/common/cam_types.h
index f93ab75..2bffc91 100644
--- a/QCamera2/stack/common/cam_types.h
+++ b/QCamera2/stack/common/cam_types.h
@@ -1774,6 +1774,8 @@
/* Whether EIS is enabled */
CAM_INTF_META_VIDEO_STAB_MODE,
+ /* Whether HAL has run into DRAIN error */
+ CAM_INTF_META_DAEMON_RESTART,
CAM_INTF_PARM_MAX
} cam_intf_parm_type_t;