[0.3.103] modify the seek cb handler 58/190858/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Mon, 8 Oct 2018 06:06:25 +0000 (15:06 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Mon, 8 Oct 2018 06:06:29 +0000 (15:06 +0900)
- modify code to help code reading for each state case

Change-Id: I9a212978ccc4b01fe3ec5ad5d00a944e82c41ca2

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

index 8b5d545f4487ee44b549be82701e4714fefc33a7..4f1cfaec018f66a903d401e004cb268dfbfe0926 100644 (file)
@@ -2451,7 +2451,7 @@ int player_get_video_roi_area(player_h player, double *x_scale, double *y_scale,
  * @brief Sets the streaming buffering time.
  * @since_tizen 4.0
  * @param[in] player        The handle to the media player
- * @param[in] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback.
+ * @param[in] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback
  * @param[in] rebuffer_ms   The time duration of buffering data that must be prerolled to resume playback
  *                          if player is paused for buffering internally.
  * @return @c 0 on success,
@@ -2469,7 +2469,7 @@ int player_set_streaming_buffering_time(player_h player, int prebuffer_ms, int r
  * @brief Gets the streaming buffering time.
  * @since_tizen 4.0
  * @param[in]  player        The handle to the media player
- * @param[out] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback.
+ * @param[out] prebuffer_ms  The time duration of buffering data that must be prerolled to start playback
  * @param[out] rebuffer_ms   The time duration of buffering data that must be prerolled to resume playback
  *                           if player enters pause state for buffering.
  * @return @c 0 on success,
index caa9c0a531c6b8ffe263bd688b7e032597c1026d..8e4c4c31c6eb21379b37d7cddb15e1f25360d229 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.102
+Version:    0.3.103
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 6505597ffd509f3146a1e300560841e03f4fd745..2956c5b1487ba93eadae17bd16110894d7dd2f02 100644 (file)
@@ -470,6 +470,8 @@ static void set_null_user_cb_lock(callback_cb_info_s * cb_info, muse_player_even
 {
        bool lock = false;
 
+       LOGD("event %d cb will be cleared", event);
+
        if (!cb_info) {
                LOGE("cb_info is NULL, event: %d", event);
                return;
@@ -679,7 +681,15 @@ static void __seek_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *r
        int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
 #endif
        g_mutex_lock(&cb_info->seek_cb_mutex);
-       if (cb_info->user_cb[ev] && cb_info->seek_cb_state == PLAYER_SEEK_CB_STATE_NONE) {
+
+       switch (cb_info->seek_cb_state) {
+       case PLAYER_SEEK_CB_STATE_NONE:
+       {
+               if (!cb_info->user_cb[ev]) {
+                       LOGW("invalid seek callback info, skip");
+                       break;
+               }
+
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
                if (cb_info->evas_info && cb_info->evas_info->support_video) {
                        if (cb_info->evas_info->handle && cb_info->evas_info->visible != EVAS_VISIBLE_FALSE) {
@@ -701,9 +711,18 @@ static void __seek_cb_handler(callback_cb_info_s * cb_info, _player_recv_data *r
                LOGD("call seek cb");
                ((player_seek_completed_cb) cb_info->user_cb[ev]) (cb_info->user_data[ev]);
                set_null_user_cb(cb_info, ev);
-       } else {
-               LOGW("ignored. seek cb %p", cb_info->user_cb[ev]);
+
+               break;
        }
+       case PLAYER_SEEK_CB_STATE_DROP:
+       case PLAYER_SEEK_CB_STATE_WAIT: /* not expected */
+               LOGW("ignored. seek cb %p, state %d", cb_info->user_cb[ev], cb_info->seek_cb_state);
+               break;
+       default:
+               LOGE("invalid state value");
+               break;
+       }
+
        g_mutex_unlock(&cb_info->seek_cb_mutex);
 }
 
@@ -2002,7 +2021,7 @@ int player_destroy(player_h player)
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        int (*p_disp_destroy_evas_display)(void **) = NULL;
 #endif
-       LOGD("ENTER");
+       LOGD("ENTER %p", pc);
 
        /* clear cb and release mem */
        set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK);
@@ -2087,7 +2106,7 @@ int player_prepare(player_h player)
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
 
-       LOGD("ENTER");
+       LOGD("ENTER %p", pc);
 
        PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        if (ret == PLAYER_ERROR_NONE) {
@@ -2114,7 +2133,7 @@ int player_unprepare(player_h player)
        int (*p_disp_evas_display_retrieve_all_packets)(void *, bool) = NULL;
        player_state_e state = PLAYER_STATE_NONE;
 
-       LOGD("ENTER");
+       LOGD("ENTER %p", pc);
 
        if (_get_current_state(pc, &state) != PLAYER_ERROR_NONE) {
                LOGE("Failed to get state");
@@ -2483,7 +2502,7 @@ int player_start(player_h player)
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
 
-       LOGD("ENTER");
+       LOGD("ENTER %p", pc);
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
 
@@ -2521,7 +2540,7 @@ int player_stop(player_h player)
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        int (*p_disp_set_evas_display_visible)(void *, bool) = NULL;
 #endif
-       LOGD("ENTER");
+       LOGD("ENTER %p", pc);
 
        /* check player state */
        if (_get_current_state(pc, &state) != PLAYER_ERROR_NONE) {
@@ -2566,7 +2585,7 @@ int player_pause(player_h player)
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
 
-       LOGD("ENTER");
+       LOGD("ENTER %p", pc);
 
        PLAYER_SEND_MSG(api, pc, ret_buf, ret);
        g_free(ret_buf);
@@ -2585,7 +2604,7 @@ static int _set_play_position(player_h player, int64_t pos, bool accurate, playe
        player_cli_s *pc = (player_cli_s *) player;
        char *ret_buf = NULL;
 
-       LOGD("ENTER");
+       LOGD("ENTER %p", pc);
 
        if (!pc->cb_info) {
                LOGE("cb_info is null");