* 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);
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;