service: session: fix session state in session_prepare
If the session is already in started case and second backend
is connected,then session_prepare() incorrectly updates
the session state to prepared while it was in started state
previously. As a result next device switch fails as session
remains in prepared state and graph_start is not called,
thus stream remains in muted state.
Change-Id: I48e67bf569ad38feab9adc51a80630a4a05eaf79
diff --git a/service/src/session_obj.c b/service/src/session_obj.c
index 75f2f11..26aab24 100644
--- a/service/src/session_obj.c
+++ b/service/src/session_obj.c
@@ -945,6 +945,8 @@
if (ret) {
AGM_LOGE("Error:%d preparing graph\n", ret);
goto done;
+ } else {
+ sess_obj->state = SESSION_PREPARED;
}
}
} else if(sess_obj->state != SESSION_STARTED) {
@@ -952,10 +954,10 @@
if (ret) {
AGM_LOGE("Error:%d preparing graph\n", ret);
goto done;
+ } else {
+ sess_obj->state = SESSION_PREPARED;
}
}
- sess_obj->state = SESSION_PREPARED;
- return ret;
done:
return ret;