Rename functions belong to CAPI_MEDIA_WEBRTC_MEDIA_SOURCE_MODULE to have consistency 34/259934/5
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 16 Jun 2021 23:58:54 +0000 (08:58 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 18 Jun 2021 05:31:35 +0000 (14:31 +0900)
[Version] 0.2.14
[Issue Type] API

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

index 950e25121b8caa444255fb9f24e468f5475f70f6..e595b901404885ffe91332b293d60f1332704ef1 100644 (file)
@@ -662,8 +662,18 @@ int webrtc_get_state(webrtc_h webrtc, webrtc_state_e *state);
  * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
  * @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
  * @see webrtc_remove_media_source()
- * @see webrtc_set_video_source_resolution()
- * @see webrtc_get_video_source_resolution()
+ * @see webrtc_media_source_set_transceiver_direction()
+ * @see webrtc_media_source_get_transceiver_direction()
+ * @see webrtc_media_source_set_pause()
+ * @see webrtc_media_source_get_pause()
+ * @see webrtc_media_source_set_mute()
+ * @see webrtc_media_source_get_mute()
+ * @see webrtc_media_source_set_video_resolution()
+ * @see webrtc_media_source_get_video_resolution()
+ * @see webrtc_media_packet_source_set_buffer_state_changed_cb()
+ * @see webrtc_media_packet_source_unset_buffer_state_changed_cb()
+ * @see webrtc_media_packet_source_set_format()
+ * @see webrtc_media_packet_source_push_packet()
  */
 int webrtc_add_media_source(webrtc_h webrtc, webrtc_media_source_type_e type, unsigned int *source_id);
 
@@ -684,6 +694,45 @@ int webrtc_add_media_source(webrtc_h webrtc, webrtc_media_source_type_e type, un
  */
 int webrtc_remove_media_source(webrtc_h webrtc, unsigned int source_id);
 
+/**
+ * @brief Sets the transceiver direction to the media source with specified media type.
+ * @since_tizen 6.5
+ * @param[in] webrtc      WebRTC handle
+ * @param[in] source_id   The media source id
+ * @param[in] media_type  The media type
+ * @param[in] direction   The transceiver direction to set
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE    Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
+ * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
+ * @pre webrtc_media_packet_source_set_format() must be called if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
+ * @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
+ * @see webrtc_media_source_get_transceiver_direction()
+ */
+int webrtc_media_source_set_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction);
+
+/**
+ * @brief Gets the transceiver direction of the media source with specified media type.
+ * @since_tizen 6.5
+ * @remarks The default value is #WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV.
+ * @param[in] webrtc      WebRTC handle
+ * @param[in] source_id   The media source id
+ * @param[in] media_type  The media type
+ * @param[out] direction  Current transceiver direction
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #WEBRTC_ERROR_NONE    Successful
+ * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
+ * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
+ * @pre webrtc_media_packet_source_set_format() must be called if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
+ * @see webrtc_media_source_set_transceiver_direction()
+ */
+int webrtc_media_source_get_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction);
+
 /**
  * @brief Sets pause to the media source.
  * @since_tizen 6.5
@@ -696,10 +745,9 @@ int webrtc_remove_media_source(webrtc_h webrtc, unsigned int source_id);
  * @retval #WEBRTC_ERROR_NONE    Successful
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @see webrtc_add_media_source()
- * @see webrtc_get_media_source_pause()
+ * @see webrtc_media_source_get_pause()
  */
-int webrtc_set_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause);
+int webrtc_media_source_set_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause);
 
 /**
  * @brief Gets the pause of the media source.
@@ -714,31 +762,30 @@ int webrtc_set_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrt
  * @retval #WEBRTC_ERROR_NONE    Successful
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @see webrtc_add_media_source()
- * @see webrtc_set_media_source_pause()
+ * @see webrtc_media_source_set_pause()
  */
-int webrtc_get_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused);
+int webrtc_media_source_get_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused);
 
  /**
- * @brief Sets the media source's mute status.
+ * @brief Sets mute to the media source.
  * @details If @a mute is set to @c true, black frame or silent sound will be transmitted to the remote peer according to the media type of the @a source_id. \n
  *          if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, this function will return #WEBRTC_ERROR_INVALID_PARAMETER.
  * @since_tizen 6.5
  * @param[in] webrtc      WebRTC handle
  * @param[in] source_id   The media source id
  * @param[in] media_type  The media type
- * @param[in] muted       The new mute status (@c true = mute, @c false = not muted)
+ * @param[in] muted       Muted or not (@c true = muted, @c false = not muted)
  * @return @c 0 on success,
  *         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_get_media_source_muted()
+ * @see webrtc_media_source_get_mute()
  */
-int webrtc_set_media_source_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute);
+int webrtc_media_source_set_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute);
 
  /**
- * @brief Gets the media source's mute status.
+ * @brief Gets the mute of the media source.
  * @details if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET, this function will return #WEBRTC_ERROR_INVALID_PARAMETER.
  * @since_tizen 6.5
  * @remarks The default value is @c false.
@@ -751,13 +798,13 @@ int webrtc_set_media_source_mute(webrtc_h webrtc, unsigned int source_id, webrtc
  * @retval #WEBRTC_ERROR_NONE    Successful
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @see webrtc_set_media_source_mute()
+ * @see webrtc_media_source_set_mute()
  */
-int webrtc_get_media_source_muted(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted);
+int webrtc_media_source_get_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted);
 
 /**
- * @brief Sets a video source resolution.
- * @details The following media source types are for the video source:\n
+ * @brief Sets a video resolution to the media source.
+ * @details The following media source types are for the video:\n
  *          #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA\n
  *          #WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST\n
  *          #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN
@@ -774,14 +821,13 @@ int webrtc_get_media_source_muted(webrtc_h webrtc, unsigned int source_id, webrt
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
  * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
- * @see webrtc_add_media_source()
- * @see webrtc_get_video_source_resolution()
+ * @see webrtc_media_source_get_video_resolution()
  */
-int webrtc_set_video_source_resolution(webrtc_h webrtc, unsigned int source_id, int width, int height);
+int webrtc_media_source_set_video_resolution(webrtc_h webrtc, unsigned int source_id, int width, int height);
 
 /**
- * @brief Gets the video source resolution.
- * @details The following media source types are for the video source:\n
+ * @brief Gets the video resolution of the media source.
+ * @details The following media source types are for the video:\n
  *          #WEBRTC_MEDIA_SOURCE_TYPE_CAMERA\n
  *          #WEBRTC_MEDIA_SOURCE_TYPE_VIDEOTEST\n
  *          #WEBRTC_MEDIA_SOURCE_TYPE_SCREEN
@@ -796,10 +842,9 @@ int webrtc_set_video_source_resolution(webrtc_h webrtc, unsigned int source_id,
  * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
  * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
- * @see webrtc_add_media_source()
- * @see webrtc_set_video_source_resolution()
+ * @see webrtc_media_source_set_video_resolution()
  */
-int webrtc_get_video_source_resolution(webrtc_h webrtc, unsigned int source_id, int *width, int *height);
+int webrtc_media_source_get_video_resolution(webrtc_h webrtc, unsigned int source_id, int *width, int *height);
 
 /**
  * @brief Sets a callback function to be invoked when the buffer state of media packet source is changed.
@@ -874,45 +919,6 @@ int webrtc_media_packet_source_set_format(webrtc_h webrtc, unsigned int source_i
  */
 int webrtc_media_packet_source_push_packet(webrtc_h webrtc, unsigned int source_id, media_packet_h packet);
 
-/**
- * @brief Gets the transceiver direction of the media source with specified media type.
- * @since_tizen 6.5
- * @remarks The default value is #WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV.
- * @param[in] webrtc      WebRTC handle
- * @param[in] source_id   The media source id
- * @param[in] media_type  The media type
- * @param[out] direction  Current transceiver direction
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #WEBRTC_ERROR_NONE    Successful
- * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
- * @pre webrtc_media_packet_source_set_format() must be called if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
- * @see webrtc_set_transceiver_direction()
- */
-int webrtc_get_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction);
-
-/**
- * @brief Sets the transceiver direction to the media source with specified media type.
- * @since_tizen 6.5
- * @param[in] webrtc      WebRTC handle
- * @param[in] source_id   The media source id
- * @param[in] media_type  The media type
- * @param[in] direction   The transceiver direction to set
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #WEBRTC_ERROR_NONE    Successful
- * @retval #WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #WEBRTC_ERROR_INVALID_OPERATION Invalid operation
- * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
- * @pre Add media source to @a webrtc to get @a source_id by calling webrtc_add_media_source().
- * @pre webrtc_media_packet_source_set_format() must be called if @a source_id is a media source of #WEBRTC_MEDIA_SOURCE_TYPE_MEDIA_PACKET.
- * @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
- * @see webrtc_get_transceiver_direction()
- */
-int webrtc_set_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction);
-
 /**
  * @}
  */
index 2f9a72ca51cccc4338b163f2b3ccc0997e5ce73f..bb7322bca7a7ab71127bd779a1873112b4ade841 100644 (file)
@@ -502,19 +502,19 @@ void _gst_destroy_pipeline(webrtc_s *webrtc);
 int _gst_pipeline_set_state(webrtc_s *webrtc, GstState state);
 int _add_media_source(webrtc_s *webrtc, webrtc_media_source_type_e type, unsigned int *source_id);
 int _remove_media_source(webrtc_s *webrtc, unsigned int source_id);
-int _set_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause);
-int _get_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused);
-int _set_audio_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute);
-int _get_audio_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *muted);
-int _set_video_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute);
-int _get_video_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *muted);
-int _set_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int width, int height);
-int _get_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height);
+int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction);
+int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction);
+int _set_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause);
+int _get_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused);
+int _set_audio_mute(webrtc_s *webrtc, unsigned int source_id, bool mute);
+int _get_audio_mute(webrtc_s *webrtc, unsigned int source_id, bool *muted);
+int _set_video_mute(webrtc_s *webrtc, unsigned int source_id, bool mute);
+int _get_video_mute(webrtc_s *webrtc, unsigned int source_id, bool *muted);
+int _set_video_resolution(webrtc_s *webrtc, unsigned int source_id, int width, int height);
+int _get_video_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height);
 int _set_media_format(webrtc_s *webrtc, unsigned int source_id, media_format_h format);
 bool _check_if_format_is_set_to_packet_sources(webrtc_s *webrtc);
 int _push_media_packet(webrtc_s *webrtc, unsigned int source_id, media_packet_h packet);
-int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction);
-int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction);
 void _invoke_state_changed_cb(webrtc_s *webrtc, webrtc_state_e old, webrtc_state_e new);
 void _post_state_cb_in_idle(webrtc_s *webrtc, webrtc_state_e new_state);
 void _post_error_cb_in_idle(webrtc_s *webrtc, webrtc_error_e error);
index bb55548db0a15343d74394c1bce375ed3636c25a..7749329ed5f68a8f49c70ad8646b23e4e851090c 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.2.13
+Version:    0.2.14
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index c482ca95c5e32b967379b9e8f4458646a5777c46..4d9c776ad3b301a3f753f39c4889c908507c3b5e 100644 (file)
@@ -301,7 +301,7 @@ int webrtc_remove_media_source(webrtc_h webrtc, unsigned int source_id)
        return ret;
 }
 
-int webrtc_set_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause)
+int webrtc_media_source_set_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = (webrtc_s*)webrtc;
@@ -310,14 +310,53 @@ int webrtc_set_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrt
 
        g_mutex_lock(&_webrtc->mutex);
 
-       ret = _set_media_source_pause(webrtc, source_id, media_type, pause);
+       RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE");
+
+       ret = _set_transceiver_direction(webrtc, source_id, media_type, direction);
+       if (ret == WEBRTC_ERROR_NONE)
+               LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, direction);
+
+       g_mutex_unlock(&_webrtc->mutex);
+
+       return ret;
+}
+
+int webrtc_media_source_get_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction)
+{
+       int ret = WEBRTC_ERROR_NONE;
+       webrtc_s *_webrtc = (webrtc_s*)webrtc;
+
+       RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
+
+       g_mutex_lock(&_webrtc->mutex);
+
+       ret = _get_transceiver_direction(webrtc, source_id, media_type, direction);
+       if (ret == WEBRTC_ERROR_NONE)
+               LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, *direction);
+
+       g_mutex_unlock(&_webrtc->mutex);
+
+       return ret;
+}
+
+int webrtc_media_source_set_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause)
+{
+       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);
+
+       ret = _set_pause(webrtc, source_id, media_type, pause);
 
        g_mutex_unlock(&_webrtc->mutex);
 
        return ret;
 }
 
-int webrtc_get_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused)
+int webrtc_media_source_get_pause(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = (webrtc_s*)webrtc;
@@ -327,14 +366,14 @@ int webrtc_get_media_source_pause(webrtc_h webrtc, unsigned int source_id, webrt
 
        g_mutex_lock(&_webrtc->mutex);
 
-       ret = _get_media_source_pause(webrtc, source_id, media_type, paused);
+       ret = _get_pause(webrtc, source_id, media_type, paused);
 
        g_mutex_unlock(&_webrtc->mutex);
 
        return ret;
 }
 
-int webrtc_set_media_source_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute)
+int webrtc_media_source_set_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool mute)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = (webrtc_s*)webrtc;
@@ -345,11 +384,11 @@ int webrtc_set_media_source_mute(webrtc_h webrtc, unsigned int source_id, webrtc
 
        switch (media_type) {
        case WEBRTC_MEDIA_TYPE_AUDIO:
-               ret = _set_audio_source_mute(_webrtc, source_id, mute);
+               ret = _set_audio_mute(_webrtc, source_id, mute);
                break;
 
        case WEBRTC_MEDIA_TYPE_VIDEO:
-               ret = _set_video_source_mute(_webrtc, source_id, mute);
+               ret = _set_video_mute(_webrtc, source_id, mute);
                break;
 
        default :
@@ -366,7 +405,7 @@ int webrtc_set_media_source_mute(webrtc_h webrtc, unsigned int source_id, webrtc
        return ret;
 }
 
-int webrtc_get_media_source_muted(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted)
+int webrtc_media_source_get_mute(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *muted)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = (webrtc_s*)webrtc;
@@ -377,11 +416,11 @@ int webrtc_get_media_source_muted(webrtc_h webrtc, unsigned int source_id, webrt
 
        switch (media_type) {
        case WEBRTC_MEDIA_TYPE_AUDIO:
-               ret = _get_audio_source_muted(_webrtc, source_id, muted);
+               ret = _get_audio_mute(_webrtc, source_id, muted);
                break;
 
        case WEBRTC_MEDIA_TYPE_VIDEO:
-               ret = _get_video_source_muted(_webrtc, source_id, muted);
+               ret = _get_video_mute(_webrtc, source_id, muted);
                break;
 
        default :
@@ -398,7 +437,7 @@ int webrtc_get_media_source_muted(webrtc_h webrtc, unsigned int source_id, webrt
        return ret;
 }
 
-int webrtc_set_video_source_resolution(webrtc_h webrtc, unsigned int source_id, int width, int height)
+int webrtc_media_source_set_video_resolution(webrtc_h webrtc, unsigned int source_id, int width, int height)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = (webrtc_s*)webrtc;
@@ -409,14 +448,14 @@ int webrtc_set_video_source_resolution(webrtc_h webrtc, unsigned int source_id,
 
        g_mutex_lock(&_webrtc->mutex);
 
-       ret = _set_video_source_resolution(webrtc, source_id, width, height);
+       ret = _set_video_resolution(webrtc, source_id, width, height);
 
        g_mutex_unlock(&_webrtc->mutex);
 
        return ret;
 }
 
-int webrtc_get_video_source_resolution(webrtc_h webrtc, unsigned int source_id, int *width, int *height)
+int webrtc_media_source_get_video_resolution(webrtc_h webrtc, unsigned int source_id, int *width, int *height)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = (webrtc_s*)webrtc;
@@ -427,7 +466,7 @@ int webrtc_get_video_source_resolution(webrtc_h webrtc, unsigned int source_id,
 
        g_mutex_lock(&_webrtc->mutex);
 
-       ret = _get_video_source_resolution(webrtc, source_id, width, height);
+       ret = _get_video_resolution(webrtc, source_id, width, height);
 
        g_mutex_unlock(&_webrtc->mutex);
 
@@ -530,45 +569,6 @@ int webrtc_media_packet_source_push_packet(webrtc_h webrtc, unsigned int source_
        return ret;
 }
 
-int webrtc_get_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction)
-{
-       int ret = WEBRTC_ERROR_NONE;
-       webrtc_s *_webrtc = (webrtc_s*)webrtc;
-
-       RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
-       RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
-
-       g_mutex_lock(&_webrtc->mutex);
-
-       ret = _get_transceiver_direction(webrtc, source_id, media_type, direction);
-       if (ret == WEBRTC_ERROR_NONE)
-               LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, *direction);
-
-       g_mutex_unlock(&_webrtc->mutex);
-
-       return ret;
-}
-
-int webrtc_set_transceiver_direction(webrtc_h webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
-{
-       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);
-
-       RET_VAL_WITH_UNLOCK_IF(_webrtc->state != WEBRTC_STATE_IDLE, WEBRTC_ERROR_INVALID_STATE, &_webrtc->mutex, "the state should be IDLE");
-
-       ret = _set_transceiver_direction(webrtc, source_id, media_type, direction);
-       if (ret == WEBRTC_ERROR_NONE)
-               LOG_INFO("source_id[%u] media_type[%d] direction[%d]", source_id, media_type, direction);
-
-       g_mutex_unlock(&_webrtc->mutex);
-
-       return ret;
-}
-
 int webrtc_set_display(webrtc_h webrtc, unsigned int track_id, webrtc_display_type_e type, webrtc_display_h display)
 {
        int ret = WEBRTC_ERROR_NONE;
index a3f9cc2f3de038834c3c87d768e6b294b2c47231..f6910eef79a79e3ef8a26e6763c7b33603bb0266 100644 (file)
@@ -26,11 +26,6 @@ static const char* __state_str[] = {
        [WEBRTC_STATE_PLAYING] = "PLAYING",
 };
 
-typedef struct {
-       const char *str;
-       GstWebRTCRTPTransceiverDirection gst;
-} direction_info_s;
-
 typedef struct {
        const char *str;
        webrtc_peer_connection_state_e state;
@@ -51,12 +46,6 @@ typedef struct {
        webrtc_ice_connection_state_e state;
 } ice_connection_state_info_s;
 
-static direction_info_s __direction_info[] = {
-       [WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY] = { "SENDONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY },
-       [WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY] = { "RECVONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY },
-       [WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV] = { "SENDRECV", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV }
-};
-
 static peer_connection_state_info_s __peer_connection_state_info[] = {
        [GST_WEBRTC_PEER_CONNECTION_STATE_NEW] = { "NEW", WEBRTC_PEER_CONNECTION_STATE_NEW },
        [GST_WEBRTC_PEER_CONNECTION_STATE_CONNECTING] = { "CONNECTING", WEBRTC_PEER_CONNECTION_STATE_CONNECTING },
@@ -1179,118 +1168,6 @@ webrtc_gst_slot_s* _get_slot_by_id(GHashTable *slots, unsigned int id)
        return slot;
 }
 
-static int __convert_direction(GstWebRTCRTPTransceiverDirection gst_direction, webrtc_transceiver_direction_e *direction)
-{
-       RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
-
-       if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE ||
-               gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE) {
-               LOG_ERROR("not expected gst direction[%d]", gst_direction);
-               return WEBRTC_ERROR_INVALID_OPERATION;
-       }
-
-       if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY)
-               *direction = WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY;
-       else if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY)
-               *direction = WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY;
-       else
-               *direction = WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV;
-
-       return WEBRTC_ERROR_NONE;
-}
-
-int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction)
-{
-       int ret = WEBRTC_ERROR_INVALID_OPERATION;
-       webrtc_gst_slot_s *source;
-       GstWebRTCRTPTransceiver *trans;
-       GArray *transceivers;
-       int mline;
-       int i;
-
-       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
-       RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
-       RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL");
-       RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL");
-       RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
-
-       if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
-               mline = source->av[AV_IDX_AUDIO].mline;
-
-       } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
-               mline = source->av[AV_IDX_VIDEO].mline;
-
-       } else {
-               LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
-               return WEBRTC_ERROR_INVALID_PARAMETER;
-       }
-
-       g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
-       for (i = 0; i < transceivers->len; i++) {
-               trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
-               if (trans->mline == mline) {
-                       ret = __convert_direction(trans->direction, direction);
-                       if (ret == WEBRTC_ERROR_NONE)
-                               LOG_DEBUG("found transceiver[%p, index:%d, mline:%u, mid:%s, direction:%s]",
-                                       trans, i, trans->mline, trans->mid, __direction_info[*direction].str);
-                       goto end;
-               }
-       }
-
-       LOG_ERROR("could not find a transceiver with mline[%d]", mline);
-
-end:
-       g_array_unref(transceivers);
-
-       return ret;
-}
-
-int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
-{
-       int ret = WEBRTC_ERROR_INVALID_OPERATION;
-       webrtc_gst_slot_s *source;
-       GstWebRTCRTPTransceiver *trans;
-       GArray *transceivers;
-       int mline;
-       int i;
-
-       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
-       RET_VAL_IF(direction > WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV, WEBRTC_ERROR_INVALID_PARAMETER, "invalid direction");
-       RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL");
-       RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL");
-       RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
-
-       if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
-               mline = source->av[AV_IDX_AUDIO].mline;
-
-       } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
-               mline = source->av[AV_IDX_VIDEO].mline;
-
-       } else {
-               LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
-               return WEBRTC_ERROR_INVALID_PARAMETER;
-       }
-
-       g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
-       for (i = 0; i < transceivers->len; i++) {
-               trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
-               if (trans->mline == mline) {
-                       trans->direction = __direction_info[direction].gst;
-                       LOG_DEBUG("Set direction to transceiver[%p, index:%d, mline:%u, direction:%s]",
-                               trans, i, trans->mline, __direction_info[direction].str);
-                       ret = WEBRTC_ERROR_NONE;
-                       goto end;
-               }
-       }
-
-       LOG_ERROR("could not find a transceiver with mline[%d]", mline);
-
-end:
-       g_array_unref(transceivers);
-
-       return ret;
-}
-
 static void __update_session_description(GstPromise *promise, bool is_offer, gpointer user_data)
 {
        GstWebRTCSessionDescription *desc = NULL;
index cbe3f6ce47c761b9c09fc35ad21d1a633f2ee7c5..1e7cb7aa57141ee70f3fd900cd49f0490d26972e 100644 (file)
@@ -90,6 +90,17 @@ typedef struct {
        webrtc_gst_slot_s *source;
 } probe_userdata_s;
 
+typedef struct {
+       const char *str;
+       GstWebRTCRTPTransceiverDirection gst;
+} direction_info_s;
+
+static direction_info_s __direction_info[] = {
+       [WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY] = { "SENDONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY },
+       [WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY] = { "RECVONLY", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY },
+       [WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV] = { "SENDRECV", GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV }
+};
+
 static payload_type_s payload_types[] = {
        /* AUDIO */
        [CODEC_TYPE_OPUS] = { "OPUS", 48000 },
@@ -1685,7 +1696,119 @@ int _remove_media_source(webrtc_s *webrtc, unsigned int source_id)
        return ret;
 }
 
-int _set_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause)
+static int __convert_direction(GstWebRTCRTPTransceiverDirection gst_direction, webrtc_transceiver_direction_e *direction)
+{
+       RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
+
+       if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE ||
+               gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE) {
+               LOG_ERROR("not expected gst direction[%d]", gst_direction);
+               return WEBRTC_ERROR_INVALID_OPERATION;
+       }
+
+       if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY)
+               *direction = WEBRTC_TRANSCEIVER_DIRECTION_SENDONLY;
+       else if (gst_direction == GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY)
+               *direction = WEBRTC_TRANSCEIVER_DIRECTION_RECVONLY;
+       else
+               *direction = WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV;
+
+       return WEBRTC_ERROR_NONE;
+}
+
+int _set_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
+{
+       int ret = WEBRTC_ERROR_INVALID_OPERATION;
+       webrtc_gst_slot_s *source;
+       GstWebRTCRTPTransceiver *trans;
+       GArray *transceivers;
+       int mline;
+       int i;
+
+       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_VAL_IF(direction > WEBRTC_TRANSCEIVER_DIRECTION_SENDRECV, WEBRTC_ERROR_INVALID_PARAMETER, "invalid direction");
+       RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL");
+       RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL");
+       RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
+
+       if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
+               mline = source->av[AV_IDX_AUDIO].mline;
+
+       } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
+               mline = source->av[AV_IDX_VIDEO].mline;
+
+       } else {
+               LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
+               return WEBRTC_ERROR_INVALID_PARAMETER;
+       }
+
+       g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
+       for (i = 0; i < transceivers->len; i++) {
+               trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
+               if (trans->mline == mline) {
+                       trans->direction = __direction_info[direction].gst;
+                       LOG_DEBUG("Set direction to transceiver[%p, index:%d, mline:%u, direction:%s]",
+                               trans, i, trans->mline, __direction_info[direction].str);
+                       ret = WEBRTC_ERROR_NONE;
+                       goto end;
+               }
+       }
+
+       LOG_ERROR("could not find a transceiver with mline[%d]", mline);
+
+end:
+       g_array_unref(transceivers);
+
+       return ret;
+}
+
+int _get_transceiver_direction(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e *direction)
+{
+       int ret = WEBRTC_ERROR_INVALID_OPERATION;
+       webrtc_gst_slot_s *source;
+       GstWebRTCRTPTransceiver *trans;
+       GArray *transceivers;
+       int mline;
+       int i;
+
+       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_VAL_IF(direction == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "direction is NULL");
+       RET_VAL_IF(webrtc->gst.webrtcbin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtcbin is NULL");
+       RET_VAL_IF(webrtc->gst.source_slots == NULL, WEBRTC_ERROR_INVALID_OPERATION, "source_slots is NULL");
+       RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
+
+       if (media_type == WEBRTC_MEDIA_TYPE_AUDIO && source->media_types & MEDIA_TYPE_AUDIO) {
+               mline = source->av[AV_IDX_AUDIO].mline;
+
+       } else if (media_type == WEBRTC_MEDIA_TYPE_VIDEO && source->media_types & MEDIA_TYPE_VIDEO) {
+               mline = source->av[AV_IDX_VIDEO].mline;
+
+       } else {
+               LOG_ERROR("invalid media_type[%d] for source[media_types:0x%x, id:%u]", media_type, source->media_types, source_id);
+               return WEBRTC_ERROR_INVALID_PARAMETER;
+       }
+
+       g_signal_emit_by_name(webrtc->gst.webrtcbin, "get-transceivers", &transceivers);
+       for (i = 0; i < transceivers->len; i++) {
+               trans = g_array_index(transceivers, GstWebRTCRTPTransceiver *, i);
+               if (trans->mline == mline) {
+                       ret = __convert_direction(trans->direction, direction);
+                       if (ret == WEBRTC_ERROR_NONE)
+                               LOG_DEBUG("found transceiver[%p, index:%d, mline:%u, mid:%s, direction:%s]",
+                                       trans, i, trans->mline, trans->mid, __direction_info[*direction].str);
+                       goto end;
+               }
+       }
+
+       LOG_ERROR("could not find a transceiver with mline[%d]", mline);
+
+end:
+       g_array_unref(transceivers);
+
+       return ret;
+}
+
+int _set_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool pause)
 {
        webrtc_gst_slot_s *source;
        bool prev;
@@ -1718,7 +1841,7 @@ int _set_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_med
        return WEBRTC_ERROR_NONE;
 }
 
-int _get_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused)
+int _get_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_media_type_e media_type, bool *paused)
 {
        webrtc_gst_slot_s *source;
 
@@ -1748,7 +1871,7 @@ int _get_media_source_pause(webrtc_s *webrtc, unsigned int source_id, webrtc_med
        return WEBRTC_ERROR_NONE;
 }
 
-int _set_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int width, int height)
+int _set_video_resolution(webrtc_s *webrtc, unsigned int source_id, int width, int height)
 {
        webrtc_gst_slot_s *source;
        GstElement *capsfilter;
@@ -1782,7 +1905,7 @@ int _set_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int w
        return WEBRTC_ERROR_NONE;
 }
 
-int _get_video_source_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height)
+int _get_video_resolution(webrtc_s *webrtc, unsigned int source_id, int *width, int *height)
 {
        webrtc_gst_slot_s *source;
 
@@ -2289,7 +2412,7 @@ static int __mute_videotestsrc(webrtc_gst_slot_s *source, bool mute)
        return WEBRTC_ERROR_NONE;
 }
 
-int _set_video_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
+int _set_video_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_gst_slot_s *source = NULL;
@@ -2329,7 +2452,7 @@ int _set_video_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
        return ret;
 }
 
-int _set_audio_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
+int _set_audio_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
 {
        webrtc_gst_slot_s *source = NULL;
        GstElement *volume = NULL;
@@ -2367,7 +2490,7 @@ int _set_audio_source_mute(webrtc_s *webrtc, unsigned int source_id, bool mute)
        return WEBRTC_ERROR_NONE;
 }
 
-int _get_video_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *muted)
+int _get_video_mute(webrtc_s *webrtc, unsigned int source_id, bool *muted)
 {
        webrtc_gst_slot_s *source = NULL;
 
@@ -2397,7 +2520,7 @@ int _get_video_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *mute
        return WEBRTC_ERROR_NONE;
 }
 
-int _get_audio_source_muted(webrtc_s *webrtc, unsigned int source_id, bool *muted)
+int _get_audio_mute(webrtc_s *webrtc, unsigned int source_id, bool *muted)
 {
        webrtc_gst_slot_s *source = NULL;
        GstElement *volume = NULL;
index 1cf89f2fe713e9185a05b76443a8478e2642a83d..f7a287bfd20106a3765e352458b6a01acd755416 100644 (file)
@@ -54,15 +54,15 @@ enum {
        CURRENT_STATUS_MAINMENU,
        CURRENT_STATUS_ADD_MEDIA_SOURCE,
        CURRENT_STATUS_REMOVE_MEDIA_SOURCE,
-       CURRENT_STATUS_SET_MEDIA_SOURCE_PAUSE,
-       CURRENT_STATUS_GET_MEDIA_SOURCE_PAUSE,
-       CURRENT_STATUS_SET_VIDEO_SOURCE_RESOLUTION,
-       CURRENT_STATUS_GET_VIDEO_SOURCE_RESOLUTION,
+       CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION,
+       CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION,
+       CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE,
+       CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE,
+       CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION,
+       CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION,
        CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_BUFFER_STATE_CHANGED_CB,
        CURRENT_STATUS_MEDIA_PACKET_SOURCE_UNSET_BUFFER_STATE_CHANGED_CB,
        CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_FORMAT,
-       CURRENT_STATUS_GET_TRANSCEIVER_DIRECTION,
-       CURRENT_STATUS_SET_TRANSCEIVER_DIRECTION,
        CURRENT_STATUS_SET_DISPLAY_TYPE,
        CURRENT_STATUS_DATA_CHANNEL_SEND_STRING,
        CURRENT_STATUS_DATA_CHANNEL_SEND_STRING_AS_BYTES,
@@ -544,53 +544,53 @@ static void _webrtc_remove_media_source(int index, unsigned int source_id)
        }
 }
 
-static void _webrtc_set_media_source_pause(int index, unsigned int source_id, unsigned int media_type, int is_pause)
+static void _webrtc_media_source_set_pause(int index, unsigned int source_id, unsigned int media_type, int is_pause)
 {
        int ret = WEBRTC_ERROR_NONE;
 
-       ret = webrtc_set_media_source_pause(g_conns[index].webrtc, source_id, media_type, is_pause > 0 ? true : false);
+       ret = webrtc_media_source_set_pause(g_conns[index].webrtc, source_id, media_type, is_pause > 0 ? true : false);
        if (ret != WEBRTC_ERROR_NONE)
-               g_print("failed to webrtc_set_media_source_pause(), source_id[%u], media_type[%u], is_pause[%d], ret[0x%x]\n",
+               g_print("failed to webrtc_media_source_set_pause(), source_id[%u], media_type[%u], is_pause[%d], ret[0x%x]\n",
                        source_id, media_type, is_pause, ret);
        else
-               g_print("webrtc_set_media_source_pause() success, source_id[%u], media_type[%u], is_pause[%d]\n",
+               g_print("webrtc_media_source_set_pause() success, source_id[%u], media_type[%u], is_pause[%d]\n",
                        source_id, media_type, is_pause);
 }
 
-static void _webrtc_get_media_source_pause(int index, unsigned int source_id, unsigned int media_type)
+static void _webrtc_media_source_get_pause(int index, unsigned int source_id, unsigned int media_type)
 {
        int ret = WEBRTC_ERROR_NONE;
        bool paused = false;
 
-       ret = webrtc_get_media_source_pause(g_conns[index].webrtc, source_id, media_type, &paused);
+       ret = webrtc_media_source_get_pause(g_conns[index].webrtc, source_id, media_type, &paused);
        if (ret != WEBRTC_ERROR_NONE)
-               g_print("failed to webrtc_get_media_source_pause(), source_id[%u], media_type[%u], ret[0x%x]\n", source_id, media_type, ret);
+               g_print("failed to webrtc_media_source_get_pause(), source_id[%u], media_type[%u], ret[0x%x]\n", source_id, media_type, ret);
        else
-               g_print("webrtc_get_media_source_pause() success, source_id[%u], media_type[%u], paused[%d]\n", source_id, media_type, paused);
+               g_print("webrtc_media_source_get_pause() success, source_id[%u], media_type[%u], paused[%d]\n", source_id, media_type, paused);
 }
 
-static void _webrtc_set_video_source_resolution(int index, unsigned int source_id, int width, int height)
+static void _webrtc_media_source_set_video_resolution(int index, unsigned int source_id, int width, int height)
 {
        int ret = WEBRTC_ERROR_NONE;
 
-       ret = webrtc_set_video_source_resolution(g_conns[index].webrtc, source_id, width, height);
+       ret = webrtc_media_source_set_video_resolution(g_conns[index].webrtc, source_id, width, height);
        if (ret != WEBRTC_ERROR_NONE)
-               g_print("failed to webrtc_set_video_source_resolution(), source_id[%u], ret[0x%x]\n", source_id, ret);
+               g_print("failed to webrtc_media_source_set_video_resolution(), source_id[%u], ret[0x%x]\n", source_id, ret);
        else
-               g_print("webrtc_set_video_source_resolution() success, source_id[%u], [%dx%d]\n", source_id, width, height);
+               g_print("webrtc_media_source_set_video_resolution() success, source_id[%u], [%dx%d]\n", source_id, width, height);
 }
 
-static void _webrtc_get_video_source_resolution(int index, unsigned int source_id)
+static void _webrtc_media_source_get_video_resolution(int index, unsigned int source_id)
 {
        int ret = WEBRTC_ERROR_NONE;
        int width;
        int height;
 
-       ret = webrtc_get_video_source_resolution(g_conns[index].webrtc, source_id, &width, &height);
+       ret = webrtc_media_source_get_video_resolution(g_conns[index].webrtc, source_id, &width, &height);
        if (ret != WEBRTC_ERROR_NONE)
-               g_print("failed to webrtc_set_video_source_resolution(), source_id[%u], ret[0x%x]\n", source_id, ret);
+               g_print("failed to webrtc_media_source_set_video_resolution(), source_id[%u], ret[0x%x]\n", source_id, ret);
        else
-               g_print("webrtc_get_video_source_resolution() success, source_id[%u], [%dx%d]\n", source_id, width, height);
+               g_print("webrtc_media_source_get_video_resolution() success, source_id[%u], [%dx%d]\n", source_id, width, height);
 }
 
 #define VIDEO_WIDTH       352
@@ -696,28 +696,28 @@ static void _webrtc_media_packet_source_set_format(int index, unsigned int sourc
        }
 }
 
-static void _webrtc_get_transceiver_direction(int index, unsigned int source_id, webrtc_media_type_e media_type)
+static void _webrtc_media_source_get_transceiver_direction(int index, unsigned int source_id, webrtc_media_type_e media_type)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_transceiver_direction_e direction;
 
-       ret = webrtc_get_transceiver_direction(g_conns[index].webrtc, source_id, media_type, &direction);
+       ret = webrtc_media_source_get_transceiver_direction(g_conns[index].webrtc, source_id, media_type, &direction);
        if (ret != WEBRTC_ERROR_NONE)
-               g_print("failed to webrtc_get_transceiver_direction(), ret[0x%x]\n", ret);
+               g_print("failed to webrtc_media_source_get_transceiver_direction(), ret[0x%x]\n", ret);
        else
-               g_print("webrtc_get_transceiver_direction() success, source_id[%u], media_type[%s], direction[%s]\n",
+               g_print("webrtc_media_source_get_transceiver_direction() success, source_id[%u], media_type[%s], direction[%s]\n",
                        source_id, g_webrtc_media_type_str[media_type], g_webrtc_transceiver_direction_str[direction]);
 }
 
-static void _webrtc_set_transceiver_direction(int index, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
+static void _webrtc_media_source_set_transceiver_direction(int index, unsigned int source_id, webrtc_media_type_e media_type, webrtc_transceiver_direction_e direction)
 {
        int ret = WEBRTC_ERROR_NONE;
 
-       ret = webrtc_set_transceiver_direction(g_conns[index].webrtc, source_id, media_type, direction);
+       ret = webrtc_media_source_set_transceiver_direction(g_conns[index].webrtc, source_id, media_type, direction);
        if (ret != WEBRTC_ERROR_NONE)
-               g_print("failed to webrtc_set_transceiver_direction(), source_id[%u], ret[0x%x]\n", source_id, ret);
+               g_print("failed to webrtc_media_source_set_transceiver_direction(), source_id[%u], ret[0x%x]\n", source_id, ret);
        else
-               g_print("webrtc_set_transceiver_direction() success, source_id[%u], media_type[%s], direction[%s]\n",
+               g_print("webrtc_media_source_set_transceiver_direction() success, source_id[%u], media_type[%s], direction[%s]\n",
                        source_id, g_webrtc_media_type_str[media_type], g_webrtc_transceiver_direction_str[direction]);
 }
 
@@ -846,22 +846,22 @@ static void _webrtc_data_channel_send_file(int index, const char *file_path)
        }
 }
 
-static void _webrtc_set_media_source_mute(int index, unsigned int source_id, webrtc_media_type_e media_type, bool mute)
+static void _webrtc_media_source_set_mute(int index, unsigned int source_id, webrtc_media_type_e media_type, bool mute)
 {
        int ret = 0;
        bool mute_status = false;
 
-       ret = webrtc_set_media_source_mute(g_conns[index].webrtc, source_id, media_type, mute);
+       ret = webrtc_media_source_set_mute(g_conns[index].webrtc, source_id, media_type, mute);
        if (ret != WEBRTC_ERROR_NONE)
-               g_print("failed to webrtc_set_media_source_mute(), source_id[%d], muted[%d], ret[0x%x]\n", source_id, mute, ret);
+               g_print("failed to webrtc_media_source_set_mute(), source_id[%d], muted[%d], ret[0x%x]\n", source_id, mute, ret);
        else
-               g_print("webrtc_set_media_source_mute() success, source_id[%d], muted[%d]\n", source_id, mute);
+               g_print("webrtc_media_source_set_mute() success, source_id[%d], muted[%d]\n", source_id, mute);
 
-       ret = webrtc_get_media_source_muted(g_conns[index].webrtc, source_id, media_type, &mute_status);
+       ret = webrtc_media_source_get_mute(g_conns[index].webrtc, source_id, media_type, &mute_status);
        if (ret != WEBRTC_ERROR_NONE)
-               g_print("failed to webrtc_get_media_source_muted(), source_id[%d], ret[0x%x]\n", source_id, ret);
+               g_print("failed to webrtc_media_source_get_mute(), source_id[%d], ret[0x%x]\n", source_id, ret);
        else
-               g_print("webrtc_get_media_source_muted() success, source_id[%d], mute_status[%d]\n", source_id, mute_status);
+               g_print("webrtc_media_source_get_mute() success, source_id[%d], mute_status[%d]\n", source_id, mute_status);
 }
 
 static void _webrtc_set_stun_server(int index, char *uri)
@@ -2960,16 +2960,16 @@ void _interpret_main_menu(char *cmd)
                        g_conns[g_conn_index].menu_state = CURRENT_STATUS_REMOVE_MEDIA_SOURCE;
 
                } else if (strncmp(cmd, "p", 1) == 0) {
-                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_SET_MEDIA_SOURCE_PAUSE;
+                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE;
 
                } else if (strncmp(cmd, "o", 1) == 0) {
-                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_GET_MEDIA_SOURCE_PAUSE;
+                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE;
 
                } else if (strncmp(cmd, "v", 1) == 0) {
-                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_SET_VIDEO_SOURCE_RESOLUTION;
+                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION;
 
                } else if (strncmp(cmd, "l", 1) == 0) {
-                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_GET_VIDEO_SOURCE_RESOLUTION;
+                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION;
 
                } else if (strncmp(cmd, "s", 1) == 0) {
                        _webrtc_start(g_conn_index);
@@ -2994,11 +2994,11 @@ void _interpret_main_menu(char *cmd)
                if (strncmp(cmd, "sf", 2) == 0) {
                        g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_FORMAT;
 
-               } else if (strncmp(cmd, "gd", 2) == 0) {
-                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_GET_TRANSCEIVER_DIRECTION;
-
                } else if (strncmp(cmd, "td", 2) == 0) {
-                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_SET_TRANSCEIVER_DIRECTION;
+                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION;
+
+               } else if (strncmp(cmd, "gd", 2) == 0) {
+                       g_conns[g_conn_index].menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION;
 
                } else if (strncmp(cmd, "dt", 2) == 0) {
                        g_conns[g_conn_index].menu_state = CURRENT_STATUS_SET_DISPLAY_TYPE;
@@ -3254,11 +3254,11 @@ void display_sub_basic()
        g_print("r. Remove media source\n");
        g_print("p. Pause/play media source\t");
        g_print("o. Get the pause of media source\n");
-       g_print("v. Set video source resolution\t");
-       g_print("l. Get video source resolution\n");
+       g_print("v. Set video resolution\t");
+       g_print("l. Get video resolution\n");
+       g_print("td. Set transceiver direction\t");
+       g_print("gd. Get transceiver direction\n");
        g_print("sf. Set media format to media packet source\n");
-       g_print("gd. Get transceiver direction\t");
-       g_print("td. Set transceiver direction\n");
        g_print("dt. Set display type\n");
        g_print("cd. Create data channel\t");
        g_print("dd. Destroy data channel\n");
@@ -3331,7 +3331,7 @@ static void displaymenu()
        } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_REMOVE_MEDIA_SOURCE) {
                g_print("*** input media source id to remove.\n");
 
-       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_SET_MEDIA_SOURCE_PAUSE) {
+       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE) {
                if (g_conns[g_conn_index].cnt == 0)
                        g_print("*** input source id.\n");
                else if (g_conns[g_conn_index].cnt == 1)
@@ -3339,13 +3339,13 @@ static void displaymenu()
                else if (g_conns[g_conn_index].cnt == 2)
                        g_print("*** input pause or play.(1:pause, 0:play)\n");
 
-       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_GET_MEDIA_SOURCE_PAUSE) {
+       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE) {
                if (g_conns[g_conn_index].cnt == 0)
                        g_print("*** input source id.\n");
                else if (g_conns[g_conn_index].cnt == 1)
                        g_print("*** input media type.(1:audio 2:video)\n");
 
-       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_SET_VIDEO_SOURCE_RESOLUTION) {
+       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION) {
                if (g_conns[g_conn_index].cnt == 0)
                        g_print("*** input source id.\n");
                else if (g_conns[g_conn_index].cnt == 1)
@@ -3353,7 +3353,7 @@ static void displaymenu()
                else if (g_conns[g_conn_index].cnt == 2)
                        g_print("*** input height.\n");
 
-       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_GET_VIDEO_SOURCE_RESOLUTION) {
+       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION) {
                g_print("*** input source id.\n");
 
        } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_BUFFER_STATE_CHANGED_CB) {
@@ -3368,19 +3368,19 @@ static void displaymenu()
                else if (g_conns[g_conn_index].cnt == 1)
                        g_print("*** input media format.(1:I420 2:NV12 3:PCM_S16LE 4:H264)\n");
 
-       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_GET_TRANSCEIVER_DIRECTION) {
+       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION) {
                if (g_conns[g_conn_index].cnt == 0)
                        g_print("*** input source id.\n");
                else if (g_conns[g_conn_index].cnt == 1)
                        g_print("*** input media type.(1:audio 2:video)\n");
+               else if (g_conns[g_conn_index].cnt == 2)
+                       g_print("*** input transceiver direction.(1:sendonly 2:recvonly, 3:sendrecv)\n");
 
-       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_SET_TRANSCEIVER_DIRECTION) {
+       } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION) {
                if (g_conns[g_conn_index].cnt == 0)
                        g_print("*** input source id.\n");
                else if (g_conns[g_conn_index].cnt == 1)
                        g_print("*** input media type.(1:audio 2:video)\n");
-               else if (g_conns[g_conn_index].cnt == 2)
-                       g_print("*** input transceiver direction.(1:sendonly 2:recvonly, 3:sendrecv)\n");
 
        } else if (g_conns[g_conn_index].menu_state == CURRENT_STATUS_SET_DISPLAY_TYPE) {
                g_print("*** input display type.(1:overlay, 2:evas)\n");
@@ -3486,7 +3486,7 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
-       case CURRENT_STATUS_SET_MEDIA_SOURCE_PAUSE: {
+       case CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE: {
                static unsigned int id;
                static unsigned int media_type;
                int is_pause;
@@ -3503,7 +3503,7 @@ static void interpret(char *cmd)
                        break;
                case 2:
                        is_pause = value;
-                       _webrtc_set_media_source_pause(g_conn_index, id, media_type, is_pause);
+                       _webrtc_media_source_set_pause(g_conn_index, id, media_type, is_pause);
                        id = media_type = 0;
                        g_conns[g_conn_index].cnt = 0;
                        reset_menu_state();
@@ -3511,7 +3511,7 @@ static void interpret(char *cmd)
                }
                break;
        }
-       case CURRENT_STATUS_GET_MEDIA_SOURCE_PAUSE: {
+       case CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE: {
                static unsigned int id;
                value = atoi(cmd);
 
@@ -3521,7 +3521,7 @@ static void interpret(char *cmd)
                        g_conns[g_conn_index].cnt++;
                        break;
                case 1:
-                       _webrtc_get_media_source_pause(g_conn_index, id, value - 1);
+                       _webrtc_media_source_get_pause(g_conn_index, id, value - 1);
                        id = 0;
                        g_conns[g_conn_index].cnt = 0;
                        reset_menu_state();
@@ -3529,7 +3529,7 @@ static void interpret(char *cmd)
                }
                break;
        }
-       case CURRENT_STATUS_SET_VIDEO_SOURCE_RESOLUTION: {
+       case CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION: {
                static unsigned int id;
                static int width;
                static int height;
@@ -3546,7 +3546,7 @@ static void interpret(char *cmd)
                        break;
                case 2:
                        height =  value;
-                       _webrtc_set_video_source_resolution(g_conn_index, id, width, height);
+                       _webrtc_media_source_set_video_resolution(g_conn_index, id, width, height);
                        id = width = height = 0;
                        g_conns[g_conn_index].cnt = 0;
                        reset_menu_state();
@@ -3554,9 +3554,9 @@ static void interpret(char *cmd)
                }
                break;
        }
-       case CURRENT_STATUS_GET_VIDEO_SOURCE_RESOLUTION: {
+       case CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION: {
                value = atoi(cmd);
-               _webrtc_get_video_source_resolution(g_conn_index, value);
+               _webrtc_media_source_get_video_resolution(g_conn_index, value);
                reset_menu_state();
                break;
        }
@@ -3590,9 +3590,10 @@ static void interpret(char *cmd)
                }
                break;
        }
-       case CURRENT_STATUS_GET_TRANSCEIVER_DIRECTION: {
+       case CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION: {
                static unsigned int id;
                static unsigned int media_type;
+               static unsigned int direction;
                value = atoi(cmd);
 
                switch (g_conns[g_conn_index].cnt) {
@@ -3602,18 +3603,21 @@ static void interpret(char *cmd)
                        break;
                case 1:
                        media_type = value - 1;
-                       _webrtc_get_transceiver_direction(g_conn_index, id, media_type);
-                       id = media_type = 0;
+                       g_conns[g_conn_index].cnt++;
+                       break;
+               case 2:
+                       direction =  value - 1;
+                       _webrtc_media_source_set_transceiver_direction(g_conn_index, id, media_type, direction);
+                       id = media_type = direction = 0;
                        g_conns[g_conn_index].cnt = 0;
                        reset_menu_state();
                        break;
                }
                break;
        }
-       case CURRENT_STATUS_SET_TRANSCEIVER_DIRECTION: {
+       case CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION: {
                static unsigned int id;
                static unsigned int media_type;
-               static unsigned int direction;
                value = atoi(cmd);
 
                switch (g_conns[g_conn_index].cnt) {
@@ -3623,12 +3627,8 @@ static void interpret(char *cmd)
                        break;
                case 1:
                        media_type = value - 1;
-                       g_conns[g_conn_index].cnt++;
-                       break;
-               case 2:
-                       direction =  value - 1;
-                       _webrtc_set_transceiver_direction(g_conn_index, id, media_type, direction);
-                       id = media_type = direction = 0;
+                       _webrtc_media_source_get_transceiver_direction(g_conn_index, id, media_type);
+                       id = media_type = 0;
                        g_conns[g_conn_index].cnt = 0;
                        reset_menu_state();
                        break;
@@ -3775,7 +3775,7 @@ static void interpret(char *cmd)
                        g_conns[g_conn_index].cnt++;
                        break;
                case 2:
-                       _webrtc_set_media_source_mute(g_conn_index, id, media_type, value);
+                       _webrtc_media_source_set_mute(g_conn_index, id, media_type, value);
                        id = media_type = 0;
                        g_conns[g_conn_index].cnt = 0;
                        reset_menu_state();