st-hal: Cache current state for merge sound model usecases
In a recent fix, handle_load_sm and handle_unload_sm transition
the session to loaded state if the session is stopped. The original
state needs to be cached before this happens in order to recover
back to the active state.
Change-Id: Ica978f565cb24da95f5fdff352a8652519ec9143
diff --git a/st_session.c b/st_session.c
index 32a6e90..732125f 100644
--- a/st_session.c
+++ b/st_session.c
@@ -3947,6 +3947,7 @@
static int handle_load_sm(st_proxy_session_t *st_ses, st_session_t *stc_ses)
{
st_hw_session_t *hw_ses = st_ses->hw_ses_current;
+ st_proxy_session_state_fn_t curr_state = st_ses->current_state;
int status = 0;
ALOGV("%s:[c%d-%d]", __func__, stc_ses->sm_handle, st_ses->sm_handle);
@@ -4007,9 +4008,9 @@
goto exit_1;
}
- if (st_ses->current_state == active_state_fn ||
- st_ses->current_state == detected_state_fn ||
- st_ses->current_state == buffering_state_fn) {
+ if (curr_state == active_state_fn ||
+ curr_state == detected_state_fn ||
+ curr_state == buffering_state_fn) {
status = start_session(st_ses, hw_ses, false);
if (status)
@@ -4041,6 +4042,7 @@
static int handle_unload_sm(st_proxy_session_t *st_ses, st_session_t *stc_ses)
{
st_hw_session_t *hw_ses = st_ses->hw_ses_current;
+ st_proxy_session_state_fn_t curr_state = st_ses->current_state;
int status = 0;
ALOGV("%s:[c%d-%d]", __func__, stc_ses->sm_handle, st_ses->sm_handle);
@@ -4092,9 +4094,9 @@
goto exit;
}
- if (st_ses->current_state == active_state_fn ||
- st_ses->current_state == detected_state_fn ||
- st_ses->current_state == buffering_state_fn) {
+ if (curr_state == active_state_fn ||
+ curr_state == detected_state_fn ||
+ curr_state == buffering_state_fn) {
status = start_session(st_ses, hw_ses, false);
if (status)