static void set_service_out_for_each_client(gpointer data, gpointer user_data)
{
+ unsigned int instant_reprepare_uid = TTS_INVALID_UID;
+ if (NULL != user_data) {
+ instant_reprepare_uid = *((unsigned int *)user_data);
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] Instant on client UID(%u)", instant_reprepare_uid);
+ }
+
tts_client_s *client = (tts_client_s *)data;
if (false == tts_client_is_valid_client(client)) {
SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Client is not valid");
}
tts_client_set_service_out(client, true);
- tts_client_set_current_state(client, TTS_STATE_READY);
tts_core_notify_error_async(client, TTS_ERROR_SERVICE_RESET, -1, "Daemon Reset");
+ unsigned int uid = tts_client_get_uid(client);
+ if (uid != instant_reprepare_uid) {
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] On-demand repreparation required. UID(%u)", uid);
+ tts_client_set_current_state(client, TTS_STATE_READY);
+ } else {
+ SLOG(LOG_INFO, TAG_TTSC, "[INFO] Instantly repreparation required. UID(%u)", uid);
+ tts_client_set_current_state(client, TTS_STATE_CREATED);
+ tts_core_prepare(client);
+ }
+
const tts_service_state_e before_state = tts_client_get_current_service_state(client);
tts_core_notify_service_state_changed(client, before_state, TTS_SERVICE_STATE_BLOCKED);
}
GList* client_list = tts_client_get_client_list();
RETVM_IF(NULL == client_list, TTS_ERROR_OPERATION_FAILED, "[ERROR] Fail to get client list");
+ unsigned int instant_reprepare_uid = TTS_INVALID_UID;
+ int ret = tts_config_mgr_get_instant_reprepare_client(&instant_reprepare_uid);
+ if (TTS_CONFIG_ERROR_NONE != ret) {
+ SLOG(LOG_WARN, TAG_TTSC, "[WARN] Fail to get instant reprepare uid. Skip instant reprepare");
+ }
+
SLOG(LOG_INFO, TAG_TTSC, "[INFO] Set service out to all clients");
- g_list_foreach(client_list, set_service_out_for_each_client, NULL);
+ g_list_foreach(client_list, set_service_out_for_each_client, &instant_reprepare_uid);
g_list_free(client_list);
return TTS_ERROR_NONE;