[0.3.136] Return error when muse client get module index failed 76/244376/3
authorGilbok Lee <gilbok.lee@samsung.com>
Fri, 18 Sep 2020 02:02:37 +0000 (11:02 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Fri, 18 Sep 2020 04:33:31 +0000 (13:33 +0900)
Change-Id: I48b4ae33cb63ee3f78a58539e666553dfa8f9e72

include/player_private.h
packaging/capi-media-player.spec
src/player.c

index 8cfb668a0eb74a308b69c129b441b783604e1472..64d0b5d08dfc0a9a9114b43846b7d718594f4d06 100644 (file)
@@ -91,7 +91,7 @@ do { \
        } \
 } while (0)
 
-#define CONNECTION_RETRY 51
+#define CONNECTION_RETRY 50
 #define CONNECTION_TIME_OUT 50 /* ms */
 #define CREATE_CB_TIME_OUT 400 /* ms */
 #define CALLBACK_TIME_OUT 5000 /* ms */
index 204afdf9069fd56a2208ccd95940d5bc1f546496..2d86e5763e98bb27f5b74a71fa9c7bf065c18f6e 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.135
+Version:    0.3.136
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 22b493dac7ad52e6ac2873547080c84e77395175..1ff746c3da7fb46f59e765fe078ec17a48336f88 100644 (file)
@@ -2024,9 +2024,8 @@ int player_create(player_h *player)
        muse_player_api_e api = MUSE_PLAYER_API_CREATE;
        int module_index = INVALID_DEFAULT_VALUE;
        player_cli_s *pc = NULL;
-       char *ret_buf = NULL;
+       gchar *ret_buf = NULL;
        int retry_count = CONNECTION_RETRY;
-       bool retry = false;
 
        PLAYER_INSTANCE_CHECK(player);
 
@@ -2036,19 +2035,19 @@ int player_create(player_h *player)
        if (pc == NULL)
                return PLAYER_ERROR_OUT_OF_MEMORY;
 
-       while (--retry_count) {
+       while (retry_count--) {
                ret = PLAYER_ERROR_NONE;
                sock_fd = muse_client_new();
                if (sock_fd <= INVALID_DEFAULT_VALUE) {
                        LOGE("connection failure %d", errno);
                        ret = PLAYER_ERROR_INVALID_OPERATION;
-                       retry = true;
                        usleep(CONNECTION_TIME_OUT * G_TIME_SPAN_MILLISECOND);
-                       goto ERROR;
+                       goto ERROR_RETRY;
                }
 
                if (muse_client_get_module_index(MODULE_NAME, &module_index) != MM_ERROR_NONE) {
                        LOGE("muse client get module index failed");
+                       ret = PLAYER_ERROR_INVALID_OPERATION;
                        goto ERROR;
                }
 
@@ -2066,11 +2065,8 @@ int player_create(player_h *player)
                }
 
                ret = client_wait_for_server_ack(api, pc->cb_info, CREATE_CB_TIME_OUT);
-               if (ret == PLAYER_ERROR_INVALID_OPERATION) {
-                       retry = true;
-                       goto ERROR;
-               }
-               retry = false;
+               if (ret == PLAYER_ERROR_INVALID_OPERATION)
+                       goto ERROR_RETRY;
 
                if (!_player_event_queue_new(pc->cb_info)) {
                        LOGE("fail to create event queue");
@@ -2120,6 +2116,8 @@ int player_create(player_h *player)
                return ret;
 
 ERROR:
+               retry_count = 0;
+ERROR_RETRY:
                if (pc && pc->cb_info) {
                        if (pc->cb_info->event_queue.running)
                                _player_event_queue_destroy(pc->cb_info);
@@ -2129,11 +2127,10 @@ ERROR:
                        muse_client_close(sock_fd);
                }
                sock_fd = INVALID_DEFAULT_VALUE;
+
                g_free(ret_buf);
                ret_buf = NULL;
                LOGE("ret value : %d, retry #%d", ret, CONNECTION_RETRY - retry_count);
-               if (!retry)
-                       break;
        }
        g_free(pc);
        pc = NULL;