From: Sangchul Lee Date: Tue, 11 May 2021 08:26:12 +0000 (+0900) Subject: webrtc: Add invalid operation error return value to webrtc_destroy() X-Git-Tag: submit/tizen/20210729.023123~71 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=60a0237b523f5f993f7e8ee809d50ef35f1c132c;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc: Add invalid operation error return value to webrtc_destroy() Gstreamer pipeline state change error or resource release error can occur during destroying webrtc handle. In this case, it will return WEBRTC_ERROR_INVALID_OPERATION error value. [Version] 0.1.170 [Issue Type] Improvement Change-Id: Ia17540054fbba9205820ac533fbbfb936d84f5aa Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc.h b/include/webrtc.h index 5621930c..2b41d852 100644 --- a/include/webrtc.h +++ b/include/webrtc.h @@ -566,6 +566,7 @@ int webrtc_stop(webrtc_h webrtc); * otherwise a negative error value * @retval #WEBRTC_ERROR_NONE Successful * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation * @see webrtc_create() */ int webrtc_destroy(webrtc_h webrtc); diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index ee215fc1..8640ea3c 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.1.169 +Version: 0.1.170 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc.c b/src/webrtc.c index fd192429..e4fed3eb 100644 --- a/src/webrtc.c +++ b/src/webrtc.c @@ -157,17 +157,19 @@ int webrtc_create(webrtc_h *webrtc) int webrtc_destroy(webrtc_h webrtc) { + int ret = WEBRTC_ERROR_NONE; webrtc_s *_webrtc = (webrtc_s*)webrtc; RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); g_mutex_lock(&_webrtc->mutex); - _gst_pipeline_set_state(webrtc, GST_STATE_NULL); + ret = _gst_pipeline_set_state(_webrtc, GST_STATE_NULL); + RET_VAL_WITH_UNLOCK_IF(ret != WEBRTC_ERROR_NONE, ret, &_webrtc->mutex, "failed to _gst_pipeline_set_state()"); #ifdef TIZEN_FEATURE_RES_MGR - if (_destroy_resource_manager(_webrtc) != WEBRTC_ERROR_NONE) - LOG_ERROR("failed to destroy webrtc[%p]", webrtc); + ret = _destroy_resource_manager(_webrtc); + RET_VAL_WITH_UNLOCK_IF(ret != WEBRTC_ERROR_NONE, ret, &_webrtc->mutex, "failed to _destroy_resource_manager()"); #endif _webrtc->pend_state = WEBRTC_STATE_IDLE; _webrtc->state = _webrtc->pend_state;