Enable resource manager commonization 47/314447/26 accepted/tizen/unified/20240815.163706 accepted/tizen/unified/dev/20240819.095531 accepted/tizen/unified/x/20240819.023402
authorYoungHun Kim <yh8004.kim@samsung.com>
Fri, 12 Jul 2024 00:52:37 +0000 (09:52 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Thu, 1 Aug 2024 08:20:15 +0000 (08:20 +0000)
[Version] 1.1.20
[Issue Type] Update

Change-Id: I659b3cc0c87c12c75c39ffaf0a6852e680b56f47

CMakeLists.txt
include/webrtc_private.h
packaging/capi-media-webrtc.spec
src/webrtc.c
src/webrtc_resource.c
src/webrtc_sink.c
src/webrtc_source.c
src/webrtc_source_loopback.c
src/webrtc_source_private.c

index 26710090479bcce2c4191a390a4c98dc89699223..92b7055af3a8820c0fb522a14d800cdeb83ec055 100644 (file)
@@ -14,7 +14,7 @@ SET(dependents "dlog glib-2.0 gstreamer-1.0 gstreamer-webrtc-1.0 gstreamer-video
     gstreamer-allocators-1.0 libpulse json-glib-1.0 iniparser mm-common mm-display-interface capi-media-tool \
     libtbm cynara-client libsmack capi-system-info bundle capi-media-sound-manager mm-fileinfo")
 IF(NOT TIZEN_PROFILE_TV)
-    SET(dependents "${dependents} mm-resource-manager")
+    SET(dependents "${dependents} resource-manager resource-center-api")
     IF(TIZEN_FEATURE_UI)
         SET(dependents "${dependents} capi-system-sensor sensor")
     ENDIF()
index 5b9e4da60a87f2264736f81a9a4d5470345be8a8..f8ad2136ca80e609aef8ed2438087f042607e828 100644 (file)
@@ -27,7 +27,7 @@
 #include <iniparser.h>
 #include <mm_display_interface.h>
 #ifndef TIZEN_TV
-#include <mm_resource_manager.h>
+#include <rm_api.h>
 #endif
 #include <tbm_bufmgr.h>
 #ifdef TIZEN_FEATURE_SIGNALING
@@ -332,13 +332,20 @@ enum {
 };
 
 #ifndef TIZEN_TV
-#define RESOURCE_TYPE_MAX MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_ENCODER + 1
+typedef enum {
+       RES_TYPE_VIDEO_DECODER,     /**< ID of video decoder resource type */
+       RES_TYPE_VIDEO_OVERLAY,     /**< ID of video overlay resource type */
+       RES_TYPE_CAMERA,            /**< ID of camera resource type */
+       RES_TYPE_VIDEO_ENCODER,     /**< ID of video encoder resource type */
+       RES_TYPE_MAX,               /**< Used to iterate on resource types only */
+} res_type_e;
 
 typedef struct _webrtc_resource_s {
-       mm_resource_manager_h mgr;
-       mm_resource_manager_res_h res[RESOURCE_TYPE_MAX];
-       gboolean need_to_acquire[RESOURCE_TYPE_MAX];
-       gboolean release_cb_is_calling;
+       int handle;
+       rm_device_return_s devices[RES_TYPE_MAX];
+       rm_consumer_info rci;
+       gboolean need_to_acquire[RES_TYPE_MAX];
+       GMutex control_lock;
 } webrtc_resource_s;
 #endif
 
@@ -909,9 +916,10 @@ GstStructure* _get_structure_from_data_channel_options(bundle *options);
 #ifndef TIZEN_TV
 /* resource */
 int _acquire_resource_if_needed(webrtc_s *webrtc);
-int _create_resource_manager(webrtc_s *webrtc);
-int _destroy_resource_manager(webrtc_s *webrtc);
-int _acquire_resource_for_type(webrtc_s *webrtc, mm_resource_manager_res_type_e type);
+int _register_resource_manager(webrtc_s *webrtc);
+int _acquire_resource(webrtc_s *webrtc, res_type_e type);
+int _release_resource(webrtc_s *webrtc, res_type_e type);
+int _unregister_resource_manager(webrtc_s *webrtc);
 int _release_all_resources(webrtc_s *webrtc);
 #endif
 
index 9d353e2e0a3cd07b19bd1fcd6b38a59fcbbeabbd..b2b1f077fb901ad1fe3ddbf934d2a134e798ffa9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    1.1.19
+Version:    1.1.20
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -47,7 +47,8 @@ BuildRequires:  pkgconfig(mmutil-magick)
 BuildRequires:  pkgconfig(dns_sd)
 %endif
 %if "%{tizen_profile_name}" != "tv"
-BuildRequires:  pkgconfig(mm-resource-manager)
+BuildRequires:  pkgconfig(resource-manager)
+BuildRequires:  pkgconfig(resource-center-api)
 BuildRequires:  pkgconfig(capi-system-sensor)
 BuildRequires:  pkgconfig(sensor)
 BuildRequires:  pkgconfig(esplusplayer)
index 644ac136c4f1dd905736cd4553a38e413364ffd9..18759216a398b44b31ac68698dbbbf5830d67d65 100644 (file)
@@ -107,7 +107,7 @@ int webrtc_create(webrtc_h *webrtc)
        _load_ini(_webrtc);
        if (_is_resource_required(&_webrtc->ini)) {
 #ifndef TIZEN_TV
-               if ((ret = _create_resource_manager(_webrtc)) != WEBRTC_ERROR_NONE)
+               if ((ret = _register_resource_manager(_webrtc)) != WEBRTC_ERROR_NONE)
                        goto error;
 #else
                LOG_WARNING("no resource manager integration yet");
@@ -176,8 +176,8 @@ int webrtc_destroy(webrtc_h webrtc)
                _unregister_dns_service(_webrtc);
 #endif
 #ifndef TIZEN_TV
-       ret = _destroy_resource_manager(_webrtc);
-       RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _destroy_resource_manager()");
+       ret = _unregister_resource_manager(_webrtc);
+       RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _unregister_resource_manager()");
 #endif
        _webrtc->state = _webrtc->pend_state;
 
index 04f7aefe5fdfa6a6a69383825ce00ad728da4e83..ca2e085976c9c97b76507150fe7ab665ee2010fb 100644 (file)
  */
 #include "webrtc.h"
 #include "webrtc_private.h"
+#include <rm_type.h>
+#include <resource_center.h>
 
-int _acquire_resource_if_needed(webrtc_s *webrtc)
+static int __get_appid_by_pid(int pid, char *name, size_t size)
 {
-       int i;
-       int ret = WEBRTC_ERROR_NONE;
+       g_autofree gchar *cmdline = NULL;
+       g_autofree gchar *contents = NULL;
+       g_autofree gchar *base = NULL;
+       g_autoptr(GError) error = NULL;
 
-       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_VAL_IF(name == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "name is NULL");
+       RET_VAL_IF(size == 0, WEBRTC_ERROR_INVALID_PARAMETER, "size is 0");
+
+       cmdline = g_strdup_printf("/proc/%d/cmdline", pid);
 
-       for (i = 0; i < RESOURCE_TYPE_MAX; i++) {
-               if (!webrtc->resource.need_to_acquire[i])
-                       continue;
-               if ((ret = _acquire_resource_for_type(webrtc, i)) != WEBRTC_ERROR_NONE)
-                       return ret;
-               webrtc->resource.need_to_acquire[i] = false;
+       if (!g_file_get_contents(cmdline, &contents, NULL, &error)) {
+               LOG_ERROR("error : %s", error->message);
+               return WEBRTC_ERROR_INVALID_OPERATION;
        }
 
-       return ret;
+       base = g_path_get_basename(contents);
+
+       if (g_strlcpy(name, base, size) >= size)
+               LOG_ERROR("string truncated");
+
+       return WEBRTC_ERROR_NONE;
+}
+
+static void __execute_resource_release(webrtc_s *webrtc)
+{
+       RET_IF(webrtc == NULL, "webrtc is NULL");
+
+       if (_stop(webrtc) != WEBRTC_ERROR_NONE)
+               LOG_ERROR("stop is failed");
+
+       _post_error_cb_in_idle(webrtc, WEBRTC_ERROR_RESOURCE_CONFLICT);
 }
 
 //LCOV_EXCL_START
-static int __resource_release_cb(mm_resource_manager_h mgr,
-               mm_resource_manager_res_h res, void *user_data)
+static rm_cb_result __rm_callback(int handle, rm_callback_type event_src, rm_device_request_s *info, void *cb_data)
 {
-       int i;
-       int ret = true;
-       webrtc_s *webrtc = (webrtc_s *)user_data;
+       webrtc_s *webrtc = (webrtc_s *)(cb_data);
+       g_autoptr(GMutexLocker) locker = NULL;
 
-       RET_VAL_IF(webrtc == NULL, false, "webrtc is NULL");
+       ASSERT(webrtc);
 
-       webrtc->resource.release_cb_is_calling = true;
+       LOGI("webrtc[%p] rm handle[%d] event_src[%d]", webrtc, handle, event_src);
 
-       for (i = 0; i < RESOURCE_TYPE_MAX; i++) {
-               if (webrtc->resource.res[i] == res) {
-                       LOG_INFO("type[%d] resource was released by resource manager", i);
-                       webrtc->resource.res[i] = NULL;
-               }
+       switch (event_src) {
+       case RM_CALLBACK_TYPE_RESOURCE_CONFLICT:
+       case RM_CALLBACK_TYPE_RESOURCE_CONFLICT_UD:
+               __execute_resource_release(webrtc);
+               break;
+       default:
+               break;
        }
 
-       if (_stop(webrtc) != WEBRTC_ERROR_NONE)
-               ret = false;
+       LOG_DEBUG_LEAVE();
 
-       _post_error_cb_in_idle(webrtc, WEBRTC_ERROR_RESOURCE_CONFLICT);
+       return RM_CB_RESULT_OK;
+}
+//LCOV_EXCL_STOP
+
+//LCOV_EXCL_START
+int _release_all_resources(webrtc_s *webrtc)
+{
+       int idx;
+
+       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
 
-       webrtc->resource.release_cb_is_calling = false;
+       for (idx = 0; idx < RES_TYPE_MAX; idx++) {
+               if (_release_resource(webrtc, idx) != WEBRTC_ERROR_NONE) {
+                       LOG_ERROR("#%d resource deallocate is failed", idx);
+                       return WEBRTC_ERROR_RESOURCE_FAILED;
+               }
+       }
 
-       return ret;
+       return WEBRTC_ERROR_NONE;
 }
 //LCOV_EXCL_STOP
 
-int _create_resource_manager(webrtc_s *webrtc)
+int _acquire_resource_if_needed(webrtc_s *webrtc)
 {
+       int idx;
+
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
 
-       if (mm_resource_manager_create(MM_RESOURCE_MANAGER_APP_CLASS_MEDIA,
-                               __resource_release_cb, webrtc,
-                               &webrtc->resource.mgr) != MM_RESOURCE_MANAGER_ERROR_NONE) {
-//LCOV_EXCL_START
-               LOG_ERROR("failed to init resource manager for media");
-               return WEBRTC_ERROR_RESOURCE_FAILED;
-//LCOV_EXCL_STOP
+       for (idx = 0; idx < RES_TYPE_MAX; idx++) {
+               if (webrtc->resource.need_to_acquire[idx] && _acquire_resource(webrtc, idx) != WEBRTC_ERROR_NONE) {
+                       LOG_ERROR("#%d resource allocate is failed", idx);
+                       return WEBRTC_ERROR_RESOURCE_FAILED;
+               }
        }
 
        return WEBRTC_ERROR_NONE;
 }
 
-int _acquire_resource_for_type(webrtc_s *webrtc, mm_resource_manager_res_type_e type)
+//LCOV_EXCL_START
+int _register_resource_manager(webrtc_s *webrtc)
 {
-       int ret = MM_RESOURCE_MANAGER_ERROR_NONE;
+       int ret;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
-       RET_VAL_IF(type >= RESOURCE_TYPE_MAX, WEBRTC_ERROR_INVALID_PARAMETER, "invalid type(%d)", type);
 
-       if (!webrtc->resource.mgr)
-               return WEBRTC_ERROR_NONE;
+       g_mutex_init(&webrtc->resource.control_lock);
 
-       if (webrtc->resource.res[type] != NULL) {
-//LCOV_EXCL_START
-               LOG_ERROR("type[%d] resource was already acquired", type);
-               return WEBRTC_ERROR_RESOURCE_FAILED;
-//LCOV_EXCL_STOP
+       memset(&webrtc->resource.rci, 0x00, sizeof(rm_consumer_info));
+
+       webrtc->resource.rci.app_pid = (int)getpid();
+
+       if (__get_appid_by_pid(webrtc->resource.rci.app_pid, webrtc->resource.rci.app_id, sizeof(webrtc->resource.rci.app_id)) != WEBRTC_ERROR_NONE) {
+               LOGE("__mmplayer_get_appid_by_pid is failed");
+               return WEBRTC_ERROR_INVALID_OPERATION;
        }
 
-       LOG_DEBUG("mark for acquire type[%d] resource", type);
-       ret = mm_resource_manager_mark_for_acquire(webrtc->resource.mgr, type,
-                               MM_RESOURCE_MANAGER_RES_VOLUME_FULL, &webrtc->resource.res[type]);
-       if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-//LCOV_EXCL_START
-               LOG_ERROR("failed to mark resource for acquire, ret[0x%x]", ret);
+       ret = rm_register((rm_resource_cb)__rm_callback,
+                                               (void *)webrtc,
+                                               &(webrtc->resource.handle),
+                                               (webrtc->resource.rci.app_id[0] != '\0') ? &webrtc->resource.rci : NULL);
+       if (ret != RM_OK) {
+               LOG_ERROR("rm_register fail %d", ret);
                return WEBRTC_ERROR_RESOURCE_FAILED;
+       }
+
+       LOG_INFO("app pid %d app id %s resource h %d", webrtc->resource.rci.app_pid, webrtc->resource.rci.app_id, webrtc->resource.handle);
+
+       return WEBRTC_ERROR_NONE;
+}
 //LCOV_EXCL_STOP
+
+int _acquire_resource(webrtc_s *webrtc, res_type_e type)
+{
+       int ret = RM_OK;
+       int idx = 0;
+       int category_option = 0;
+       rm_rsc_category_e category_id = RM_CATEGORY_NONE;
+       rm_requests_resource_state_e state;
+       rm_category_request_s request_resources;
+       rm_device_return_s *device;
+       g_autoptr(GMutexLocker) locker = NULL;
+
+       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_VAL_IF(type >= RES_TYPE_MAX, WEBRTC_ERROR_INVALID_PARAMETER, "invalid type(%d)", type);
+
+       locker = g_mutex_locker_new(&webrtc->resource.control_lock);
+
+       LOG_INFO("app id : %s type %d", webrtc->resource.rci.app_id, type);
+       memset(&request_resources, 0x0, sizeof(rm_category_request_s));
+
+       device = &webrtc->resource.devices[type];
+       memset(device, 0x0, sizeof(rm_device_return_s));
+
+       switch (type) {
+       case RES_TYPE_VIDEO_DECODER:
+               state = RM_STATE_EXCLUSIVE;
+               category_id = RM_CATEGORY_VIDEO_DECODER;
+               break;
+       case RES_TYPE_VIDEO_OVERLAY:
+               state = RM_STATE_EXCLUSIVE;
+               category_id = RM_CATEGORY_SCALER;
+               break;
+       case RES_TYPE_CAMERA:
+               state = RM_STATE_EXCLUSIVE;
+               category_id = RM_CATEGORY_CAMERA;
+               break;
+       case RES_TYPE_VIDEO_ENCODER:
+               state = RM_STATE_EXCLUSIVE;
+               category_id = RM_CATEGORY_VIDEO_ENCODER;
+               break;
+       default:
+               LOG_ERROR("category id can't set");
+               return WEBRTC_ERROR_RESOURCE_FAILED;
        }
 
-       LOG_DEBUG("commit type[%d] resource", type);
-       ret = mm_resource_manager_commit(webrtc->resource.mgr);
-       if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-//LCOV_EXCL_START
-               LOG_ERROR("failed to commit of resource, ret([0x%x]", ret);
+       category_option = rc_get_capable_category_id(webrtc->resource.handle, webrtc->resource.rci.app_id, category_id);
+
+       request_resources.request_num = 1;
+       request_resources.state[0] = state;
+       request_resources.category_id[0] = category_id;
+       request_resources.category_option[0] = category_option;
+       LOG_INFO("state %d category id 0x%x category option %d", state, category_id, category_option);
+
+       ret = rm_allocate_resources(webrtc->resource.handle, &request_resources, device);
+       if (ret != RM_OK) {
+               LOG_ERROR("Resource allocation request failed ret %d [error type %d]", ret, device->error_type);
                return WEBRTC_ERROR_RESOURCE_FAILED;
-//LCOV_EXCL_STOP
        }
 
+       for (idx = 0; idx < device->allocated_num; idx++)
+               LOG_INFO("#%d / %d [%p] device %d %s %s", idx, device->allocated_num, device,
+                       device->device_id[idx], device->device_node[idx],
+                       device->device_name[idx]);
+
        return WEBRTC_ERROR_NONE;
 }
 
-int _release_all_resources(webrtc_s *webrtc)
+int _release_resource(webrtc_s *webrtc, res_type_e type)
 {
-       int i;
-       int ret = MM_RESOURCE_MANAGER_ERROR_NONE;
+       int rm_ret = RM_OK;
+       int idx = 0;
+       rm_device_request_s requested;
+       rm_device_return_s *devices;
+       g_autoptr(GMutexLocker) locker = NULL;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_VAL_IF(webrtc->resource.handle == 0, WEBRTC_ERROR_RESOURCE_FAILED, "webrtc resource handle is NULL");
 
-       if (!webrtc->resource.mgr)
-               return WEBRTC_ERROR_NONE;
+       locker = g_mutex_locker_new(&webrtc->resource.control_lock);
 
-       if (webrtc->resource.release_cb_is_calling) {
-//LCOV_EXCL_START
-               LOG_INFO("__resource_release_cb is calling, so skip");
-               return WEBRTC_ERROR_NONE;
-//LCOV_EXCL_STOP
-       }
+       devices = &webrtc->resource.devices[type];
 
-       ret = mm_resource_manager_mark_all_for_release(webrtc->resource.mgr);
-       if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-//LCOV_EXCL_START
-               LOG_ERROR("failed to mark all for release, ret[0x%x]", ret);
-               return WEBRTC_ERROR_RESOURCE_FAILED;
-//LCOV_EXCL_STOP
-       }
-       ret = mm_resource_manager_commit(webrtc->resource.mgr);
-       if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
-//LCOV_EXCL_START
-               LOG_ERROR("failed to commit resource, ret[0x%x]", ret);
-               return WEBRTC_ERROR_RESOURCE_FAILED;
-//LCOV_EXCL_STOP
+       LOG_INFO("[%p] #%d (type %d) alloc num %d", devices, idx, type, devices->allocated_num);
+
+       if (devices->allocated_num > 0) {
+               memset(&requested, 0x0, sizeof(rm_device_request_s));
+               requested.request_num = devices->allocated_num;
+               for (idx = 0; idx < requested.request_num; idx++) {
+                       requested.device_id[idx] = devices->device_id[idx];
+                       LOG_INFO("[device id %d] [device name %s]", devices->device_id[idx], devices->device_name[idx]);
+               }
+
+               rm_ret = rm_deallocate_resources(webrtc->resource.handle, &requested);
+               if (rm_ret != RM_OK) {
+                       LOG_ERROR("Resource deallocation request failed [%d] [request num %d]", rm_ret, requested.request_num);
+                       return WEBRTC_ERROR_RESOURCE_FAILED;
+               }
        }
-       LOG_DEBUG("all resources were released by resource manager");
 
-       for (i = 0; i < RESOURCE_TYPE_MAX; i++) {
-               webrtc->resource.need_to_acquire[i] = false;
-               webrtc->resource.res[i] = NULL;
+       for (idx = 0; idx < devices->allocated_num; idx++) {
+               if (devices->device_node[idx]) {
+                       free(devices->device_node[idx]);
+                       devices->device_node[idx] = NULL;
+               }
+
+               if (devices->omx_comp_name[idx]) {
+                       free(devices->omx_comp_name[idx]);
+                       devices->omx_comp_name[idx] = NULL;
+               }
        }
 
        return WEBRTC_ERROR_NONE;
 }
 
-int _destroy_resource_manager(webrtc_s *webrtc)
+int _unregister_resource_manager(webrtc_s *webrtc)
 {
-       int ret = MM_RESOURCE_MANAGER_ERROR_NONE;
+       int ret;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_VAL_IF(webrtc->resource.handle == 0, WEBRTC_ERROR_RESOURCE_FAILED, "webrtc resource handle is NULL");
 
-       if (!webrtc->resource.mgr)
-               return WEBRTC_ERROR_NONE;
-
-       ret = mm_resource_manager_destroy(webrtc->resource.mgr);
-       if (ret != MM_RESOURCE_MANAGER_ERROR_NONE) {
+       ret = rm_unregister(webrtc->resource.handle);
+       if (ret != RM_OK) {
 //LCOV_EXCL_START
-               LOG_ERROR("failed to destroy resource manager, ret[0x%x]", ret);
+               LOGE("rm_unregister fail %d", ret);
                return WEBRTC_ERROR_RESOURCE_FAILED;
 //LCOV_EXCL_STOP
        }
-       webrtc->resource.mgr = NULL;
-       LOG_DEBUG("destroyed resource manager");
+
+       g_mutex_clear(&webrtc->resource.control_lock);
+
+       LOG_INFO("ret [%d]", ret);
 
        return WEBRTC_ERROR_NONE;
 }
index ad2d0c06c90b3faae21b9d539b8a240aaf6e7bc4..74bdaaaf0878240ee26b72b9636f6d60385c76c4 100644 (file)
@@ -182,7 +182,7 @@ static int __build_videosink(webrtc_s *webrtc, GstElement *decodebin, GstPad *sr
                locker = g_mutex_locker_new(&sink->display->mutex);
 #ifndef TIZEN_TV
                if (sink->display->type == WEBRTC_DISPLAY_TYPE_OVERLAY && webrtc->ini.resource_acquisition.video_overlay) {
-                       int ret = _acquire_resource_for_type(webrtc, MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_OVERLAY);
+                       int ret = _acquire_resource(webrtc, RES_TYPE_VIDEO_OVERLAY);
                        if (ret != WEBRTC_ERROR_NONE) {
                                SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref);
                                return ret;
@@ -583,7 +583,7 @@ int _decodebin_autoplug_select_cb(GstElement *decodebin, GstPad *pad, GstCaps *c
 #ifndef TIZEN_TV
                } else {
                        if (webrtc->ini.resource_acquisition.video_decoder) {
-                               if (_acquire_resource_for_type(webrtc, MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_DECODER) != WEBRTC_ERROR_NONE)
+                               if (_acquire_resource(webrtc, RES_TYPE_VIDEO_DECODER) != WEBRTC_ERROR_NONE)
                                        return GST_AUTOPLUG_SELECT_SKIP;
                        }
 #endif
index 059bc22695d63aaf5e521ebd28184a08228c2bdf..27c46f142eb2a79ec2ef718a0109fb04e13a8be3 100644 (file)
@@ -211,7 +211,7 @@ static int __build_camerasrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
 
 #ifndef TIZEN_TV
        if (webrtc->ini.resource_acquisition.camera)
-               webrtc->resource.need_to_acquire[MM_RESOURCE_MANAGER_RES_TYPE_CAMERA] = true;
+               webrtc->resource.need_to_acquire[RES_TYPE_CAMERA] = true;
 #endif
        if (!(camerasrc = _create_element(_get_source_element(webrtc, WEBRTC_MEDIA_SOURCE_TYPE_CAMERA), ELEMENT_NAME_VIDEO_SRC)))
                return WEBRTC_ERROR_INVALID_OPERATION;
index 70999a111f30eb337e1fdbdc95bab9f2506cbfda..83401ee856c346421c705f7580d4d767e2df65d6 100644 (file)
@@ -121,7 +121,7 @@ static int __build_loopback_videosink(webrtc_gst_slot_s *source, GstElement *lin
 #ifndef TIZEN_TV
        if (source->display->type == WEBRTC_DISPLAY_TYPE_OVERLAY && webrtc->ini.resource_acquisition.video_overlay) {
                int ret;
-               if ((ret = _acquire_resource_for_type(webrtc, MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_OVERLAY)) != WEBRTC_ERROR_NONE)
+               if ((ret = _acquire_resource(webrtc, RES_TYPE_VIDEO_OVERLAY)) != WEBRTC_ERROR_NONE)
                        return ret;
        }
 #endif
index 44f119f2874d62d2546e23dd69cca86b61bfa75f..9cdd38a42ef7381016129c04c3a92c562cba1590 100644 (file)
@@ -619,7 +619,7 @@ static GstElement *__get_hw_encoder_element(webrtc_s *webrtc, webrtc_gst_slot_s
        if (encoder) {
 #ifndef TIZEN_TV
                if (webrtc->ini.resource_acquisition.video_encoder)
-                       webrtc->resource.need_to_acquire[MM_RESOURCE_MANAGER_RES_TYPE_VIDEO_ENCODER] = true;
+                       webrtc->resource.need_to_acquire[RES_TYPE_VIDEO_ENCODER] = true;
 #endif
                LOG_WARNING("hw encoder element [%s]", GST_ELEMENT_NAME(encoder));
                return encoder;