check that focus server is available 24/112724/1
authorWonnam Jang <wn.jang@samsung.com>
Thu, 2 Feb 2017 10:24:36 +0000 (19:24 +0900)
committerWonnam Jang <wn.jang@samsung.com>
Thu, 2 Feb 2017 10:24:36 +0000 (19:24 +0900)
Change-Id: Ic75cf92b4b573a5600b68334b63f429b443bbd80
Signed-off-by: Wonnam Jang <wn.jang@samsung.com>
server/ttsd_player.c

index 110da50..e6cbb2f 100644 (file)
@@ -44,6 +44,7 @@ typedef struct {
 } player_s;
 
 #define SOUND_BUFFER_LENGTH    2048
+#define FOCUS_SERVER_READY "/tmp/.focus_server_ready"
 
 /** player init info */
 static bool g_player_init = false;
@@ -554,6 +555,18 @@ int ttsd_player_init()
 
        ecore_thread_max_set(1);
 
+       int cnt = 0;
+       while (1) {
+               if (0 == access(FOCUS_SERVER_READY, F_OK)) {
+                       SLOG(LOG_ERROR, tts_tag(), "[Player SUCCESS] focus server is available");
+                       break;
+               } else {
+                       if (0 == cnt++ % 10)
+                               SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] focus server is not available");
+                       usleep(50000);
+               }
+       }
+
        ret = sound_manager_create_stream_information(SOUND_STREAM_TYPE_VOICE_INFORMATION, __player_focus_state_cb, NULL, &g_stream_info_h);
        if (SOUND_MANAGER_ERROR_NONE != ret) {
                SLOG(LOG_ERROR, tts_tag(), "[Player ERROR] Fail to create stream info");