Add new parameter for options to webrtc_create_data_channel() 31/255831/2
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 24 Mar 2021 06:20:11 +0000 (15:20 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 29 Mar 2021 10:34:35 +0000 (19:34 +0900)
It is added to support configuration options for the data channel.

The 3rd parameter is added as below.
 - int webrtc_create_data_channel(webrtc_h webrtc,
                                  const char *label,
                                  bundle *options,
                                  webrtc_data_channel_h *channel)

[Version] 0.1.134
[Issue Type] API

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

index b0463f7bee170804f292ef10a45b913fe80e1186..f1d2954bf63fa7106695cdbc94c7f14c3e0a007e 100644 (file)
@@ -13,7 +13,7 @@ INCLUDE_DIRECTORIES(${INC_DIR})
 
 SET(dependents "dlog glib-2.0 gstreamer-1.0 gstreamer-webrtc-1.0 gstreamer-video-1.0 gstreamer-audio-1.0 \
                 json-glib-1.0 iniparser mm-common mm-display-interface capi-media-tool libtbm libwebsockets \
-                cynara-client libsmack capi-system-info libsoup-2.4")
+                cynara-client libsmack capi-system-info libsoup-2.4 bundle")
 IF(NOT TIZEN_PROFILE_TV)
     SET(dependents "${dependents} mm-resource-manager")
     ADD_DEFINITIONS("-DTIZEN_FEATURE_RES_MGR")
index 5ffda9520a7c3b60034d0f9e4c95a00d0c363b4e..0fbbdd640f04179e8d5d83dc45d9ea321bb4c92a 100644 (file)
@@ -20,6 +20,7 @@
 #include <tizen.h>
 #include <media_format.h>
 #include <media_packet.h>
+#include <bundle.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -961,6 +962,7 @@ int webrtc_unset_data_channel_cb(webrtc_h webrtc);
  * @since_tizen 6.5
  * @param[in] webrtc      WebRTC handle
  * @param[in] label       Name for the channel
+ * @param[in] options     Configuration options for the data channel (optional, this can be NULL)
  * @param[out] channel    Data channel handle
  * @return @c 0 on success,
  *         otherwise a negative error value
@@ -971,7 +973,7 @@ int webrtc_unset_data_channel_cb(webrtc_h webrtc);
  * @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
  * @see webrtc_destroy_data_channel()
  */
-int webrtc_create_data_channel(webrtc_h webrtc, const char *label, webrtc_data_channel_h *channel);
+int webrtc_create_data_channel(webrtc_h webrtc, const char *label, bundle *options, webrtc_data_channel_h *channel);
 
 /**
  * @brief Destroys the data channel.
index 6b7a0ae97c37dc4dac089f79383862739e1f9b00..243475276ede00ef9cb6dc1387ae8cc3ffe8c6a5 100644 (file)
@@ -510,7 +510,7 @@ bool _webrtcbin_have_remote_offer(webrtc_s *webrtc);
 
 void _init_data_channels(webrtc_s *webrtc);
 void _destroy_data_channels(webrtc_s *webrtc);
-int _create_data_channel(webrtc_s *webrtc, const char *label, webrtc_data_channel_s **channel);
+int _create_data_channel(webrtc_s *webrtc, const char *label, bundle *options, webrtc_data_channel_s **channel);
 int _destroy_data_channel(webrtc_data_channel_s *channel);
 int _data_channel_send_string(webrtc_data_channel_s *channel, const char *string);
 int _data_channel_send_bytes(webrtc_data_channel_s *channel, const char *data, unsigned int size);
index 007f4119fe0325dba2be6f9cec3f48b79f253f0b..923ddc54d537bf53ad35005a0729c9c762839e9f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.1.133
+Version:    0.1.134
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -28,6 +28,7 @@ BuildRequires:  pkgconfig(libwebsockets)
 BuildRequires:  pkgconfig(cynara-client)
 BuildRequires:  pkgconfig(libsmack)
 BuildRequires:  pkgconfig(capi-system-info)
+BuildRequires:  pkgconfig(bundle)
 %if "%{tizen_profile_name}" != "tv"
 BuildRequires:  pkgconfig(mm-resource-manager)
 %endif
index d3c96f27e8ac2ab78886808c3b094d0d92f137ef..2d24774ab5ba852ff584c43d8eda6aca44d2ec3c 100644 (file)
@@ -834,7 +834,7 @@ int webrtc_add_ice_candidate(webrtc_h webrtc, const char *candidate)
        return ret;
 }
 
-int webrtc_create_data_channel(webrtc_h webrtc, const char *label, webrtc_data_channel_h *channel)
+int webrtc_create_data_channel(webrtc_h webrtc, const char *label, bundle *options, webrtc_data_channel_h *channel)
 {
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = (webrtc_s*)webrtc;
@@ -850,7 +850,7 @@ int webrtc_create_data_channel(webrtc_h webrtc, const char *label, webrtc_data_c
        ret = _gst_pipeline_set_state(_webrtc, GST_STATE_READY);
        RET_VAL_WITH_UNLOCK_IF(ret != WEBRTC_ERROR_NONE, ret, &_webrtc->mutex, "failed to change GST state to READY");
 
-       ret = _create_data_channel(webrtc, label, (webrtc_data_channel_s **)channel);
+       ret = _create_data_channel(webrtc, label, options, (webrtc_data_channel_s **)channel);
 
        g_mutex_unlock(&_webrtc->mutex);
 
index 84e072127f292a6705f99d7afe7c9ffa879b0b03..f477e85156fec7c3a9d2324fdacf58fc88653a03 100644 (file)
@@ -152,16 +152,19 @@ void _webrtcbin_on_data_channel_cb(GstElement *webrtcbin, GObject *data_channel,
        __invoke_data_channel_cb(webrtc, channel);
 }
 
-int _create_data_channel(webrtc_s *webrtc, const char *label, webrtc_data_channel_s **channel)
+int _create_data_channel(webrtc_s *webrtc, const char *label, bundle *options, webrtc_data_channel_s **channel)
 {
        webrtc_data_channel_s *_channel;
        GObject *data_channel;
+       GstStructure *_options = NULL;
 
        RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
        RET_VAL_IF(label == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "label is NULL");
        RET_VAL_IF(channel == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "channel is NULL");
 
-       g_signal_emit_by_name(webrtc->gst.webrtcbin, "create-data-channel", label, NULL, &data_channel);
+       /* TODO: get GstStructure from the options parameter */
+
+       g_signal_emit_by_name(webrtc->gst.webrtcbin, "create-data-channel", label, _options, &data_channel);
        if (!data_channel) {
                LOG_ERROR("failed to create data channel");
                return WEBRTC_ERROR_INVALID_OPERATION;
index 80d92655cde30fc301ef97ad43fd1f372f6bfb4c..36951303938b5b7ce9c28bf24e01a03ac02f62a0 100644 (file)
@@ -1464,7 +1464,7 @@ static void _webrtc_create_data_channel(int index)
 
        label = g_strdup_printf("data_channel_%d_%d", index, g_conns[index].channel_index);
 
-       ret = webrtc_create_data_channel(g_conns[index].webrtc, label, &g_conns[index].channels[g_conns[index].channel_index]);
+       ret = webrtc_create_data_channel(g_conns[index].webrtc, label, NULL, &g_conns[index].channels[g_conns[index].channel_index]);
        if (ret != WEBRTC_ERROR_NONE) {
                g_print("failed to webrtc_create_data_channel()\n");
        } else {