PLAYER_TRACE_BEGIN("MM:PLAYER:DESTROY");
PLAYER_INSTANCE_CHECK(player);
+ handle->is_shutdown = true;
+
__ADD_MESSAGE(handle, PLAYER_MESSAGE_LOOP_EXIT);
LEGACY_PLAYER_USER_CB_LOCK(handle, MUSE_PLAYER_EVENT_TYPE_PREPARE);
{
player_s *handle = data;
int ret = MM_ERROR_NONE;
- LOGI("[%s]", __FUNCTION__);
+ LPLAYER_FENTER();
ret = mm_player_pause(handle->mm_handle);
if (ret != MM_ERROR_NONE) {
- LOGE("[%s] Failed to pause - core fw error(0x%x)", __FUNCTION__, ret);
+ LOGE("Failed to pause - core fw error(0x%x)", ret);
+ __player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
+
if (handle->error_code == PLAYER_ERROR_NONE) {
- /*MM_MESSAGE_ERROR will not be posted as legacy_player_prepare(sync API) works with return value
- of mm_player_pause So in case of async API we post the error message to application from here */
+ /* if there is no received error msg, it has to be posted here. */
MMMessageParamType msg_param;
msg_param.code = ret;
__msg_callback(MM_MESSAGE_ERROR, (void *)&msg_param, (void *)handle);
}
- ret = mm_player_unrealize(handle->mm_handle);
- if (ret != MM_ERROR_NONE)
- LOGE("[%s] Failed to unrealize - 0x%x", __FUNCTION__, ret);
- __player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
+
+ if (!handle->is_shutdown) {
+ ret = mm_player_unrealize(handle->mm_handle);
+ if (ret != MM_ERROR_NONE)
+ LOGE("Failed to unrealize - 0x%x", ret);
+ }
}
- LOGI("[%s], done", __FUNCTION__);
+
+ LPLAYER_FLEAVE();
return NULL;
}
{
player_s *handle = (player_s *)player;
int ret = MM_ERROR_NONE;
- LOGI("[%s] Start", __FUNCTION__);
+
+ LPLAYER_FENTER();
PLAYER_TRACE_BEGIN("MM:PLAYER:UNPREPARE");
PLAYER_INSTANCE_CHECK(player);
+ handle->is_shutdown = true;
+
/* Initialize the setting regardless of error return */
if (handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK]) {
handle->user_cb[MUSE_PLAYER_EVENT_TYPE_SEEK] = NULL;
__player_update_state(handle, PLAYER_INTERNAL_STATE_IDLE);
handle->is_display_visible = true;
- LOGI("[%s] End", __FUNCTION__);
+
+ LPLAYER_FLEAVE();
PLAYER_TRACE_END();
return PLAYER_ERROR_NONE;
}