Merge "sthal: switch gcs usecase based on capture device"
diff --git a/st_hw_session_lsm.c b/st_hw_session_lsm.c
index ec2a63b..6252490 100644
--- a/st_hw_session_lsm.c
+++ b/st_hw_session_lsm.c
@@ -1552,7 +1552,7 @@
__func__, ftrt_bytes_written_ms, ((frame_send_time -
buffering_start_time) / NSECS_PER_MSEC));
- if (!p_lsm_ses->common.is_generic_event) {
+ if (p_lsm_ses->common.enable_second_stage && !p_lsm_ses->common.is_generic_event) {
ALOGD("%s: First real time frame took %llums", __func__,
(frame_read_time / NSECS_PER_MSEC));
adjust_ss_buff_end(&p_lsm_ses->common, cnn_append_bytes,
diff --git a/st_session.c b/st_session.c
index f7448ca..04cb3d0 100644
--- a/st_session.c
+++ b/st_session.c
@@ -3831,6 +3831,7 @@
}
goto exit;
}
+ stc_ses->detection_sent = true;
callback = stc_ses->callback;
capture_requested = stc_ses->rc_config->capture_requested;
cookie = stc_ses->cookie;
@@ -4641,6 +4642,7 @@
}
st_ses->det_stc_ses = stc_ses;
st_ses->hw_ses_current->enable_second_stage = false; /* Initialize */
+ stc_ses->detection_sent = false;
if (list_empty(&stc_ses->second_stage_list) ||
st_ses->detection_requested) {
@@ -4735,6 +4737,7 @@
* second stage successfully detects.
*/
if (!enable_second_stage) {
+ stc_ses->detection_sent = true;
callback = stc_ses->callback;
cookie = stc_ses->cookie;
ALOGD("%s:[c%d] invoking the client callback",
@@ -4774,21 +4777,25 @@
do {
status = pthread_mutex_trylock(&st_ses->lock);
} while (status && ((st_ses->current_state == detected_state_fn) ||
- (st_ses->current_state == buffering_state_fn)));
+ (st_ses->current_state == buffering_state_fn)) &&
+ !st_ses->stdev->ssr_offline_received);
if (st_ses->current_state != detected_state_fn) {
ALOGV("%s:[%d] client not in detected state, lock status %d",
__func__, st_ses->sm_handle, status);
if (!status) {
/*
- * Stop session if still in buffering state and no pending
- * stop to be handled i.e. internally buffering was stopped.
- * This is required to avoid further detections in wrong state.
- * Client is expected to issue start recognition for current
- * detection event which will restart the session.
+ * If detection is sent to client while in buffering state,
+ * and if internal buffering is stopped due to errors, stop
+ * session internally as client is expected to restart the
+ * detection if required.
+ * Note: It is possible that detection event is not sent to
+ * client if second stage is not yet detected during internal
+ * buffering stop, in which case restart is posted from second
+ * stage thread for further detections.
*/
if ((st_ses->current_state == buffering_state_fn) &&
- !stc_ses->pending_stop) {
+ !stc_ses->pending_stop && stc_ses->detection_sent) {
ALOGD("%s:[%d] buffering stopped internally, post c%d stop",
__func__, st_ses->sm_handle,
st_ses->det_stc_ses->sm_handle);
diff --git a/st_session.h b/st_session.h
index 5cd73eb..e779aa6 100644
--- a/st_session.h
+++ b/st_session.h
@@ -128,6 +128,7 @@
bool pending_stop;
bool pending_load;
bool pending_set_device;
+ bool detection_sent;
st_det_perf_mode_t client_req_det_mode;
unsigned int hist_buf_duration;
unsigned int preroll_duration;