From: Eunhae Choi Date: Thu, 16 Mar 2017 08:25:42 +0000 (+0900) Subject: [0.3.53] clear cb and mem in case destory() is called without unprepare() X-Git-Tag: submit/tizen/20170403.050513~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d62a7c2c2876004faa3605c7091b414d21cb8fcc;p=platform%2Fcore%2Fapi%2Fplayer.git [0.3.53] clear cb and mem in case destory() is called without unprepare() Change-Id: I8f38e243a7efe7bc41a99f66c9ec89f62b62e0c9 --- diff --git a/packaging/capi-media-player.spec b/packaging/capi-media-player.spec index 623a6fe..a7a35e8 100644 --- a/packaging/capi-media-player.spec +++ b/packaging/capi-media-player.spec @@ -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 diff --git a/src/player.c b/src/player.c old mode 100755 new mode 100644 index 201164b..4bf7a4a --- a/src/player.c +++ b/src/player.c @@ -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);