[1.0.4] resolve evas resource leak 89/321589/2 accepted/tizen_unified accepted/tizen_unified_x tizen accepted/tizen/unified/20250327.154217 accepted/tizen/unified/x/20250327.215021
authorEunhye Choi <eunhae1.choi@samsung.com>
Tue, 25 Mar 2025 10:34:14 +0000 (19:34 +0900)
committerEunhye Choi <eunhae1.choi@samsung.com>
Wed, 26 Mar 2025 04:13:44 +0000 (13:13 +0900)
- evas resource can not be released
  while the mainloop is occupied by player api
  which is waiting muse return
- after getting return of unprepare operation, release evas resource

Change-Id: I9add3b401351bdc412513c1ee14ac6dcfd338f07

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

index 6f1bdecb517bafb6ceccecccffeb687a26ab8e01..fcae7d0588773852a4f04e6f495376f7d48c0a40 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    1.0.3
+Version:    1.0.4
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index e6fea392641ed49e4f22ba0a95130d0b72416670..26b8accad0845d0f7a211ebc05440246aa2419d9 100644 (file)
@@ -1621,7 +1621,7 @@ static void _player_internal_buffer_release(player_cli_s *pc)
 
        if (!DP_INTERFACE(pc)) {
                LOGW("display port interface is NULL");
-               goto RELEASE_INTERNAL_MOMORY;
+               goto RELEASE_INTERNAL_MEMORY;
        }
 
        if (mm_display_interface_get_type(DP_INTERFACE(pc), &display_type) != MM_ERROR_NONE) {
@@ -1630,7 +1630,7 @@ static void _player_internal_buffer_release(player_cli_s *pc)
        }
 
        if (display_type != MM_DISPLAY_TYPE_EVAS)
-               goto RELEASE_INTERNAL_MOMORY;
+               goto RELEASE_INTERNAL_MEMORY;
 
        if (CALLBACK_INFO(pc)->dp_info.visible != PLAYER_VISIBLE_INFO_FALSE) {
                if (mm_display_interface_evas_set_visible(DP_INTERFACE(pc), false) != MM_ERROR_NONE) {
@@ -1639,12 +1639,13 @@ static void _player_internal_buffer_release(player_cli_s *pc)
                }
        }
 
+       /* this function waits to excute on the main thread (timeout 1 sec) */
        if (mm_display_interface_evas_flush(DP_INTERFACE(pc), false) != MM_ERROR_NONE) {
                LOGE("mm_display_interface_evas_flush failed");
                return;
        }
 
-RELEASE_INTERNAL_MOMORY:
+RELEASE_INTERNAL_MEMORY:
        _player_release_internal_memory(pc, false);
        pc->cb_info->video_frame_pool_size = 0;
        __player_remove_tsurf_list(pc);
@@ -1678,15 +1679,8 @@ static bool _event_callback_handler(callback_cb_info_s *cb_info, muse_player_eve
                return false;
        }
 
-       if (event == MUSE_PLAYER_EVENT_TYPE_STATE_CHANGED ||
-               event == MUSE_PLAYER_EVENT_TYPE_INTERRUPT) {
+       if (event == MUSE_PLAYER_EVENT_TYPE_INTERRUPT)
                _player_internal_buffer_release((player_cli_s *)cb_info->pc);
-               if (event == MUSE_PLAYER_EVENT_TYPE_STATE_CHANGED) {
-                       g_free(recv_data->buffer);
-                       g_free(recv_data);
-                       return true;
-               }
-       }
 
        return _user_callback_handler(cb_info, event, recv_data);
 }
@@ -2319,6 +2313,8 @@ int player_unprepare(player_h player)
        g_free(ret_buf);
 
 EXIT:
+       _player_internal_buffer_release(pc);
+
        LOGD("LEAVE 0x%X", ret);
        return ret;
 }