Change state constraint on functions for negotiation 80/283580/5
authorSangchul Lee <sc11.lee@samsung.com>
Fri, 28 Oct 2022 05:14:36 +0000 (14:14 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 2 Apr 2024 01:52:02 +0000 (10:52 +0900)
It allows for easing the state constraints for below functions.
 : webrtc_create_offer[_async]()
 : webrtc_create_answer[_async]()
 : webrtc_set_local_description()
 : webrtc_set_remote_description()

[Version] 1.0.0
[Issue Type] Release state constraints

Change-Id: Ia7a7db4a7ac4648e4fd7cb1bf46ff079710b727b
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc.h
packaging/capi-media-webrtc.spec
src/webrtc.c

index 0b32056a0a3debfe2236d20b622e1162e1a1fe59..90a05d54c2b228b213c593e1d1257c668cad190c 100644 (file)
@@ -2385,7 +2385,8 @@ int webrtc_unset_ice_candidate_cb(webrtc_h webrtc);
  * @brief Creates SDP offer to start a new WebRTC connection to a remote peer.
  * @since_tizen 6.5
  * @remarks The @a offer should be released using free().\n
- *          The @a options currently has no effect.
+ *          The @a options currently has no effect.\n
+ *          This function can be called in the state of #WEBRTC_STATE_PLAYING. (Since 9.0)
  * @param[in] webrtc      WebRTC handle
  * @param[in] options     Configuration options for the offer (optional, this can be NULL)
  * @param[out] offer      SDP offer
@@ -2395,7 +2396,7 @@ int webrtc_unset_ice_candidate_cb(webrtc_h webrtc);
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
  * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
- * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING.
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
  * @post @a offer must be set as a local description by calling webrtc_set_local_description()
  * @post @a offer must be sent to the remote peer via the signaling channel.
  * @see webrtc_state_changed_cb()
@@ -2408,7 +2409,8 @@ int webrtc_create_offer(webrtc_h webrtc, bundle *options, char **offer);
  * @brief Creates SDP answer to an offer received from a remote peer during the negotiation of a WebRTC connection.
  * @since_tizen 6.5
  * @remarks The @a answer should be released using free().\n
- *          The @a options currently has no effect.
+ *          The @a options currently has no effect.\n
+ *          This function can be called in the state of #WEBRTC_STATE_PLAYING. (Since 9.0)
  * @param[in] webrtc      WebRTC handle
  * @param[in] options     Configuration options for the answer (optional, this can be NULL)
  * @param[out] answer     SDP answer
@@ -2418,7 +2420,7 @@ int webrtc_create_offer(webrtc_h webrtc, bundle *options, char **offer);
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
  * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
- * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING.
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
  * @pre The remote SDP offer must be set by calling webrtc_set_remote_description().
  * @pre The signaling state must be set to #WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER.
  * @post @a answer must be set as a local description by calling webrtc_set_local_description()
@@ -2434,7 +2436,8 @@ int webrtc_create_answer(webrtc_h webrtc, bundle *options, char **answer);
  * @brief Creates SDP offer asynchronously to start a new WebRTC connection to a remote peer.
  * @since_tizen 6.5
  * @remarks The registered callback will be invoked in the main thread.\n
- *          The @a options currently has no effect.
+ *          The @a options currently has no effect.\n
+ *          This function can be called in the state of #WEBRTC_STATE_PLAYING. (Since 9.0)
  * @param[in] webrtc      WebRTC handle
  * @param[in] options     Configuration options for the offer (optional, this can be NULL)
  * @param[in] callback    Callback function pointer
@@ -2445,7 +2448,7 @@ int webrtc_create_answer(webrtc_h webrtc, bundle *options, char **answer);
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
  * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
- * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING.
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
  * @post webrtc_session_description_created_cb() will be invoked.
  * @see webrtc_state_changed_cb()
  * @see webrtc_negotiation_needed_cb()
@@ -2458,7 +2461,8 @@ int webrtc_create_offer_async(webrtc_h webrtc, bundle *options, webrtc_session_d
  * @brief Creates SDP answer asynchronously to an offer received from a remote peer during the negotiation of a WebRTC connection.
  * @since_tizen 6.5
  * @remarks The registered callback will be invoked in the main thread.\n
- *          The @a options currently has no effect.
+ *          The @a options currently has no effect.\n
+ *          This function can be called in the state of #WEBRTC_STATE_PLAYING. (Since 9.0)
  * @param[in] webrtc      WebRTC handle
  * @param[in] options     Configuration options for the answer (optional, this can be NULL)
  * @param[in] callback    Callback function pointer
@@ -2469,7 +2473,7 @@ int webrtc_create_offer_async(webrtc_h webrtc, bundle *options, webrtc_session_d
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
  * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
- * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING.
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
  * @pre The remote SDP offer must be set by calling webrtc_set_remote_description().
  * @pre The signaling state must be set to #WEBRTC_SIGNALING_STATE_HAVE_REMOTE_OFFER.
  * @post webrtc_session_description_created_cb() will be invoked.
@@ -2485,7 +2489,8 @@ int webrtc_create_answer_async(webrtc_h webrtc, bundle *options, webrtc_session_
  * @brief Sets the session description for a local peer associated with a WebRTC connection.
  * @since_tizen 6.5
  * @remarks @a description is a JSON string.\n
- *          It will be {"sdp":{"type":"offer or answer","sdp":"..."}}.
+ *          It will be {"sdp":{"type":"offer or answer","sdp":"..."}}.\n
+ *          This function can be called in the state of #WEBRTC_STATE_PLAYING. (Since 9.0)
  * @param[in] webrtc      WebRTC handle
  * @param[in] description The local session description
  * @return @c 0 on success,
@@ -2494,7 +2499,7 @@ int webrtc_create_answer_async(webrtc_h webrtc, bundle *options, webrtc_session_
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
  * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
- * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING.
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
  * @see webrtc_create_offer()
  * @see webrtc_create_offer_async()
  * @see webrtc_create_answer()
@@ -2509,6 +2514,7 @@ int webrtc_set_local_description(webrtc_h webrtc, const char *description);
  * @since_tizen 6.5
  * @remarks @a description is a JSON string.\n
  *          It should be {"sdp":{"type":"offer or answer","sdp":"..."}}.
+ *          This function can be called in the state of #WEBRTC_STATE_PLAYING. (Since 9.0)
  * @param[in] webrtc      WebRTC handle
  * @param[in] description The remote session description
  * @return @c 0 on success,
@@ -2517,7 +2523,7 @@ int webrtc_set_local_description(webrtc_h webrtc, const char *description);
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
  * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
- * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING.
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_NEGOTIATING or WEBRTC_STATE_PLAYING.
  * @see webrtc_state_changed_cb()
  * @see webrtc_set_signaling_state_change_cb()
  * @see webrtc_get_signaling_state()
index e991a9d462c327bf3e537a42cadb440ba411021e..494ae155285652ee2710d38d0394f2ee69da78cb 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.4.55
+Version:    1.0.0
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 3031877176f04e3097046055b93f2fa1e2568ffb..ab481e46bf6cda95dea1e821370f41524089d791 100644 (file)
@@ -1642,7 +1642,7 @@ int webrtc_create_offer(webrtc_h webrtc, bundle *options, char **offer)
 
        locker = g_mutex_locker_new(&_webrtc->mutex);
 
-       RET_VAL_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, "the state should be NEGOTIATING");
+       RET_VAL_IF(_webrtc->state == WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should not be IDLE");
 
        LOG_INFO("webrtc[%p] offer[%p]", webrtc, offer);
 
@@ -1662,7 +1662,7 @@ int webrtc_create_answer(webrtc_h webrtc, bundle *options, char **answer)
 
        locker = g_mutex_locker_new(&_webrtc->mutex);
 
-       RET_VAL_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, "the state should be NEGOTIATING");
+       RET_VAL_IF(_webrtc->state == WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should not be IDLE");
        RET_VAL_IF(!_webrtcbin_have_remote_offer(_webrtc), WEBRTC_ERROR_INVALID_STATE, "remote offer should be set");
 
        LOG_INFO("webrtc[%p] answer[%p]", webrtc, answer);
@@ -1682,7 +1682,7 @@ int webrtc_create_offer_async(webrtc_h webrtc, bundle *options, webrtc_session_d
 
        locker = g_mutex_locker_new(&_webrtc->mutex);
 
-       RET_VAL_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, "the state should be NEGOTIATING");
+       RET_VAL_IF(_webrtc->state == WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should not be IDLE");
 
        LOG_INFO("webrtc[%p] options[%p] callback[%p] user_data[%p]", webrtc, options, callback, user_data);
 
@@ -1702,7 +1702,7 @@ int webrtc_create_answer_async(webrtc_h webrtc, bundle *options, webrtc_session_
 
        locker = g_mutex_locker_new(&_webrtc->mutex);
 
-       RET_VAL_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, "the state should be NEGOTIATING");
+       RET_VAL_IF(_webrtc->state == WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should not be IDLE");
        RET_VAL_IF(!_webrtcbin_have_remote_offer(_webrtc), WEBRTC_ERROR_INVALID_STATE, "remote offer should be set");
 
        LOG_INFO("webrtc[%p] options[%p] callback[%p] user_data[%p]", webrtc, options, callback, user_data);
@@ -1722,7 +1722,7 @@ int webrtc_set_local_description(webrtc_h webrtc, const char *description)
 
        locker = g_mutex_locker_new(&_webrtc->mutex);
 
-       RET_VAL_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, "the state should be NEGOTIATING");
+       RET_VAL_IF(_webrtc->state == WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should not be IDLE");
 
        LOG_INFO("webrtc[%p] description: %s", webrtc, description);
 
@@ -1739,7 +1739,7 @@ int webrtc_set_remote_description(webrtc_h webrtc, const char *description)
 
        locker = g_mutex_locker_new(&_webrtc->mutex);
 
-       RET_VAL_IF(_webrtc->state != WEBRTC_STATE_NEGOTIATING, WEBRTC_ERROR_INVALID_STATE, "the state should be NEGOTIATING");
+       RET_VAL_IF(_webrtc->state == WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, "the state should not be IDLE");
 
        LOG_INFO("webrtc[%p] description: %s", webrtc, description);