From 71c495c64cf2e29e616dd97c55c6acce24e9ccb0 Mon Sep 17 00:00:00 2001 From: Eunhae Choi Date: Mon, 22 Feb 2016 17:11:12 +0900 Subject: [PATCH] set api timeout info according to the content type Change-Id: I65e1dd380a3e0b03bd9477a26d19de0429d1e4b3 --- include/player_private.h | 10 ++++------ src/player.c | 23 ++++++++++++++++++++--- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/include/player_private.h b/include/player_private.h index bec2eb1..c3c86ee 100644 --- a/include/player_private.h +++ b/include/player_private.h @@ -45,7 +45,8 @@ extern "C" { #define PLAYER_NULL_ARG_CHECK(arg) \ PLAYER_CHECK_CONDITION(arg != NULL,PLAYER_ERROR_INVALID_PARAMETER,"PLAYER_ERROR_INVALID_PARAMETER") -#define CALLBACK_TIME_OUT 30 /* FIXME: need to consider the type of playback */ +#define CALLBACK_TIME_OUT 5 +#define MAX_SERVER_TIME_OUT 35 typedef struct _ret_msg_s{ gint api; @@ -92,7 +93,6 @@ typedef struct _callback_cb_info { typedef struct { intptr_t bo; - gboolean is_streaming; gint timeout; } server_info_s; // to check @@ -119,15 +119,13 @@ typedef struct _player_cli_s{ /* server tbm bo */ #define SERVER_TBM_BO(h) ((h)->server.bo) -/* content type is streaming */ -#define IS_STREAMING_CONTENT(h) ((h)->server.is_streaming) /* server state change timeout */ #define SERVER_TIMEOUT(h) ((h)->server.timeout) -int _get_api_timeout(player_cli_s *pc, muse_player_api_e api); -int wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info, char **ret_buf, int time_out); int player_set_evas_object_cb(player_h player, Evas_Object * eo); int player_unset_evas_object_cb(player_h player); +int client_get_api_timeout(player_cli_s *pc, muse_player_api_e api); +int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info, char **ret_buf, int time_out); #ifdef __cplusplus } diff --git a/src/player.c b/src/player.c index 75a28a9..2f246ed 100644 --- a/src/player.c +++ b/src/player.c @@ -1003,7 +1003,7 @@ static void callback_destroy(callback_cb_info_s *cb_info) g_free(cb_info); } -int _get_api_timeout(player_cli_s *pc, muse_player_api_e api) +int client_get_api_timeout(player_cli_s *pc, muse_player_api_e api) { int timeout = 0; @@ -1026,7 +1026,7 @@ int _get_api_timeout(player_cli_s *pc, muse_player_api_e api) return timeout; } -int wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info, char **ret_buf, int time_out) +int client_wait_for_cb_return(muse_player_api_e api, callback_cb_info_s *cb_info, char **ret_buf, int time_out) { int ret = PLAYER_ERROR_NONE; gint64 end_time = g_get_monotonic_time() + time_out * G_TIME_SPAN_SECOND; @@ -1106,7 +1106,7 @@ int player_create(player_h *player) goto ErrorExit; } - ret = wait_for_cb_return(api, pc->cb_info, &ret_buf, CALLBACK_TIME_OUT); + ret = client_wait_for_cb_return(api, pc->cb_info, &ret_buf, CALLBACK_TIME_OUT); if (ret == PLAYER_ERROR_NONE) { intptr_t module_addr; *player = (player_h)pc; @@ -1115,6 +1115,7 @@ int player_create(player_h *player) muse_core_send_client_addr(module_addr, pc->cb_info->data_fd); LOGD("Data channel fd %d, muse module addr %p", pc->cb_info->data_fd, module_addr); } + SERVER_TIMEOUT(pc) = MAX_SERVER_TIME_OUT; /* will be update after prepare phase. */ } else goto ErrorExit; @@ -1184,6 +1185,14 @@ int player_prepare_async(player_h player, player_prepared_cb callback, void *use pc->cb_info->user_data[MUSE_PLAYER_EVENT_TYPE_PREPARE] = user_data; } player_msg_send(api, pc, ret_buf, ret); + if (ret == PLAYER_ERROR_NONE) { + int timeout = 0; + player_msg_get_type(timeout, ret_buf, INT); + + LOGD("server timeout will be %d", timeout); + SERVER_TIMEOUT(pc) = timeout; + } + g_free(ret_buf); return ret; } @@ -1199,6 +1208,14 @@ int player_prepare(player_h player) LOGD("ENTER"); player_msg_send(api, pc, ret_buf, ret); + if (ret == PLAYER_ERROR_NONE) { + int timeout = 0; + player_msg_get_type(timeout, ret_buf, INT); + + LOGD("server timeout will be %d", timeout); + SERVER_TIMEOUT(pc) = timeout; + } + g_free(ret_buf); return ret; } -- 2.7.4