static int __build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
{
- int ret = WEBRTC_ERROR_NONE;
+ int ret;
GstElement *screensrc;
GstElement *videoconvert;
GstElement *videotestsrc;
APPEND_ELEMENT(element_list, videoconvert);
}
- if ((ret = __create_rest_of_elements(webrtc, source, true, &element_list, false)) != WEBRTC_ERROR_NONE)
+ if (__create_rest_of_elements(webrtc, source, true, &element_list, false) != WEBRTC_ERROR_NONE)
goto exit;
if (!__add_elements_to_bin(source->bin, switch_src_list)) {
return WEBRTC_ERROR_INVALID_OPERATION;
}
- if (!__link_switch_srcs(videoswitch, switch_src_list)) {
- ret = WEBRTC_ERROR_INVALID_OPERATION;
+ if (!__link_switch_srcs(videoswitch, switch_src_list))
goto exit_with_remove_from_bin;
- }
- if (!__link_elements(element_list)) {
- ret = WEBRTC_ERROR_INVALID_OPERATION;
+ if (!__link_elements(element_list))
goto exit_with_remove_from_bin;
- }
- if (!(capsfilter = gst_bin_get_by_name(source->bin, ELEMENT_NAME_RTP_CAPSFILTER))) {
- ret = WEBRTC_ERROR_INVALID_OPERATION;
+ if (!(capsfilter = gst_bin_get_by_name(source->bin, ELEMENT_NAME_RTP_CAPSFILTER)))
goto exit_with_remove_from_bin;
- }
- ret = _set_ghost_pad_target(src_pad, capsfilter, true);
- if (ret != WEBRTC_ERROR_NONE)
+
+ if (_set_ghost_pad_target(src_pad, capsfilter, true) != WEBRTC_ERROR_NONE)
goto exit_with_remove_from_bin;
__add_probe_to_pad_for_pause(source, AV_IDX_VIDEO, src_pad, __payloaded_data_probe_cb);
__remove_elements_from_bin(source->bin, element_list);
SAFE_G_LIST_FREE(switch_src_list);
SAFE_G_LIST_FREE(element_list);
- return ret;
+ return WEBRTC_ERROR_INVALID_OPERATION;
exit:
SAFE_G_LIST_FREE_FULL(switch_src_list, gst_object_unref);
SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref);
- return ret;
+ return WEBRTC_ERROR_INVALID_OPERATION;
}
static int __build_rest_of_videosrc(webrtc_s *webrtc, GstPad *src_pad, GstElement *videosrc_element, webrtc_gst_slot_s *source)
{
- int ret = WEBRTC_ERROR_NONE;
GList *element_list = NULL;
GstElement *capsfilter;
const ini_item_media_source_s *ini_source;
if (g_object_class_find_property(G_OBJECT_GET_CLASS(G_OBJECT(videosrc_element)), "empty-buffer-timeout"))
g_object_set(G_OBJECT(videosrc_element), "empty-buffer-timeout", 0, NULL);
- if ((ret = __create_rest_of_elements(webrtc, source, true, &element_list, false)) != WEBRTC_ERROR_NONE)
+ if (__create_rest_of_elements(webrtc, source, true, &element_list, false) != WEBRTC_ERROR_NONE)
goto exit;
if (!__add_elements_to_bin(source->bin, element_list)) {
return WEBRTC_ERROR_INVALID_OPERATION;
}
- if (!__link_elements(element_list)) {
- ret = WEBRTC_ERROR_INVALID_OPERATION;
+ if (!__link_elements(element_list))
goto exit_with_remove_from_bin;
- }
- if (!(capsfilter = gst_bin_get_by_name(source->bin, ELEMENT_NAME_RTP_CAPSFILTER))) {
- ret = WEBRTC_ERROR_INVALID_OPERATION;
+ if (!(capsfilter = gst_bin_get_by_name(source->bin, ELEMENT_NAME_RTP_CAPSFILTER)))
goto exit_with_remove_from_bin;
- }
- ret = _set_ghost_pad_target(src_pad, capsfilter, true);
- if (ret != WEBRTC_ERROR_NONE)
+
+ if (_set_ghost_pad_target(src_pad, capsfilter, true) != WEBRTC_ERROR_NONE)
goto exit_with_remove_from_bin;
__add_probe_to_pad_for_pause(source, AV_IDX_VIDEO, src_pad, __payloaded_data_probe_cb);
exit_with_remove_from_bin:
__remove_elements_from_bin(source->bin, element_list);
SAFE_G_LIST_FREE(element_list);
- return ret;
+ return WEBRTC_ERROR_INVALID_OPERATION;
exit:
SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref);
- return ret;
+ return WEBRTC_ERROR_INVALID_OPERATION;
}
static int __build_camerasrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
static int __build_rest_of_audiosrc(webrtc_s *webrtc, GstPad *src_pad, GstElement *audiosrc_element, webrtc_gst_slot_s *source)
{
- int ret = WEBRTC_ERROR_NONE;
GList *element_list = NULL;
GstElement *volume;
GstElement *capsfilter;
source->av[AV_IDX_AUDIO].inbandfec = ini_source->use_inbandfec;
source->av[AV_IDX_AUDIO].packet_loss_percentage = ini_source->packet_loss_percentage;
- if ((ret = __create_rest_of_elements(webrtc, source, true, &element_list, true)) != WEBRTC_ERROR_NONE)
+ if (__create_rest_of_elements(webrtc, source, true, &element_list, true) != WEBRTC_ERROR_NONE)
goto exit;
if (!__add_elements_to_bin(source->bin, element_list)) {
return WEBRTC_ERROR_INVALID_OPERATION;
}
- if (!__link_elements(element_list)) {
- ret = WEBRTC_ERROR_INVALID_OPERATION;
+ if (!__link_elements(element_list))
goto exit_with_remove_from_bin;
- }
- if (!(capsfilter = gst_bin_get_by_name(source->bin, ELEMENT_NAME_RTP_CAPSFILTER))) {
- ret = WEBRTC_ERROR_INVALID_OPERATION;
+ if (!(capsfilter = gst_bin_get_by_name(source->bin, ELEMENT_NAME_RTP_CAPSFILTER)))
goto exit_with_remove_from_bin;
- }
- ret = _set_ghost_pad_target(src_pad, capsfilter, true);
- if (ret != WEBRTC_ERROR_NONE)
+
+ if (_set_ghost_pad_target(src_pad, capsfilter, true) != WEBRTC_ERROR_NONE)
goto exit_with_remove_from_bin;
__add_probe_to_pad_for_pause(source, AV_IDX_AUDIO, src_pad, __payloaded_data_probe_cb);
exit_with_remove_from_bin:
__remove_elements_from_bin(source->bin, element_list);
SAFE_G_LIST_FREE(element_list);
- return ret;
+ return WEBRTC_ERROR_INVALID_OPERATION;
exit:
SAFE_G_LIST_FREE_FULL(element_list, gst_object_unref);
- return ret;
+ return WEBRTC_ERROR_INVALID_OPERATION;
}
static int __build_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source, bool use_mic)
if (!__sync_elements_state_with_parent(element_list))
goto exit_with_remove_from_bin;
- ret = _set_ghost_pad_target(src_pad, capsfilter, true);
- if (ret != WEBRTC_ERROR_NONE)
+ if (_set_ghost_pad_target(src_pad, capsfilter, true) != WEBRTC_ERROR_NONE)
goto exit_with_remove_from_bin;
__add_probe_to_pad_for_pause(source, av_idx, src_pad, __payloaded_data_probe_cb);