int _load_ini(webrtc_s *webrtc);
void _unload_ini(webrtc_s *webrtc);
ini_item_media_source_s* _ini_get_source_by_type(webrtc_ini_s *ini, int type);
+bool _is_resource_required(webrtc_ini_s *ini);
int _webrtc_stop(webrtc_s *webrtc);
int _gst_init(webrtc_s *webrtc);
_webrtc = g_new0(webrtc_s, 1);
-#ifndef TIZEN_TV
- ret = _create_resource_manager(_webrtc);
- if (ret != WEBRTC_ERROR_NONE) {
- LOG_ERROR("failed to create resource manager");
- g_free(_webrtc);
- return ret;
- }
-#endif
g_mutex_init(&_webrtc->mutex);
g_mutex_lock(&_webrtc->mutex);
g_cond_init(&_webrtc->desc_cond);
_load_ini(_webrtc);
+ if (_is_resource_required(&_webrtc->ini)) {
+#ifndef TIZEN_TV
+ ret = _create_resource_manager(_webrtc);
+ if (ret != WEBRTC_ERROR_NONE) {
+ LOG_ERROR("failed to create resource manager");
+ _unload_ini(_webrtc);
+ g_mutex_unlock(&_webrtc->mutex);
+ g_free(_webrtc);
+ return ret;
+ }
+#else
+ LOG_WARNING("no resource manager integration yet");
+#endif
+ }
_gst_init(_webrtc);
_gst_build_pipeline(_webrtc);
_init_data_channels(_webrtc);
return (ini_item_media_source_s*)g_hash_table_lookup(ini->sources, category_source_names[type]);
}
+bool _is_resource_required(webrtc_ini_s *ini)
+{
+ RET_VAL_IF(ini == NULL, false, "ini is NULL");
+
+ return (ini->resource_acquisition.camera ||
+ ini->resource_acquisition.video_encoder ||
+ ini->resource_acquisition.video_decoder ||
+ ini->resource_acquisition.video_overlay);
+}
+
void _unload_ini(webrtc_s *webrtc)
{
RET_IF(webrtc == NULL, "webrtc is NULL");
int ret = MM_RESOURCE_MANAGER_ERROR_NONE;
RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(webrtc->resource.mgr == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "resource manager 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;
+
if (webrtc->resource.res[type] != NULL) {
LOG_ERROR("type[%d] resource was already acquired", type);
return WEBRTC_ERROR_RESOURCE_FAILED;
int ret = MM_RESOURCE_MANAGER_ERROR_NONE;
RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(webrtc->resource.mgr == NULL, WEBRTC_ERROR_INVALID_PARAMETER,
- "resource manager is NULL");
+
+ if (!webrtc->resource.mgr)
+ return WEBRTC_ERROR_NONE;
if (webrtc->resource.release_cb_is_calling) {
LOG_INFO("__resource_release_cb is calling, so skip");
int ret = MM_RESOURCE_MANAGER_ERROR_NONE;
RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(webrtc->resource.mgr == NULL, WEBRTC_ERROR_INVALID_PARAMETER,
- "resource manager 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) {