diff options
author | eunhae choi <eunhae1.choi@samsung.com> | 2019-06-20 03:56:05 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.ap-northeast-2.compute.internal> | 2019-06-20 03:56:05 +0000 |
commit | 2e0db99b5ef2864ea95b97ba2639528445626e7e (patch) | |
tree | fbf7b48cf2a6f7835062c9ea0e88da98434977b4 | |
parent | d512c8808ae3799d7b0e2bd8af8e78decbb7de8c (diff) | |
parent | bc14578950cd32e3a016733c2e9331efbf45ce35 (diff) | |
download | libmm-player-2e0db99b5ef2864ea95b97ba2639528445626e7e.tar.gz libmm-player-2e0db99b5ef2864ea95b97ba2639528445626e7e.tar.bz2 libmm-player-2e0db99b5ef2864ea95b97ba2639528445626e7e.zip |
Merge "[0.6.195] apply the RM policy about audio offload" into tizensubmit/tizen/20190620.045213accepted/tizen/unified/20190620.123715
-rw-r--r-- | src/include/mm_player_priv.h | 2 | ||||
-rw-r--r-- | src/mm_player_priv.c | 23 |
2 files changed, 21 insertions, 4 deletions
diff --git a/src/include/mm_player_priv.h b/src/include/mm_player_priv.h index 82bfc47..9e79236 100644 --- a/src/include/mm_player_priv.h +++ b/src/include/mm_player_priv.h @@ -366,7 +366,7 @@ typedef enum { typedef enum { MMPLAYER_RESOURCE_TYPE_VIDEO_DECODER, MMPLAYER_RESOURCE_TYPE_VIDEO_OVERLAY, - /* FIXME: need to add MMPLAYER_RESOURCE_TYPE_AUDIO_OFFLOAD */ + MMPLAYER_RESOURCE_TYPE_AUDIO_OFFLOAD, MMPLAYER_RESOURCE_TYPE_MAX, } mmplayer_resource_type_e; diff --git a/src/mm_player_priv.c b/src/mm_player_priv.c index 55da794..42528d6 100644 --- a/src/mm_player_priv.c +++ b/src/mm_player_priv.c @@ -606,6 +606,9 @@ static int __mmplayer_acquire_hw_resource(mmplayer_t *player, mmplayer_resource_ case MMPLAYER_RESOURCE_TYPE_VIDEO_OVERLAY: rm_res_type = MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_OVERLAY; break; + case MMPLAYER_RESOURCE_TYPE_AUDIO_OFFLOAD: + rm_res_type = MM_RESOURCE_MANAGER_RES_TYPE_AUDIO_OFFLOAD; + break; default: LOGE("invalid mmplayer resource type %d", type); return MM_ERROR_PLAYER_INTERNAL; @@ -5145,9 +5148,14 @@ _mmplayer_unrealize(MMHandleType hplayer) ret = __mmplayer_gst_unrealize(player); if (!player->interrupted_by_resource) { - if ((__mmplayer_release_hw_resource(player, MMPLAYER_RESOURCE_TYPE_VIDEO_DECODER) != MM_ERROR_NONE) || - (__mmplayer_release_hw_resource(player, MMPLAYER_RESOURCE_TYPE_VIDEO_OVERLAY) != MM_ERROR_NONE)) - LOGE("failed to release video resources"); + int rm_ret = MM_ERROR_NONE; + mmplayer_resource_type_e res_idx = MMPLAYER_RESOURCE_TYPE_MAX; + + for (res_idx = MMPLAYER_RESOURCE_TYPE_VIDEO_DECODER; res_idx < MMPLAYER_RESOURCE_TYPE_MAX; res_idx++) { + rm_ret = __mmplayer_release_hw_resource(player, res_idx); + if (rm_ret != MM_ERROR_NONE) + LOGE("failed to release [%d] resources", res_idx); + } } MMPLAYER_FLEAVE(); @@ -6963,6 +6971,12 @@ __mmplayer_can_build_audio_offload_path(mmplayer_t *player) } gst_object_unref(factory); + if (__mmplayer_acquire_hw_resource(player, + MMPLAYER_RESOURCE_TYPE_AUDIO_OFFLOAD) != MM_ERROR_NONE) { + LOGE("failed to acquire audio offload decoder resource"); + goto DONE; + } + if (!__mmplayer_add_audio_device_connected_cb(player)) goto DONE; @@ -6973,6 +6987,9 @@ __mmplayer_can_build_audio_offload_path(mmplayer_t *player) ret = TRUE; DONE: + if (!ret) + __mmplayer_release_hw_resource(player, MMPLAYER_RESOURCE_TYPE_AUDIO_OFFLOAD); + MMPLAYER_FLEAVE(); return ret; } |