GstWebRTCSessionDescription *offer = NULL;
const GstStructure *reply;
media_streamer_node_s *webrtc_node = (media_streamer_node_s *)user_data;
- node_info_s *node_klass_type = NULL;
GstElement *webrtcbin = NULL;
gchar *sdp_msg;
ms_debug_fenter();
- node_klass_type = ms_node_get_klass_by_its_type(MEDIA_STREAMER_NODE_TYPE_WEBRTC);
- if (!(webrtcbin = ms_find_element_in_bin_by_type(webrtc_node->gst_element, node_klass_type))) {
- ms_error("Could not find webrtcbin by type[%s, %s]", node_klass_type->klass_name, node_klass_type->default_name);
+ if (!(webrtcbin = ms_webrtc_node_get_webrtcbin(webrtc_node)))
return;
- }
reply = gst_promise_get_reply(promise);
gst_structure_get(reply, "offer",
GstWebRTCSessionDescription *answer = NULL;
const GstStructure *reply;
media_streamer_node_s *node = (media_streamer_node_s *)user_data;
- node_info_s *node_klass_type = NULL;
gchar *sdp_msg;
GstElement *webrtcbin;
ms_debug_fenter();
- node_klass_type = ms_node_get_klass_by_its_type(MEDIA_STREAMER_NODE_TYPE_WEBRTC);
- if (!(webrtcbin = ms_find_element_in_bin_by_type(node->gst_element, node_klass_type))) {
- ms_error("Could not find webrtcbin by type[%s, %s]", node_klass_type->klass_name, node_klass_type->default_name);
+ if (!(webrtcbin = ms_webrtc_node_get_webrtcbin(node)))
return;
- }
reply = gst_promise_get_reply(promise);
gst_structure_get(reply, "answer", GST_TYPE_WEBRTC_SESSION_DESCRIPTION, &answer, NULL);
gchar *sdp;
gchar *type;
GstWebRTCSessionDescription *answer, *offer;
- node_info_s *node_klass_type;
GstElement *webrtcbin;
int ret = MEDIA_STREAMER_ERROR_NONE;
ms_debug_fenter();
-
- node_klass_type = ms_node_get_klass_by_its_type(MEDIA_STREAMER_NODE_TYPE_WEBRTC);
- if (!(webrtcbin = ms_find_element_in_bin_by_type(webrtc_node->gst_element, node_klass_type))) {
- ms_error("Could not find webrtcbin by type[%s, %s]", node_klass_type->klass_name, node_klass_type->default_name);
+ if (!(webrtcbin = ms_webrtc_node_get_webrtcbin(webrtc_node)))
return MEDIA_STREAMER_ERROR_INVALID_OPERATION;
- }
ret = ms_webrtc_get_sdp_from_message(sdp_msg, &sdp, &type);
if (ret != MEDIA_STREAMER_ERROR_NONE)
{
gchar *candidate;
gint sdpmlineindex;
- node_info_s *node_klass_type;
GstElement *webrtcbin;
int ret;
ms_debug_fenter();
- node_klass_type = ms_node_get_klass_by_its_type(MEDIA_STREAMER_NODE_TYPE_WEBRTC);
- if (!(webrtcbin = ms_find_element_in_bin_by_type(webrtc_node->gst_element, node_klass_type))) {
- ms_error("Could not find webrtcbin by type[%s, %s]", node_klass_type->klass_name, node_klass_type->default_name);
+ if (!(webrtcbin = ms_webrtc_node_get_webrtcbin(webrtc_node)))
return MEDIA_STREAMER_ERROR_INVALID_OPERATION;
- }
ret = ms_webrtc_get_ice_candidate_from_message(ice_msg, &candidate, &sdpmlineindex);
if (ret != MEDIA_STREAMER_ERROR_NONE)
int ms_webrtcbin_set_stun_server(media_streamer_node_s *webrtc_node, const char *stun_server_url)
{
- node_info_s *node_klass_type;
GstElement *webrtcbin;
GValue *val;
const gchar *stun_server = NULL;
ms_retvm_if(webrtc_node->gst_element == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "webrtc_container is NULL");
ms_retvm_if(stun_server_url == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "stun_server_url is NULL");
- node_klass_type = ms_node_get_klass_by_its_type(MEDIA_STREAMER_NODE_TYPE_WEBRTC);
- if (!(webrtcbin = ms_find_element_in_bin_by_type(webrtc_node->gst_element, node_klass_type))) {
- ms_error("Could not find webrtcbin by type[%s, %s]", node_klass_type->klass_name, node_klass_type->default_name);
+ if (!(webrtcbin = ms_webrtc_node_get_webrtcbin(webrtc_node)))
return MEDIA_STREAMER_ERROR_INVALID_OPERATION;
- }
val = (GValue *)g_object_get_data(G_OBJECT(webrtc_node->gst_element), MEDIA_STREAMER_PARAM_WEBRTC_STUN_SERVER);
if (!val) {