From: Sangchul Lee Date: Fri, 17 Dec 2021 04:06:55 +0000 (+0900) Subject: Remove unused internal API X-Git-Tag: submit/tizen/20211229.072812~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6b9fbe9342d82ab4b6c04134ea623905490efe74;p=platform%2Fcore%2Fapi%2Fwebrtc.git Remove unused internal API Use webrtc_set[get]_rtp_packet_drop_probability() instead. [Version] 0.3.28 [Issue Type] Clean up Change-Id: I1e32d62c2a727aba58dd0cf8cf43dec096fd00f7 Signed-off-by: Sangchul Lee --- diff --git a/include/webrtc_internal.h b/include/webrtc_internal.h index 30f71d34..42c722e5 100644 --- a/include/webrtc_internal.h +++ b/include/webrtc_internal.h @@ -199,41 +199,6 @@ int webrtc_screen_source_set_crop(webrtc_h webrtc, unsigned int source_id, int x */ int webrtc_screen_source_unset_crop(webrtc_h webrtc, unsigned int source_id); -/** - * @internal - * @brief Sets the probability of RTP packet dropping. - * @since_tizen 7.0 - * @param[in] webrtc WebRTC handle - * @param[in] source_id The file source id - * @param[in] probability The probability to be dropped (from @c 0 to @c 1.0 = 100%) - * @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 - * @pre Add screen source to @a webrtc to get @a source_id by calling webrtc_add_media_source(). - * @see webrtc_media_source_get_rtp_packet_drop_probability() - */ -int webrtc_media_source_set_rtp_packet_drop_probability(webrtc_h webrtc, unsigned int source_id, float probability); - -/** - * @internal - * @brief Gets the probability of RTP packet dropping. - * @since_tizen 7.0 - * @remarks The default value is 0. - * @param[in] webrtc WebRTC handle - * @param[in] source_id The file source id - * @param[out] probability The probability to be dropped (from @c 0 to @c 1.0 = 100%) - * @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 - * @pre Add screen source to @a webrtc to get @a source_id by calling webrtc_add_media_source(). - * @see webrtc_media_source_set_rtp_packet_drop_probability() - */ -int webrtc_media_source_get_rtp_packet_drop_probability(webrtc_h webrtc, unsigned int source_id, float *probability); - /** * @internal * @brief Sets the probability of RTP packet dropping. diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 9fae1d77..a4bdd979 100644 --- a/packaging/capi-media-webrtc.spec +++ b/packaging/capi-media-webrtc.spec @@ -1,6 +1,6 @@ Name: capi-media-webrtc Summary: A WebRTC library in Tizen Native API -Version: 0.3.27 +Version: 0.3.28 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/src/webrtc_internal.c b/src/webrtc_internal.c index de574cdc..19b9942b 100644 --- a/src/webrtc_internal.c +++ b/src/webrtc_internal.c @@ -112,35 +112,6 @@ int webrtc_screen_source_unset_crop(webrtc_h webrtc, unsigned int source_id) return _unset_screen_source_crop(_webrtc, source_id); } -int webrtc_media_source_set_rtp_packet_drop_probability(webrtc_h webrtc, unsigned int source_id, float probability) -{ - webrtc_s *_webrtc = (webrtc_s*)webrtc; - g_autoptr(GMutexLocker) locker = NULL; - - RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0"); - RET_VAL_IF(probability > 1.0, WEBRTC_ERROR_INVALID_PARAMETER, "probability > 1.0"); - RET_VAL_IF(probability < 0, WEBRTC_ERROR_INVALID_PARAMETER, "probability < 0"); - - locker = g_mutex_locker_new(&_webrtc->mutex); - - return _set_rtp_packet_drop_probability(webrtc, source_id, probability); -} - -int webrtc_media_source_get_rtp_packet_drop_probability(webrtc_h webrtc, unsigned int source_id, float *probability) -{ - webrtc_s *_webrtc = (webrtc_s*)webrtc; - g_autoptr(GMutexLocker) locker = NULL; - - RET_VAL_IF(_webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0"); - RET_VAL_IF(probability == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "probability is NULL"); - - locker = g_mutex_locker_new(&_webrtc->mutex); - - return _get_rtp_packet_drop_probability(webrtc, source_id, probability); -} - int webrtc_set_rtp_packet_drop_probability(webrtc_h webrtc, bool sender, float probability) { webrtc_s *_webrtc = (webrtc_s*)webrtc; diff --git a/src/webrtc_source.c b/src/webrtc_source.c index f94a42d7..ccd4e5ef 100644 --- a/src/webrtc_source.c +++ b/src/webrtc_source.c @@ -39,7 +39,6 @@ #define DEFAULT_ELEMENT_INPUT_SELECTOR "input-selector" #define DEFAULT_ELEMENT_VIDEOCROP "videocrop" #define DEFAULT_ELEMENT_FILESRC "filesrc" -#define DEFAULT_ELEMENT_NETWORK_SIMULATOR "netsim" #define ELEMENT_NAME_FIRST_CAPSFILTER "firstCapsfilter" #define ELEMENT_NAME_RTP_CAPSFILTER "rtpCapsfilter" @@ -61,8 +60,6 @@ #define ELEMENT_NAME_VIDEO_FAKESINK "videoFakeSink" #define ELEMENT_NAME_AUDIO_APPSRC "audioAppsrc" #define ELEMENT_NAME_VIDEO_APPSRC "videoAppsrc" -#define ELEMENT_NAME_AUDIO_NETWORK_SIMULATOR "audioNetSim" -#define ELEMENT_NAME_VIDEO_NETWORK_SIMULATOR "videoNetSim" #define APPEND_ELEMENT(x_list, x_element) \ do { \ @@ -111,7 +108,6 @@ typedef struct { const char *payloader_name; const char *capsfilter_name; const char *fakesink_name; - const char *network_simulator_name; } av_mapping_table_s; static av_mapping_table_s _av_tbl[AV_IDX_MAX] = { @@ -121,7 +117,6 @@ static av_mapping_table_s _av_tbl[AV_IDX_MAX] = { ELEMENT_NAME_AUDIO_PAYLOADER, ELEMENT_NAME_AUDIO_CAPSFILTER, ELEMENT_NAME_AUDIO_FAKESINK, - ELEMENT_NAME_AUDIO_NETWORK_SIMULATOR }, { ELEMENT_NAME_VIDEO_APPSRC, @@ -129,7 +124,6 @@ static av_mapping_table_s _av_tbl[AV_IDX_MAX] = { ELEMENT_NAME_VIDEO_PAYLOADER, ELEMENT_NAME_VIDEO_CAPSFILTER, ELEMENT_NAME_VIDEO_FAKESINK, - ELEMENT_NAME_VIDEO_NETWORK_SIMULATOR } }; @@ -966,13 +960,6 @@ skip_encoder: goto error; APPEND_ELEMENT(*element_list, payloader); - if (webrtc->ini.general.network_simulator) { - GstElement *netsim = _create_element(DEFAULT_ELEMENT_NETWORK_SIMULATOR, NULL); - if (!netsim) - goto error; - APPEND_ELEMENT(*element_list, netsim); - } - if (!(queue = _create_element(DEFAULT_ELEMENT_QUEUE, NULL))) goto error; APPEND_ELEMENT(*element_list, queue); @@ -1028,13 +1015,6 @@ static int __create_rest_of_elements_for_encoded_format(webrtc_s *webrtc, webrtc goto error; APPEND_ELEMENT(*element_list, payloader); - if (webrtc->ini.general.network_simulator) { - GstElement *netsim = _create_element(DEFAULT_ELEMENT_NETWORK_SIMULATOR, NULL); - if (!netsim) - goto error; - APPEND_ELEMENT(*element_list, netsim); - } - if (!(queue = _create_element(DEFAULT_ELEMENT_QUEUE, NULL))) goto error; APPEND_ELEMENT(*element_list, queue); @@ -1835,7 +1815,6 @@ static void __remove_rest_of_elements_for_filesrc_pipeline(webrtc_gst_slot_s *so GstElement *payloader; GstElement *capsfilter; GstElement *fakesink; - GstElement *netsim; GList *element_list = NULL; int av_idx = GET_AV_IDX(is_audio); @@ -1865,13 +1844,6 @@ static void __remove_rest_of_elements_for_filesrc_pipeline(webrtc_gst_slot_s *so else LOG_ERROR("fakesink is NULL"); - if (source->webrtc->ini.general.network_simulator) { - if ((netsim = gst_bin_get_by_name(bin, _av_tbl[av_idx].network_simulator_name))) - APPEND_ELEMENT(element_list, netsim); - else - LOG_ERROR("netsim is NULL"); - } - __remove_elements_from_bin(bin, element_list); SAFE_G_LIST_FREE(element_list); @@ -2025,13 +1997,11 @@ static int __create_rest_of_elements_for_filesrc_pipeline(webrtc_gst_slot_s *sou GstBin *bin; GstElement *queue; GstElement *payloader; - GstElement *netsim; GstElement *capsfilter; GstElement *fakesink; GList *element_list = NULL; RET_VAL_IF(source == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL"); - RET_VAL_IF(source->webrtc == NULL, WEBRTC_ERROR_INVALID_OPERATION, "webrtc is NULL"); RET_VAL_IF(source->filesrc_pipeline == NULL, WEBRTC_ERROR_INVALID_OPERATION, "filesrc_pipeline is NULL"); bin = GST_BIN(source->filesrc_pipeline); @@ -2044,12 +2014,6 @@ static int __create_rest_of_elements_for_filesrc_pipeline(webrtc_gst_slot_s *sou goto exit; APPEND_ELEMENT(element_list, payloader); - if (source->webrtc->ini.general.network_simulator) { - if (!(netsim = _create_element(DEFAULT_ELEMENT_NETWORK_SIMULATOR, _av_tbl[GET_AV_IDX(is_audio)].network_simulator_name))) - goto exit; - APPEND_ELEMENT(element_list, netsim); - } - if (!(capsfilter = __prepare_capsfilter_for_filesrc_pipeline(source, is_audio))) goto exit; APPEND_ELEMENT(element_list, capsfilter); @@ -4548,78 +4512,6 @@ int _get_filesrc_looping(webrtc_s * webrtc, unsigned int source_id, bool *loopin return WEBRTC_ERROR_NONE; } -int _set_rtp_packet_drop_probability(webrtc_s *webrtc, unsigned int source_id, float probability) -{ - webrtc_gst_slot_s *source; - GstElement *netsim; - GstBin *bin; - - RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0"); - RET_VAL_IF(probability > 1.0, WEBRTC_ERROR_INVALID_PARAMETER, "probability > 1.0"); - RET_VAL_IF(probability < 0, WEBRTC_ERROR_INVALID_PARAMETER, "probability < 0"); - RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL"); - RET_VAL_IF(webrtc->ini.general.network_simulator == false, WEBRTC_ERROR_INVALID_OPERATION, "network simulator is disabled, please check the ini"); - bin = (source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE) ? GST_BIN(source->filesrc_pipeline) : GST_BIN(source->bin); - RET_VAL_IF(bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL"); - - if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE) { - int count = 0; - int av_idx = 0; - for (av_idx = 0; av_idx < AV_IDX_MAX; av_idx++) { - if ((netsim = gst_bin_get_by_name(bin, _av_tbl[av_idx].network_simulator_name))) { - g_object_set(G_OBJECT(netsim), "drop-probability", probability, NULL); - LOG_INFO("webrtc[%p] source_id[%u] probability[%f] applies to [%s]", webrtc, source_id, probability, GST_ELEMENT_NAME(netsim)); - count++; - } - } - RET_VAL_IF(count == 0, WEBRTC_ERROR_INVALID_OPERATION, "could not find any element for network simulator"); - return WEBRTC_ERROR_NONE; - } - - if (!(netsim = __find_element_in_bin(bin, DEFAULT_ELEMENT_NETWORK_SIMULATOR))) { - LOG_ERROR("could not find any element for network simulator"); - return WEBRTC_ERROR_INVALID_OPERATION; - } - g_object_set(G_OBJECT(netsim), "drop-probability", probability, NULL); - - LOG_INFO("webrtc[%p] source_id[%u] probability[%f] applies to [%s]", webrtc, source_id, probability, GST_ELEMENT_NAME(netsim)); - - return WEBRTC_ERROR_NONE; -} - -int _get_rtp_packet_drop_probability(webrtc_s *webrtc, unsigned int source_id, float *probability) -{ - webrtc_gst_slot_s *source; - GstElement *netsim; - GstBin *bin; - - RET_VAL_IF(webrtc == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "webrtc is NULL"); - RET_VAL_IF(source_id == 0, WEBRTC_ERROR_INVALID_PARAMETER, "source_id is 0"); - RET_VAL_IF(probability == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "probability is NULL"); - RET_VAL_IF((source = _get_slot_by_id(webrtc->gst.source_slots, source_id)) == NULL, WEBRTC_ERROR_INVALID_PARAMETER, "source is NULL"); - RET_VAL_IF(webrtc->ini.general.network_simulator == false, WEBRTC_ERROR_INVALID_OPERATION, "network simulator is disabled, please check the ini"); - bin = (source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE) ? GST_BIN(source->filesrc_pipeline) : GST_BIN(source->bin); - RET_VAL_IF(bin == NULL, WEBRTC_ERROR_INVALID_OPERATION, "bin is NULL"); - - if (source->type == WEBRTC_MEDIA_SOURCE_TYPE_FILE) { - int av_idx = 0; - for (av_idx = 0; av_idx < AV_IDX_MAX; av_idx++) { - if ((netsim = gst_bin_get_by_name(bin, _av_tbl[av_idx].network_simulator_name))) - break; - } - - } else { - netsim = __find_element_in_bin(bin, DEFAULT_ELEMENT_NETWORK_SIMULATOR); - } - RET_VAL_IF(!netsim, WEBRTC_ERROR_INVALID_OPERATION, "could not find any element for network simulator"); - - g_object_get(G_OBJECT(netsim), "drop-probability", (gfloat *)probability, NULL); - LOG_INFO("webrtc[%p] source_id[%u] probability[%f]", webrtc, source_id, *probability); - - return WEBRTC_ERROR_NONE; -} - static void __remove_filesrc_pad_block_foreach_cb(gpointer key, gpointer value, gpointer user_data) { webrtc_gst_slot_s *source = (webrtc_gst_slot_s *)value; diff --git a/test/webrtc_test.c b/test/webrtc_test.c index ded8de3e..413ae4b2 100644 --- a/test/webrtc_test.c +++ b/test/webrtc_test.c @@ -101,8 +101,6 @@ enum { CURRENT_STATUS_SET_MEDIA_PATH_TO_MEDIA_FILE_SOURCE, CURRENT_STATUS_MEDIA_SOURCE_SET_FILE_LOOPING, CURRENT_STATUS_MEDIA_SOURCE_GET_FILE_LOOPING, - CURRENT_STATUS_MEDIA_SOURCE_SET_RTP_PACKET_DROP_PROBABILITY, - CURRENT_STATUS_MEDIA_SOURCE_GET_RTP_PACKET_DROP_PROBABILITY, CURRENT_STATUS_CREATE_PRIVATE_SIGNALING_SERVER, CURRENT_STATUS_CONNECT_TO_PRIVATE_SIGNALING_SERVER, CURRENT_STATUS_MUTE_MEDIA_SOURCE, @@ -3338,27 +3336,6 @@ static void _webrtc_media_source_get_file_looping(int index, unsigned int source g_print("webrtc_file_source_get_looping() success, source_id[%u] looping_state[%u]\n", source_id, looping_state); } -static void _webrtc_media_source_set_rtp_packet_drop_probability(unsigned int source_id, float probability) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_media_source_set_rtp_packet_drop_probability(g_conns[0].webrtc, source_id, probability); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_media_source_set_rtp_packet_drop_probability() success, source_id[%u] probability[%f]\n", source_id, probability); -} - -static void _webrtc_media_source_get_rtp_packet_drop_probability(unsigned int source_id) -{ - int ret = WEBRTC_ERROR_NONE; - float probability; - - ret = webrtc_media_source_get_rtp_packet_drop_probability(g_conns[0].webrtc, source_id, &probability); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_media_source_get_rtp_packet_drop_probability() success, source_id[%u] probability[%f]\n", source_id, probability); -} - static void __close_websocket(signaling_server_s *ss) { RET_IF(!ss, "ss is NULL"); @@ -4074,12 +4051,6 @@ void _interpret_main_menu(char *cmd) } else if (strncmp(cmd, "gfl", 3) == 0) { g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_FILE_LOOPING; - } else if (strncmp(cmd, "sdp", 3) == 0) { - g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_RTP_PACKET_DROP_PROBABILITY; - - } else if (strncmp(cmd, "gdp", 3) == 0) { - g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_RTP_PACKET_DROP_PROBABILITY; - } else { g_print("unknown menu \n"); } @@ -4166,8 +4137,6 @@ void display_sub_basic() g_print("sfl. *Set file source looping\t"); g_print("gfl. *Set file source looping\n"); g_print("sf. Set media format to media packet source\n"); - g_print("sdp. *Set RTP packet drop probility\t"); - g_print("gdp. *Get RTP packet drop probility\n"); g_print("dt. Set display type\t"); g_print("dm. Set display mode\t"); g_print("gm. Get display mode\n"); @@ -4347,16 +4316,6 @@ static void displaymenu() if (g_cnt == 0) g_print("*** input source id.\n"); - } else if (g_menu_state == CURRENT_STATUS_MEDIA_SOURCE_SET_RTP_PACKET_DROP_PROBABILITY) { - if (g_cnt == 0) - g_print("*** input source id.\n"); - else if (g_cnt == 1) - g_print("*** input drop probability.(0 ~ 1.0)\n"); - - } else if (g_menu_state == CURRENT_STATUS_MEDIA_SOURCE_GET_RTP_PACKET_DROP_PROBABILITY) { - if (g_cnt == 0) - g_print("*** input source id.\n"); - } else if (g_menu_state == CURRENT_STATUS_DATA_CHANNEL_SEND_STRING) { g_print("*** input string to send.\n"); @@ -4859,31 +4818,6 @@ static void interpret(char *cmd) reset_menu_state(); break; } - case CURRENT_STATUS_MEDIA_SOURCE_SET_RTP_PACKET_DROP_PROBABILITY: { - static unsigned int id; - switch (g_cnt) { - case 0: - value = atoi(cmd); - id = value; - g_cnt++; - break; - case 1: { - float fvalue = strtof(cmd, NULL); - _webrtc_media_source_set_rtp_packet_drop_probability(id, fvalue); - id = 0; - g_cnt = 0; - reset_menu_state(); - break; - } - } - break; - } - case CURRENT_STATUS_MEDIA_SOURCE_GET_RTP_PACKET_DROP_PROBABILITY: { - value = atoi(cmd); - _webrtc_media_source_get_rtp_packet_drop_probability(value); - reset_menu_state(); - break; - } case CURRENT_STATUS_CREATE_PRIVATE_SIGNALING_SERVER: { value = atoi(cmd); _webrtc_signaling_server_create(value);