Camera3: Adding checks for stream handle
In certain conditions it is possible that flush
is called before the stream handles are initialized.
Ex: between configureStreams & processCaptureRequest
Adding more checks for such cases.
Bug: 23186410
Ack by: Mansoor Aftab
Change-Id: I10c5ef691ba12f9cf98363613ad28070d82514c3
diff --git a/QCamera2/HAL3/QCamera3Channel.cpp b/QCamera2/HAL3/QCamera3Channel.cpp
index 5446abc..9147dbd 100644
--- a/QCamera2/HAL3/QCamera3Channel.cpp
+++ b/QCamera2/HAL3/QCamera3Channel.cpp
@@ -342,9 +342,12 @@
memset(¶m, 0, sizeof(cam_stream_parm_buffer_t));
param.type = CAM_STREAM_PARAM_TYPE_SET_BUNDLE_INFO;
param.bundleInfo = bundleInfo;
- rc = mStreams[0]->setParameter(param);
- if (rc != NO_ERROR) {
- ALOGE("%s: stream setParameter for set bundle failed", __func__);
+
+ if (mStreams[0] != NULL) {
+ rc = mStreams[0]->setParameter(param);
+ if (rc != NO_ERROR) {
+ ALOGE("%s: stream setParameter for set bundle failed", __func__);
+ }
}
return rc;
diff --git a/QCamera2/HAL3/QCamera3HWI.cpp b/QCamera2/HAL3/QCamera3HWI.cpp
index 63e6d8f..3dc6c9f 100644
--- a/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/QCamera2/HAL3/QCamera3HWI.cpp
@@ -3687,6 +3687,12 @@
CDBG("%s: Unblocking Process Capture Request", __func__);
pthread_mutex_lock(&mMutex);
+
+ if (mFirstRequest) {
+ pthread_mutex_unlock(&mMutex);
+ return NO_ERROR;
+ }
+
mFlush = true;
pthread_mutex_unlock(&mMutex);