[0.3.53] clear cb and mem in case destory() is called without unprepare() 42/121842/1
authorEunhae Choi <eunhae1.choi@samsung.com>
Thu, 16 Mar 2017 08:25:42 +0000 (17:25 +0900)
committerEunhae Choi <eunhae1.choi@samsung.com>
Wed, 29 Mar 2017 07:24:34 +0000 (16:24 +0900)
Change-Id: I8f38e243a7efe7bc41a99f66c9ec89f62b62e0c9

packaging/capi-media-player.spec
src/player.c [changed mode: 0755->0644]

index 623a6fec337dda90f4caca89ff44abbe3276e56f..a7a35e8217e6f58bf79c5ecb2c763032ab9f9dcf 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-player
 Summary:    A Media Player API
-Version:    0.3.52
+Version:    0.3.53
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
old mode 100755 (executable)
new mode 100644 (file)
index 201164b..4bf7a4a
@@ -127,6 +127,7 @@ static void __retrieve_buffer_cb(void *user_data);
 static int __player_set_retrieve_buffer_cb(player_h player, player_retrieve_buffer_cb callback, void *user_data);
 static int __player_unset_retrieve_buffer_cb(player_h player);
 #endif
+static void _player_release_internal_memory(player_cli_s * pc);
 
 int _player_media_packet_finalize(media_packet_h pkt, int error_code, void *user_data)
 {
@@ -1911,6 +1912,11 @@ int player_destroy(player_h player)
 
        LOGD("ENTER");
 
+       /* clear cb and release mem */
+       set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK);
+       set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE);
+       _player_release_internal_memory(pc);
+
        player_msg_send(api, pc, ret_buf, ret);
 #ifdef TIZEN_FEATURE_EVAS_RENDERER
        if (CALLBACK_INFO(pc) && EVAS_HANDLE(pc)) {
@@ -2015,8 +2021,7 @@ int player_unprepare(player_h player)
        if (ret == PLAYER_ERROR_NONE) {
                set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_SEEK);
                set_null_user_cb_lock(pc->cb_info, MUSE_PLAYER_EVENT_TYPE_PREPARE);
-               _del_mem(pc);
-               _player_deinit_memory_buffer(pc);
+               _player_release_internal_memory(pc);
        }
 
        pc->cb_info->video_frame_pool_size = 0;
@@ -2146,6 +2151,15 @@ int player_set_memory_buffer(player_h player, const void *data, int size)
        return ret;
 }
 
+static void _player_release_internal_memory(player_cli_s * pc)
+{
+       if (!pc)
+               return;
+
+       _del_mem(pc);
+       _player_deinit_memory_buffer(pc);
+}
+
 static int _player_deinit_memory_buffer(player_cli_s * pc)
 {
        PLAYER_INSTANCE_CHECK(pc);