* @pre @a webrtc state must be set to #WEBRTC_STATE_IDLE.
* @post @a webrtc state is #WEBRTC_STATE_NEGOTIATING.
* @see webrtc_create()
+ * @see webrtc_start()
* @see webrtc_stop()
*/
int webrtc_start_sync(webrtc_h webrtc);
+/**
+ * @internal
+ * @brief Strips the session description.
+ * @since_tizen 8.0
+ * @remarks @a origin_description is a JSON string. It should be {"sdp":{"type":"offer or answer","sdp":"..."}}.\n
+ * @a description will be {"..."} the string member of "sdp" object in @a origin_description.\n
+ * The @a description should be released using free().
+ * @param[in] origin_description The original session description
+ * @param[out] description The stripped session description
+ * @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
+ */
+int webrtc_util_strip_description(const char *origin_description, char **description);
+
/**
* @internal
* @brief Creates a signaling server for private network.
#ifdef TIZEN_FEATURE_DNS
#include <dns_sd.h>
#endif
+#include <json-glib/json-glib.h>
#include "webrtc_internal.h"
void _generate_dot(GstElement *pipeline, const gchar *name);
bool _stun_url_has_valid_prefix(const char *url);
gchar *_check_and_encode_turn_url(const char *url);
+gchar *_get_string_from_json_object(JsonObject *object);
#ifdef __cplusplus
}
Name: capi-media-webrtc
Summary: A WebRTC library in Tizen Native API
-Version: 0.4.46
+Version: 0.4.47
Release: 0
Group: Multimedia/API
License: Apache-2.0
return WEBRTC_ERROR_NONE;
}
+int webrtc_util_strip_description(const char *origin_description, char **description)
+{
+ g_autoptr(JsonParser) parser = NULL;
+ JsonNode *root;
+ JsonObject *object;
+ const gchar *member_sdp;
+
+ RET_VAL_IF(origin_description == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "origin_description is NULL");
+ RET_VAL_IF(description == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "description is NULL");
+
+ parser = json_parser_new();
+ if (!JSON_IS_PARSER(parser))
+ return WEBRTC_ERROR_INVALID_OPERATION;
+
+ if (!json_parser_load_from_data(parser, origin_description, -1, NULL)) {
+ LOG_ERROR("unknown description: %s", origin_description);
+ return WEBRTC_ERROR_INVALID_PARAMETER;
+ }
+
+ root = json_parser_get_root(parser);
+ if (!JSON_NODE_HOLDS_OBJECT(root)) {
+ LOG_ERROR("it does not contain a JsonObject: %s", origin_description);
+ return WEBRTC_ERROR_INVALID_PARAMETER;
+ }
+
+ object = json_node_get_object(root);
+ if (!json_object_has_member(object, "sdp")) {
+ LOG_ERROR("it does not contain 'sdp' member: %s", origin_description);
+ return WEBRTC_ERROR_INVALID_PARAMETER;
+ }
+
+ member_sdp = json_object_get_string_member(json_object_get_object_member(object, "sdp"), "sdp");
+ if (!member_sdp) {
+ LOG_ERROR("could not find sdb member: %s", origin_description);
+ return WEBRTC_ERROR_INVALID_PARAMETER;
+ }
+
+ *description = strdup(member_sdp);
+
+ LOG_INFO("description:\n%s", *description);
+
+ return WEBRTC_ERROR_NONE;
+}
+
int webrtc_set_rtp_packet_drop_probability(webrtc_h webrtc, bool sender, float probability)
{
webrtc_s *_webrtc = (webrtc_s *)webrtc;
#include "webrtc.h"
#include "webrtc_private.h"
-#include <json-glib/json-glib.h>
#include <pulse/proplist.h>
#include <sound_manager_internal.h>
}
/* Use g_free() to release the return value. */
-static gchar *__get_string_from_json_object(JsonObject *object)
+gchar *_get_string_from_json_object(JsonObject *object)
{
JsonNode *root;
JsonGenerator *generator;
msg = json_object_new();
json_object_set_object_member(msg, "sdp", sdp);
- text = __get_string_from_json_object(msg);
+ text = _get_string_from_json_object(msg);
json_object_unref(msg);
msg = json_object_new();
json_object_set_object_member(msg, "ice", ice);
- text = __get_string_from_json_object(msg);
+ text = _get_string_from_json_object(msg);
json_object_unref(msg);