static void __set_policy_for_playing(int volume)
{
+ pthread_mutex_lock(&g_delayed_unset_policy_mutex);
+ if (NULL != g_delayed_unset_policy_timer) {
+ ecore_timer_del(g_delayed_unset_policy_timer);
+ g_delayed_unset_policy_timer = NULL;
+ }
+ pthread_mutex_unlock(&g_delayed_unset_policy_mutex);
- __change_background_volume();
-
/* Set stream info */
int ret;
ttsd_mode_e mode = ttsd_get_mode();
SLOG(LOG_WARN, tts_tag(), "[Player WARNING] Fail to set stream info");
}
+ __change_background_volume();
g_is_set_policy = true;
+ SLOG(LOG_ERROR, tts_tag(), "[BG] g_is_set_policy(%d)", g_is_set_policy);
+ clock_gettime(CLOCK_MONOTONIC, &g_policy_set_time);
+
SLOG(LOG_DEBUG, tts_tag(), "[Player DEBUG] set policy for playing");
return;
}
}
+ struct timespec current_time;
+ clock_gettime(CLOCK_MONOTONIC, ¤t_time);
+
+ long long int diff = ((long long int)current_time.tv_sec - (long long int)g_policy_set_time.tv_sec) * 1000
+ + ((long long int)current_time.tv_nsec - (long long int)g_policy_set_time.tv_nsec) / 1000000;
+ SLOG(LOG_INFO, tts_tag(), "[BG] Time Diff(%lld)", diff);
+
+ pthread_mutex_lock(&g_delayed_unset_policy_mutex);
+ if (NULL == g_delayed_unset_policy_timer) {
+ if (diff > SND_MGR_DUCKING_DURATION) {
+ SLOG(LOG_INFO, tts_tag(), "[BG] Direct unset policy");
+ __recover_background_volume();
+ } else {
+ ecore_main_loop_thread_safe_call_sync(__set_timer_for_unset, NULL);
+ }
+ }
+ pthread_mutex_unlock(&g_delayed_unset_policy_mutex);
+
__recover_background_volume();
-
g_is_set_policy = false;
+ SLOG(LOG_ERROR, tts_tag(), "[BG] g_is_set_policy(%d)", g_is_set_policy);
+
SLOG(LOG_DEBUG, tts_tag(), "[Player DEBUG] unset policy for playing");