From: Eunhae Choi Date: Mon, 4 Jun 2018 07:30:23 +0000 (+0900) Subject: [ACR-1236] Add new restriction about _set_display X-Git-Tag: submit/tizen/20180620.045526~1^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=01183144628ea22023e5cb32aee0d7ba55cae3c4;p=platform%2Fcore%2Fapi%2Fplayer.git [ACR-1236] Add new restriction about _set_display Change-Id: I4eb6b78340dfad1cec1ca78bbeecc9f031f8ddb3 --- diff --git a/include/player.h b/include/player.h index 7cbe4b6..65f0a17 100644 --- a/include/player.h +++ b/include/player.h @@ -947,6 +947,11 @@ int player_is_looping(player_h player, bool *looping); * @remarks We are not supporting changing display. * @remarks This function have be called before calling the player_prepare() or player_prepare_async() \n * to reflect the display type. + * @remarks This function must be called in main thread of application. + * Otherwise, it will return #PLAYER_ERROR_INVALID_OPERATION by internal restriction. + * To avoid #PLAYER_ERROR_INVALID_OPERATION in sub thread, ecore_thread_main_loop_begin() and + * ecore_thread_main_loop_end() can be used, but deadlock can be also occurred if main thread is busy. + * So, it's not recommended to use them. (since 5.0) * @param[in] player The handle to the media player * @param[in] type The display type * @param[in] display The handle to display @@ -962,6 +967,8 @@ int player_is_looping(player_h player, bool *looping); * @see player_set_display_roi_area * @see player_set_display_visible * @see player_set_display_rotation + * @see ecore_thread_main_loop_begin() + * @see ecore_thread_main_loop_end() */ int player_set_display(player_h player, player_display_type_e type, player_display_h display); diff --git a/src/player.c b/src/player.c index 52aeabb..93c9cf1 100644 --- a/src/player.c +++ b/src/player.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include @@ -2769,8 +2771,17 @@ int player_set_display(player_h player, player_display_type_e type, player_displ void (*p_disp_get_evas_display_geometry_info)(void *, int *, int *, int *, int *) = NULL; void (*p_disp_media_packet_video_decode_cb)(media_packet_h, void *) = NULL; #endif + pid_t pid = getpid(); + pid_t tid = syscall(SYS_gettid); LOGD("ENTER"); + + LOGD("Check if API is called in main thread. pid [%d], tid [%d]", pid, tid); + if (pid != tid) { + LOGE("API isn't called in main thread"); + return PLAYER_ERROR_INVALID_OPERATION; + } + PLAYER_VIDEO_SUPPORTABLE_CHECK(pc); /* init */