return true;
}
+static int __build_src_check_params_and_get_ini_source(webrtc_s *webrtc, webrtc_gst_slot_s *source, const ini_item_media_source_s **ini_source)
+{
+ RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
+ RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
+ RET_VAL_IF(ini_source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "ini_source is NULL");
+ RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
+
+ if (!(*ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
+ LOG_ERROR("ini_source is NULL");
+ return WEBRTC_ERROR_INVALID_OPERATION;
+ }
+
+ return WEBRTC_ERROR_NONE;
+}
+
static int __build_screensrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
{
int ret;
GstElement *videoswitch = NULL;
const ini_item_media_source_s *ini_source;
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
- RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
-
- if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
- LOG_ERROR("ini_source is NULL");
- goto exit;
- }
+ ret = __build_src_check_params_and_get_ini_source(webrtc, source, &ini_source);
+ RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to __build_src_check_params_and_get_ini_source()");
ret = _add_no_target_ghostpad_to_slot(source, true, &source->av[AV_IDX_VIDEO].src_pad);
RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _add_no_target_ghostpad_to_slot()");
GstElement *camerasrc;
const ini_item_media_source_s *ini_source;
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
- RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
-
- if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
- LOG_ERROR("ini_source is NULL");
- return WEBRTC_ERROR_INVALID_OPERATION;
- }
+ ret = __build_src_check_params_and_get_ini_source(webrtc, source, &ini_source);
+ RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to __build_src_check_params_and_get_ini_source()");
ret = _add_no_target_ghostpad_to_slot(source, true, &source->av[AV_IDX_VIDEO].src_pad);
RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _add_no_target_ghostpad_to_slot()");
static int __complete_rest_of_audiosrc(webrtc_s *webrtc, webrtc_gst_slot_s *source)
{
+ int ret;
GList *element_list = NULL;
GstElement *audiosrc;
GstElement *volume;
GstElement *capsfilter;
const ini_item_media_source_s *ini_source;
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
- RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
-
- if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
- LOG_ERROR("ini_source is NULL");
- return WEBRTC_ERROR_INVALID_OPERATION;
- }
+ ret = __build_src_check_params_and_get_ini_source(webrtc, source, &ini_source);
+ RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to __build_src_check_params_and_get_ini_source()");
/* skip when it is already completed. e.g) start() -> stop() -> start() again */
if (source->av[AV_IDX_AUDIO].render.src_pad_probe_id > 0)
GstElement *audiosrc;
const ini_item_media_source_s *ini_source;
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
- RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
-
- if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
- LOG_ERROR("ini_source is NULL");
- return WEBRTC_ERROR_INVALID_OPERATION;
- }
+ ret = __build_src_check_params_and_get_ini_source(webrtc, source, &ini_source);
+ RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to __build_src_check_params_and_get_ini_source()");
ret = _add_no_target_ghostpad_to_slot(source, true, &source->av[AV_IDX_AUDIO].src_pad);
RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _add_no_target_ghostpad_to_slot()");
GstElement *videotestsrc;
const ini_item_media_source_s *ini_source;
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
- RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
-
- if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
- LOG_ERROR("ini_source is NULL");
- return WEBRTC_ERROR_INVALID_OPERATION;
- }
+ ret = __build_src_check_params_and_get_ini_source(webrtc, source, &ini_source);
+ RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to __build_src_check_params_and_get_ini_source()");
ret = _add_no_target_ghostpad_to_slot(source, true, &source->av[AV_IDX_VIDEO].src_pad);
RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _add_no_target_ghostpad_to_slot()");
GstElement *custom_videosrc;
const ini_item_media_source_s *ini_source;
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
- RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
-
- if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
- LOG_ERROR("ini_source is NULL");
- return WEBRTC_ERROR_INVALID_OPERATION;
- }
+ ret = __build_src_check_params_and_get_ini_source(webrtc, source, &ini_source);
+ RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to __build_src_check_params_and_get_ini_source()");
ret = _add_no_target_ghostpad_to_slot(source, true, &source->av[AV_IDX_VIDEO].src_pad);
RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _add_no_target_ghostpad_to_slot()");
GstElement *custom_audiosrc;
const ini_item_media_source_s *ini_source;
- RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL");
- RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL");
- RET_VAL_IF(source->bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL");
-
- if (!(ini_source = _ini_get_source_by_type(&webrtc->ini, source->type))) {
- LOG_ERROR("ini_source is NULL");
- return WEBRTC_ERROR_INVALID_OPERATION;
- }
+ ret = __build_src_check_params_and_get_ini_source(webrtc, source, &ini_source);
+ RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to __build_src_check_params_and_get_ini_source()");
ret = _add_no_target_ghostpad_to_slot(source, true, &source->av[AV_IDX_AUDIO].src_pad);
RET_VAL_IF(ret != WEBRTC_ERROR_NONE, ret, "failed to _add_no_target_ghostpad_to_slot()");