Apply network related features to webrtc_create() API 94/253094/4
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 4 Feb 2021 10:13:32 +0000 (19:13 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 8 Feb 2021 10:17:13 +0000 (19:17 +0900)
One of features below must be supported to use this webrtc API set.
 - http://tizen.org/feature/network.wifi
 - http://tizen.org/feature/network.telephony
 - http://tizen.org/feature/network.ethernet

[Version] 0.1.107
[Issue Type] Feature

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

index 8f08bffe3516b2324f8770248e998feafcad4d52..a6ddce67cb1370524be287b1612fbe66294b91ac 100644 (file)
@@ -141,6 +141,23 @@ do { \
                return ret; \
 } while (0)
 
+#define _WEBRTC_FEATURE_NETWORK_WIFI    "http://tizen.org/feature/network.wifi"
+#define _WEBRTC_FEATURE_NETWORK_TELE    "http://tizen.org/feature/network.telephony"
+#define _WEBRTC_FEATURE_NETWORK_ETH     "http://tizen.org/feature/network.ethernet"
+#define RET_ERR_IF_NETWORK_FEATURES_ARE_NOT_SUPPORTED() \
+do { \
+       int ret = _check_feature(_WEBRTC_FEATURE_NETWORK_WIFI); \
+       if (ret == WEBRTC_ERROR_NONE) \
+               break; \
+       ret = _check_feature(_WEBRTC_FEATURE_NETWORK_TELE); \
+       if (ret == WEBRTC_ERROR_NONE) \
+               break; \
+       ret = _check_feature(_WEBRTC_FEATURE_NETWORK_ETH); \
+       if (ret == WEBRTC_ERROR_NONE) \
+               break; \
+       return WEBRTC_ERROR_NOT_SUPPORTED; \
+} while (0)
+
 #define SAFE_FREE(src)    { if (src) { free(src); src = NULL; } }
 #define SAFE_STR(str)     (str) ? str : "null"
 
index a38b3a9d84fb60d9d20b860fb25242b9f0768438..89ee6aa45a5f13188ce0a0c25a8b7243d97e595a 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.1.106
+Version:    0.1.107
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index d57c5da3228cd18ba4c5edda542314043d3c36f0..4bbf5355128955a3cd4a9120a4bc6e53ea9285cd 100644 (file)
@@ -116,8 +116,9 @@ int webrtc_create(webrtc_h *webrtc)
        int ret = WEBRTC_ERROR_NONE;
        webrtc_s *_webrtc = NULL;
 
-       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+       RET_ERR_IF_NETWORK_FEATURES_ARE_NOT_SUPPORTED();
        RET_ERR_IF_PRIVILEGE_IS_NOT_ALLOWED(_WEBRTC_PRIVILEGE_INTERNET);
+       RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
 
        _webrtc = g_new0(webrtc_s, 1);