webrtc: Add invalid operation error return value to webrtc_destroy() 54/258154/3
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 11 May 2021 08:26:12 +0000 (17:26 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 11 May 2021 11:15:21 +0000 (20:15 +0900)
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 <sc11.lee@samsung.com>
include/webrtc.h
packaging/capi-media-webrtc.spec
src/webrtc.c

index 5621930c2c1f7ac5af94c5912590c8887872cf28..2b41d852fbb6604cfecf28ca795c37ffb664cd27 100644 (file)
@@ -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);
index ee215fc1ac2434486118b1a08bf8d6f770a3e3e5..8640ea3c9a4bfd30f6816b8a045509adf93b223f 100644 (file)
@@ -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
index fd1924293739431ccb3960bfe7642e93be6a0d35..e4fed3ebbb0b414917a327a7209649aefdabe6b8 100644 (file)
@@ -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;