From: Sangchul Lee Date: Tue, 19 Apr 2022 01:16:05 +0000 (+0900) Subject: webrtc_test: Rearrange menu items X-Git-Tag: submit/tizen/20220426.020921~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=770f8c42a4748fb6872f663b549a703ab7ea8318;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_test: Rearrange menu items Some menu items to set/unset each callback are removed. - "sac" or "uac" can be used instead of these. Each menu status enum value has type bits. Function and enum names regarding file source are changed. [Version] 0.3.87 [Issue Type] Cleanup/Refactoring Change-Id: Ibfe569120d531bc2e1078f9db2c836fe73ed6b75 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index 929be195..d481c370 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.86 +Version: 0.3.87 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/webrtc_test.c b/test/webrtc_test.c index 2b520d4b..f452d84c 100644 --- a/test/webrtc_test.c +++ b/test/webrtc_test.c @@ -61,58 +61,69 @@ do { \ #define USE_GSTBUFFER_WITHOUT_COPY true #define FONT_SIZE 30 +#define TEST_MENU_WEBRTC_COMMON 0x00001000 +#define TEST_MENU_WEBRTC_MEDIA_SOURCE 0x00002000 +#define TEST_MENU_WEBRTC_MEDIA_RENDER 0x00004000 +#define TEST_MENU_WEBRTC_DATA_CHANNEL 0x00008000 +#define TEST_MENU_APP_SIGNALING 0x0000F000 + enum { CURRENT_STATUS_MAINMENU, - CURRENT_STATUS_ADD_MEDIA_SOURCE, - CURRENT_STATUS_REMOVE_MEDIA_SOURCE, - CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION, - CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION, - CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE, - CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE, - CURRENT_STATUS_MEDIA_SOURCE_SET_MUTE, - CURRENT_STATUS_MEDIA_SOURCE_GET_MUTE, - CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION, - CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION, - CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_FRAMERATE, - CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_FRAMERATE, - CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_BUFFER_STATE_CHANGED_CB, - CURRENT_STATUS_MEDIA_PACKET_SOURCE_UNSET_BUFFER_STATE_CHANGED_CB, - CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_FORMAT, - CURRENT_STATUS_SET_DISPLAY_TYPE, - CURRENT_STATUS_SET_DISPLAY_MODE, - CURRENT_STATUS_GET_DISPLAY_MODE, - CURRENT_STATUS_SET_DISPLAY_VISIBLE, - CURRENT_STATUS_GET_DISPLAY_VISIBLE, - CURRENT_STATUS_MEDIA_SOURCE_SET_AUDIO_LOOPBACK, - CURRENT_STATUS_MEDIA_SOURCE_UNSET_AUDIO_LOOPBACK, - CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_LOOPBACK, - CURRENT_STATUS_MEDIA_SOURCE_UNSET_VIDEO_LOOPBACK, - CURRENT_STATUS_DATA_CHANNEL_SEND_STRING, - CURRENT_STATUS_DATA_CHANNEL_SEND_STRING_AS_BYTES, - CURRENT_STATUS_DATA_CHANNEL_SEND_FILE, - CURRENT_STATUS_DATA_CHANNEL_SET_BUFFERED_AMOUNT_LOW_CB, - CURRENT_STATUS_SET_STUN_SERVER, - CURRENT_STATUS_ADD_TURN_SERVER, - CURRENT_STATUS_SET_BUNDLE_POLICY, - CURRENT_STATUS_SET_ICE_TRANSPORT_POLICY, - CURRENT_STATUS_SET_LOCAL_DESCRIPTION, - CURRENT_STATUS_SET_RTP_PACKET_DROP_PROBABILITY, - CURRENT_STATUS_GET_RTP_PACKET_DROP_PROBABILITY, - CURRENT_STATUS_SETTING_SIGNALING_SERVER, - CURRENT_STATUS_SETTING_PROXY, - CURRENT_STATUS_REQUEST_SESSION, - CURRENT_STATUS_REQUEST_JOIN_ROOM, - CURRENT_STATUS_SEND_LOCAL_DESCRIPTION, - CURRENT_STATUS_START_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE, - CURRENT_STATUS_STOP_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE, - 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_CREATE_PRIVATE_SIGNALING_SERVER, - CURRENT_STATUS_CONNECT_TO_PRIVATE_SIGNALING_SERVER, - CURRENT_STATUS_SET_CROP_SCREEN_SOURCE, - CURRENT_STATUS_UNSET_CROP_SCREEN_SOURCE, CURRENT_STATUS_TERMINATE, + /* webrtc common */ + CURRENT_STATUS_SET_STUN_SERVER = TEST_MENU_WEBRTC_COMMON | 0x01, + CURRENT_STATUS_ADD_TURN_SERVER = TEST_MENU_WEBRTC_COMMON | 0x02, + CURRENT_STATUS_SET_BUNDLE_POLICY = TEST_MENU_WEBRTC_COMMON | 0x03, + CURRENT_STATUS_SET_ICE_TRANSPORT_POLICY = TEST_MENU_WEBRTC_COMMON | 0x04, + CURRENT_STATUS_SET_LOCAL_DESCRIPTION = TEST_MENU_WEBRTC_COMMON | 0x05, + CURRENT_STATUS_SET_RTP_PACKET_DROP_PROBABILITY = TEST_MENU_WEBRTC_COMMON | 0x06, + CURRENT_STATUS_GET_RTP_PACKET_DROP_PROBABILITY = TEST_MENU_WEBRTC_COMMON | 0x07, + /* webrtc media source */ + CURRENT_STATUS_ADD_MEDIA_SOURCE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x01, + CURRENT_STATUS_REMOVE_MEDIA_SOURCE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x02, + CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x03, + CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x04, + CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x05, + CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x06, + CURRENT_STATUS_MEDIA_SOURCE_SET_MUTE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x07, + CURRENT_STATUS_MEDIA_SOURCE_GET_MUTE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x08, + CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x09, + CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x0A, + CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_FRAMERATE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x0B, + CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_FRAMERATE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x0C, + CURRENT_STATUS_FILE_SOURCE_SET_PATH = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x0D, + CURRENT_STATUS_FILE_SOURCE_SET_LOOPING = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x0E, + CURRENT_STATUS_FILE_SOURCE_GET_LOOPING = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x0F, + CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_FORMAT = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x10, + CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_BUFFER_STATE_CHANGED_CB = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x11, + CURRENT_STATUS_MEDIA_PACKET_SOURCE_UNSET_BUFFER_STATE_CHANGED_CB = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x12, + CURRENT_STATUS_START_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x13, + CURRENT_STATUS_STOP_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x14, + CURRENT_STATUS_SET_CROP_SCREEN_SOURCE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x15, + CURRENT_STATUS_UNSET_CROP_SCREEN_SOURCE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x16, + /* webrtc media render */ + CURRENT_STATUS_SET_DISPLAY_TYPE = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x01, + CURRENT_STATUS_SET_DISPLAY_MODE = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x02, + CURRENT_STATUS_GET_DISPLAY_MODE = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x03, + CURRENT_STATUS_SET_DISPLAY_VISIBLE = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x04, + CURRENT_STATUS_GET_DISPLAY_VISIBLE = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x05, + CURRENT_STATUS_MEDIA_SOURCE_SET_AUDIO_LOOPBACK = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x06, + CURRENT_STATUS_MEDIA_SOURCE_UNSET_AUDIO_LOOPBACK = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x07, + CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_LOOPBACK = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x08, + CURRENT_STATUS_MEDIA_SOURCE_UNSET_VIDEO_LOOPBACK = TEST_MENU_WEBRTC_MEDIA_RENDER | 0x09, + /* webrtc data channel */ + CURRENT_STATUS_DATA_CHANNEL_SEND_STRING = TEST_MENU_WEBRTC_DATA_CHANNEL | 0x01, + CURRENT_STATUS_DATA_CHANNEL_SEND_STRING_AS_BYTES = TEST_MENU_WEBRTC_DATA_CHANNEL | 0x02, + CURRENT_STATUS_DATA_CHANNEL_SEND_FILE = TEST_MENU_WEBRTC_DATA_CHANNEL | 0x03, + CURRENT_STATUS_DATA_CHANNEL_SET_BUFFERED_AMOUNT_LOW_CB = TEST_MENU_WEBRTC_DATA_CHANNEL | 0x04, + /* app. setting & signaling */ + CURRENT_STATUS_SETTING_SIGNALING_SERVER = TEST_MENU_APP_SIGNALING | 0x01, + CURRENT_STATUS_SETTING_PROXY = TEST_MENU_APP_SIGNALING | 0x02, + CURRENT_STATUS_REQUEST_SESSION = TEST_MENU_APP_SIGNALING | 0x03, + CURRENT_STATUS_REQUEST_JOIN_ROOM = TEST_MENU_APP_SIGNALING | 0x04, + CURRENT_STATUS_SEND_LOCAL_DESCRIPTION = TEST_MENU_APP_SIGNALING | 0x05, + CURRENT_STATUS_CREATE_PRIVATE_SIGNALING_SERVER = TEST_MENU_APP_SIGNALING | 0x06, + CURRENT_STATUS_CONNECT_TO_PRIVATE_SIGNALING_SERVER = TEST_MENU_APP_SIGNALING | 0x07, }; enum { @@ -1750,26 +1761,6 @@ static void __data_channel_cb(webrtc_h webrtc, webrtc_data_channel_h channel, vo g_print("__data_channel_cb() is called, but g_recv_channels is full\n"); } -static void _webrtc_set_data_channel_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_set_data_channel_cb(g_conns[index].webrtc, __data_channel_cb, &g_conns[index]); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_set_data_channel_cb() success\n"); -} - -static void _webrtc_unset_data_channel_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_unset_data_channel_cb(g_conns[index].webrtc); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_unset_data_channel_cb() success\n"); -} - static void _webrtc_data_channel_set_buffered_amount_low_cb(int index, unsigned int threshold) { int ret = WEBRTC_ERROR_NONE; @@ -1908,26 +1899,6 @@ static void __error_cb(webrtc_h webrtc, webrtc_error_e error, webrtc_state_e sta webrtc, error, state, user_data); } -static void _webrtc_set_error_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_set_error_cb(g_conns[index].webrtc, __error_cb, g_conns[index].webrtc); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_set_error_cb() success\n"); -} - -static void _webrtc_unset_error_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_unset_error_cb(g_conns[index].webrtc); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_unset_error_cb() success\n"); -} - static void _websocket_connection_send_text_for_room(connection_s *conn, int remote_peer_id, const char *message) { gchar *message_for_room; @@ -1967,51 +1938,11 @@ static void __state_changed_cb(webrtc_h webrtc, webrtc_state_e previous, webrtc_ } } -static void _webrtc_set_state_changed_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_set_state_changed_cb(g_conns[index].webrtc, __state_changed_cb, &g_conns[index]); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_set_state_changed_cb() success\n"); -} - -static void _webrtc_unset_state_changed_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_unset_state_changed_cb(g_conns[index].webrtc); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_unset_state_changed_cb() success\n"); -} - static void __negotiation_needed_cb(webrtc_h webrtc, void *user_data) { g_print("__negotiation_needed_cb() is invoked, webrtc[%p], user_data[%p]\n", webrtc, user_data); } -static void _webrtc_set_negotiation_needed_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_set_negotiation_needed_cb(g_conns[index].webrtc, __negotiation_needed_cb, g_conns[index].webrtc); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_set_negotiation_needed_cb() success\n"); -} - -static void _webrtc_unset_negotiation_needed_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_unset_negotiation_needed_cb(g_conns[index].webrtc); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_unset_negotiation_needed_cb() success\n"); -} - static void __signaling_message_cb(webrtc_signaling_message_type_e type, const char *message, void *user_data) { connection_s *conn = (connection_s *)user_data; @@ -2120,26 +2051,6 @@ static void __ice_candidate_cb(webrtc_h webrtc, const char *candidate, void *use } } -static void _webrtc_set_ice_candidate_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_set_ice_candidate_cb(g_conns[index].webrtc, __ice_candidate_cb, &g_conns[index]); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_set_ice_candidate_cb() success\n"); -} - -static void _webrtc_unset_ice_candidate_cb(int index) -{ - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_unset_ice_candidate_cb(g_conns[index].webrtc); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); - - g_print("webrtc_unset_ice_candidate_cb() success\n"); -} - static void __peer_connection_state_change_cb(webrtc_h webrtc, webrtc_peer_connection_state_e state, void *user_data) { g_print("__peer_connection_state_change_cb() is invoked, state[%d]\n", state); @@ -2170,58 +2081,54 @@ static void __ice_connection_state_change_cb(webrtc_h webrtc, webrtc_ice_connect static void _webrtc_set_all_negotiation_state_change_cbs(int index) { - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_set_peer_connection_state_change_cb(g_conns[index].webrtc, __peer_connection_state_change_cb, &g_conns[index]); + int ret = webrtc_set_peer_connection_state_change_cb(g_conns[index].webrtc, __peer_connection_state_change_cb, &g_conns[index]); if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_set_peer_connection_state_change_cb()\n"); + g_print("failed to webrtc_set_peer_connection_state_change_cb(), ret[0x%x]\n", ret); else g_print("webrtc_set_peer_connection_state_change_cb() success\n"); ret = webrtc_set_signaling_state_change_cb(g_conns[index].webrtc, __signaling_state_change_cb, &g_conns[index]); if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_set_signaling_state_change_cb()\n"); + g_print("failed to webrtc_set_signaling_state_change_cb(), ret[0x%x]\n", ret); else g_print("webrtc_set_signaling_state_change_cb() success\n"); ret = webrtc_set_ice_gathering_state_change_cb(g_conns[index].webrtc, __ice_gathering_state_change_cb, &g_conns[index]); if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_set_ice_gathering_state_change_cb()\n"); + g_print("failed to webrtc_set_ice_gathering_state_change_cb(), ret[0x%x]\n", ret); else g_print("webrtc_set_ice_gathering_state_change_cb() success\n"); ret = webrtc_set_ice_connection_state_change_cb(g_conns[index].webrtc, __ice_connection_state_change_cb, &g_conns[index]); if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_set_ice_connection_state_change_cb()\n"); + g_print("failed to webrtc_set_ice_connection_state_change_cb(), ret[0x%x]\n", ret); else g_print("webrtc_set_ice_connection_state_change_cb() success\n"); } static void _webrtc_unset_all_negotiation_state_change_cbs(int index) { - int ret = WEBRTC_ERROR_NONE; - - ret = webrtc_unset_peer_connection_state_change_cb(g_conns[index].webrtc); + int ret = webrtc_unset_peer_connection_state_change_cb(g_conns[index].webrtc); if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_unset_peer_connection_state_change_cb()\n"); + g_print("failed to webrtc_unset_peer_connection_state_change_cb(), ret[0x%x]\n", ret); else g_print("webrtc_unset_peer_connection_state_change_cb() success\n"); ret = webrtc_unset_signaling_state_change_cb(g_conns[index].webrtc); if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_unset_signaling_state_change_cb()\n"); + g_print("failed to webrtc_unset_signaling_state_change_cb(), ret[0x%x]\n", ret); else g_print("webrtc_unset_signaling_state_change_cb() success\n"); ret = webrtc_unset_ice_gathering_state_change_cb(g_conns[index].webrtc); if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_unset_ice_gathering_state_change_cb()\n"); + g_print("failed to webrtc_unset_ice_gathering_state_change_cb(), ret[0x%x]\n", ret); else g_print("webrtc_unset_ice_gathering_state_change_cb() success\n"); ret = webrtc_unset_ice_connection_state_change_cb(g_conns[index].webrtc); if (ret != WEBRTC_ERROR_NONE) - g_print("failed to webrtc_unset_ice_connection_state_change_cb()\n"); + g_print("failed to webrtc_unset_ice_connection_state_change_cb(), ret[0x%x]\n", ret); else g_print("webrtc_unset_ice_connection_state_change_cb() success\n"); } @@ -2322,24 +2229,88 @@ static void __track_added_cb(webrtc_h webrtc, webrtc_media_type_e type, unsigned } } -static void _webrtc_set_track_added_cb(int index) +static void _webrtc_set_all_basic_cbs(int index) { - int ret = WEBRTC_ERROR_NONE; + /* COMMON */ + int ret = webrtc_set_error_cb(g_conns[index].webrtc, __error_cb, g_conns[index].webrtc); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_set_error_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_set_error_cb() success\n"); + ret = webrtc_set_state_changed_cb(g_conns[index].webrtc, __state_changed_cb, &g_conns[index]); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_set_state_changed_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_set_state_changed_cb() success\n"); + + ret = webrtc_set_negotiation_needed_cb(g_conns[index].webrtc, __negotiation_needed_cb, g_conns[index].webrtc); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_set_negotiation_needed_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_set_negotiation_needed_cb() success\n"); + + ret = webrtc_set_ice_candidate_cb(g_conns[index].webrtc, __ice_candidate_cb, &g_conns[index]); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_set_ice_candidate_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_set_ice_candidate_cb() success\n"); + + /* MEDIA RENDER */ ret = webrtc_set_track_added_cb(g_conns[index].webrtc, __track_added_cb, &g_conns[index]); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_set_track_added_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_set_track_added_cb() success\n"); - g_print("webrtc_set_track_added_cb() success\n"); + /* DATA CHANNEL */ + ret = webrtc_set_data_channel_cb(g_conns[index].webrtc, __data_channel_cb, &g_conns[index]); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_set_data_channel_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_set_data_channel_cb() success\n"); } -static void _webrtc_unset_track_added_cb(int index) +static void _webrtc_unset_all_basic_cbs(int index) { - int ret = WEBRTC_ERROR_NONE; + /* COMMON */ + int ret = webrtc_unset_error_cb(g_conns[index].webrtc); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_unset_error_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_unset_error_cb() success\n"); + ret = webrtc_unset_state_changed_cb(g_conns[index].webrtc); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_unset_state_changed_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_unset_state_changed_cb() success\n"); + + ret = webrtc_unset_negotiation_needed_cb(g_conns[index].webrtc); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_unset_negotiation_needed_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_unset_negotiation_needed_cb() success\n"); + + ret = webrtc_unset_ice_candidate_cb(g_conns[index].webrtc); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_unset_ice_candidate_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_unset_ice_candidate_cb() success\n"); + + /* MEDIA RENDER */ ret = webrtc_unset_track_added_cb(g_conns[index].webrtc); - RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_unset_track_added_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_unset_track_added_cb() success\n"); - g_print("webrtc_unset_track_added_cb() success\n"); + /* DATA CHANNEL */ + ret = webrtc_unset_data_channel_cb(g_conns[index].webrtc); + if (ret != WEBRTC_ERROR_NONE) + g_print("failed to webrtc_unset_data_channel_cb(), ret[0x%x]\n", ret); + else + g_print("webrtc_unset_data_channel_cb() success\n"); } static void __encoded_frame_cb(webrtc_h webrtc, webrtc_media_type_e type, unsigned int track_id, media_packet_h packet, void *user_data) @@ -3764,7 +3735,7 @@ static void _set_media_path(int index, unsigned int source_id, const char *path) g_print("webrtc_file_source_set_path() success, source_id[%d]\n", source_id); } -static void _webrtc_media_source_set_file_looping(int index, unsigned int source_id, bool looping) +static void _webrtc_file_source_set_looping(int index, unsigned int source_id, bool looping) { int ret = WEBRTC_ERROR_NONE; @@ -3774,7 +3745,7 @@ static void _webrtc_media_source_set_file_looping(int index, unsigned int source g_print("webrtc_file_source_set_looping() success, source_id[%u] looping_state[%u]\n", source_id, looping); } -static void _webrtc_media_source_get_file_looping(int index, unsigned int source_id) +static void _webrtc_file_source_get_looping(int index, unsigned int source_id) { int ret = WEBRTC_ERROR_NONE; bool looping_state; @@ -3835,12 +3806,8 @@ static void __auto_configure_add_peer(gchar *peer_id, bool is_offer) g_conns[i].room_source_type = g_conns[0].room_source_type; _webrtc_create(i); - _webrtc_set_error_cb(i); - _webrtc_set_state_changed_cb(i); - _webrtc_set_ice_candidate_cb(i); - _webrtc_set_negotiation_needed_cb(i); + _webrtc_set_all_basic_cbs(i); _webrtc_set_all_negotiation_state_change_cbs(i); - _webrtc_set_data_channel_cb(i); _webrtc_create_data_channel(i); switch (g_conns[i].room_source_type) { @@ -3864,7 +3831,6 @@ static void __auto_configure_add_peer(gchar *peer_id, bool is_offer) } _webrtc_start(i); - _webrtc_set_track_added_cb(i); _webrtc_set_display_type(i, WEBRTC_DISPLAY_TYPE_EVAS); return; @@ -4220,51 +4186,51 @@ static void change_menu_state_1(char *cmd) if (!cmd) return; - if (strncmp(cmd, "c", 1) == 0) { + if (strncmp(cmd, "c", 1) == 0) _webrtc_create(0); - } else if (strncmp(cmd, "a", 1) == 0) { + else if (strncmp(cmd, "a", 1) == 0) g_menu_state = CURRENT_STATUS_ADD_MEDIA_SOURCE; - } else if (strncmp(cmd, "r", 1) == 0) { + else if (strncmp(cmd, "r", 1) == 0) g_menu_state = CURRENT_STATUS_REMOVE_MEDIA_SOURCE; - } else if (strncmp(cmd, "p", 1) == 0) { + else if (strncmp(cmd, "p", 1) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_PAUSE; - } else if (strncmp(cmd, "o", 1) == 0) { + else if (strncmp(cmd, "o", 1) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_PAUSE; - } else if (strncmp(cmd, "v", 1) == 0) { + else if (strncmp(cmd, "v", 1) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_RESOLUTION; - } else if (strncmp(cmd, "l", 1) == 0) { + else if (strncmp(cmd, "l", 1) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_RESOLUTION; - } else if (strncmp(cmd, "f", 1) == 0) { + else if (strncmp(cmd, "f", 1) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_FRAMERATE; - } else if (strncmp(cmd, "m", 1) == 0) { + else if (strncmp(cmd, "m", 1) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_VIDEO_FRAMERATE; - } else if (strncmp(cmd, "s", 1) == 0) { + else if (strncmp(cmd, "s", 1) == 0) _webrtc_start(0); - } else if (strncmp(cmd, "t", 1) == 0) { + else if (strncmp(cmd, "t", 1) == 0) _webrtc_stop(0); - } else if (strncmp(cmd, "d", 1) == 0) { + else if (strncmp(cmd, "d", 1) == 0) _webrtc_destroy(0); - } else if (strncmp(cmd, "g", 1) == 0) { + else if (strncmp(cmd, "g", 1) == 0) _webrtc_get_state(0); - } else if (strncmp(cmd, "q", 1) == 0) { + else if (strncmp(cmd, "q", 1) == 0) quit_program(); - } else { + else g_print("%s() > unknown menu[%s]\n", __FUNCTION__, cmd); - } + } static void change_menu_state_2(char *cmd) @@ -4272,174 +4238,138 @@ static void change_menu_state_2(char *cmd) if (!cmd) return; - if (strncmp(cmd, "sf", 2) == 0) { + if (strncmp(cmd, "sf", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_FORMAT; - } else if (strncmp(cmd, "td", 2) == 0) { + else if (strncmp(cmd, "td", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_TRANSCEIVER_DIRECTION; - } else if (strncmp(cmd, "gd", 2) == 0) { + else if (strncmp(cmd, "gd", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_TRANSCEIVER_DIRECTION; - } else if (strncmp(cmd, "mu", 2) == 0) { + else if (strncmp(cmd, "mu", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_MUTE; - } else if (strncmp(cmd, "mg", 2) == 0) { + else if (strncmp(cmd, "mg", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_MUTE; - } else if (strncmp(cmd, "dt", 2) == 0) { + else if (strncmp(cmd, "dt", 2) == 0) g_menu_state = CURRENT_STATUS_SET_DISPLAY_TYPE; - } else if (strncmp(cmd, "dm", 2) == 0) { + else if (strncmp(cmd, "dm", 2) == 0) g_menu_state = CURRENT_STATUS_SET_DISPLAY_MODE; - } else if (strncmp(cmd, "gm", 2) == 0) { + else if (strncmp(cmd, "gm", 2) == 0) g_menu_state = CURRENT_STATUS_GET_DISPLAY_MODE; - } else if (strncmp(cmd, "dv", 2) == 0) { + else if (strncmp(cmd, "dv", 2) == 0) g_menu_state = CURRENT_STATUS_SET_DISPLAY_VISIBLE; - } else if (strncmp(cmd, "gv", 2) == 0) { + else if (strncmp(cmd, "gv", 2) == 0) g_menu_state = CURRENT_STATUS_GET_DISPLAY_VISIBLE; - } else if (strncmp(cmd, "al", 2) == 0) { + else if (strncmp(cmd, "al", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_AUDIO_LOOPBACK; - } else if (strncmp(cmd, "vl", 2) == 0) { + else if (strncmp(cmd, "vl", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_VIDEO_LOOPBACK; - } else if (strncmp(cmd, "cd", 2) == 0) { + else if (strncmp(cmd, "cd", 2) == 0) _webrtc_create_data_channel(0); - } else if (strncmp(cmd, "dd", 2) == 0) { + else if (strncmp(cmd, "dd", 2) == 0) _webrtc_destroy_data_channel(0); - } else if (strncmp(cmd, "dl", 2) == 0) { + else if (strncmp(cmd, "dl", 2) == 0) _webrtc_data_channel_get_label(0); - } else if (strncmp(cmd, "sz", 2) == 0) { - _webrtc_set_data_channel_cb(0); - - } else if (strncmp(cmd, "uz", 2) == 0) { - _webrtc_unset_data_channel_cb(0); - - } else if (strncmp(cmd, "zs", 2) == 0) { + else if (strncmp(cmd, "zs", 2) == 0) g_menu_state = CURRENT_STATUS_DATA_CHANNEL_SEND_STRING; - } else if (strncmp(cmd, "zb", 2) == 0) { + else if (strncmp(cmd, "zb", 2) == 0) g_menu_state = CURRENT_STATUS_DATA_CHANNEL_SEND_STRING_AS_BYTES; - } else if (strncmp(cmd, "zf", 2) == 0) { + else if (strncmp(cmd, "zf", 2) == 0) g_menu_state = CURRENT_STATUS_DATA_CHANNEL_SEND_FILE; - } else if (strncmp(cmd, "ba", 2) == 0) { + else if (strncmp(cmd, "ba", 2) == 0) _webrtc_data_channel_get_buffered_amount(0); - } else if (strncmp(cmd, "se", 2) == 0) { - _webrtc_set_error_cb(0); - - } else if (strncmp(cmd, "ue", 2) == 0) { - _webrtc_unset_error_cb(0); - - } else if (strncmp(cmd, "sc", 2) == 0) { - _webrtc_set_state_changed_cb(0); - - } else if (strncmp(cmd, "us", 2) == 0) { - _webrtc_unset_state_changed_cb(0); - - } else if (strncmp(cmd, "sn", 2) == 0) { - _webrtc_set_negotiation_needed_cb(0); - - } else if (strncmp(cmd, "un", 2) == 0) { - _webrtc_unset_negotiation_needed_cb(0); - - } else if (strncmp(cmd, "si", 2) == 0) { - _webrtc_set_ice_candidate_cb(0); - - } else if (strncmp(cmd, "ui", 2) == 0) { - _webrtc_unset_ice_candidate_cb(0); - - } else if (strncmp(cmd, "sk", 2) == 0) { - _webrtc_set_track_added_cb(0); - - } else if (strncmp(cmd, "uk", 2) == 0) { - _webrtc_unset_track_added_cb(0); - - } else if (strncmp(cmd, "sa", 2) == 0) { + else if (strncmp(cmd, "sa", 2) == 0) _webrtc_set_encoded_audio_frame_cb(0); - } else if (strncmp(cmd, "ua", 2) == 0) { + else if (strncmp(cmd, "ua", 2) == 0) _webrtc_unset_encoded_audio_frame_cb(0); - } else if (strncmp(cmd, "sv", 2) == 0) { + else if (strncmp(cmd, "sv", 2) == 0) _webrtc_set_encoded_video_frame_cb(0); - } else if (strncmp(cmd, "uv", 2) == 0) { + else if (strncmp(cmd, "uv", 2) == 0) _webrtc_unset_encoded_video_frame_cb(0); - } else if (strncmp(cmd, "sm", 2) == 0) { + else if (strncmp(cmd, "sm", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_PACKET_SOURCE_SET_BUFFER_STATE_CHANGED_CB; - } else if (strncmp(cmd, "um", 2) == 0) { + else if (strncmp(cmd, "um", 2) == 0) g_menu_state = CURRENT_STATUS_MEDIA_PACKET_SOURCE_UNSET_BUFFER_STATE_CHANGED_CB; - } else if (strncmp(cmd, "co", 2) == 0) { + else if (strncmp(cmd, "co", 2) == 0) _webrtc_create_offer(&g_conns[0], false); - } else if (strncmp(cmd, "ca", 2) == 0) { + else if (strncmp(cmd, "ca", 2) == 0) _webrtc_create_answer(&g_conns[0], false); - } else if (strncmp(cmd, "sl", 2) == 0) { + else if (strncmp(cmd, "sl", 2) == 0) g_menu_state = CURRENT_STATUS_SET_LOCAL_DESCRIPTION; - } else if (strncmp(cmd, "sr", 2) == 0) { + else if (strncmp(cmd, "sr", 2) == 0) _webrtc_set_remote_description(&g_conns[0]); - } else if (strncmp(cmd, "st", 2) == 0) { + else if (strncmp(cmd, "st", 2) == 0) g_menu_state = CURRENT_STATUS_SET_STUN_SERVER; - } else if (strncmp(cmd, "gt", 2) == 0) { + else if (strncmp(cmd, "gt", 2) == 0) _webrtc_get_stun_server(0); - } else if (strncmp(cmd, "su", 2) == 0) { + else if (strncmp(cmd, "su", 2) == 0) g_menu_state = CURRENT_STATUS_ADD_TURN_SERVER; - } else if (strncmp(cmd, "gu", 2) == 0) { + else if (strncmp(cmd, "gu", 2) == 0) _webrtc_get_turn_servers(0); - } else if (strncmp(cmd, "ss", 2) == 0) { + else if (strncmp(cmd, "ss", 2) == 0) g_menu_state = CURRENT_STATUS_SETTING_SIGNALING_SERVER; - } else if (strncmp(cmd, "px", 2) == 0) { + else if (strncmp(cmd, "px", 2) == 0) g_menu_state = CURRENT_STATUS_SETTING_PROXY; - } else if (strncmp(cmd, "cs", 2) == 0) { + else if (strncmp(cmd, "cs", 2) == 0) _connect_signaling_server(); - } else if (strncmp(cmd, "rs", 2) == 0) { + else if (strncmp(cmd, "rs", 2) == 0) g_menu_state = CURRENT_STATUS_REQUEST_SESSION; - } else if (strncmp(cmd, "rj", 2) == 0) { + else if (strncmp(cmd, "rj", 2) == 0) g_menu_state = CURRENT_STATUS_REQUEST_JOIN_ROOM; - } else if (strncmp(cmd, "sd", 2) == 0) { + else if (strncmp(cmd, "sd", 2) == 0) g_menu_state = CURRENT_STATUS_SEND_LOCAL_DESCRIPTION; - } else if (strncmp(cmd, "sp", 2) == 0) { + else if (strncmp(cmd, "sp", 2) == 0) g_menu_state = CURRENT_STATUS_START_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE; - } else if (strncmp(cmd, "tp", 2) == 0) { + else if (strncmp(cmd, "tp", 2) == 0) g_menu_state = CURRENT_STATUS_STOP_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE; - } else if (strncmp(cmd, "pa", 2) == 0) { - g_menu_state = CURRENT_STATUS_SET_MEDIA_PATH_TO_MEDIA_FILE_SOURCE; + else if (strncmp(cmd, "pa", 2) == 0) + g_menu_state = CURRENT_STATUS_FILE_SOURCE_SET_PATH; - } else if (strncmp(cmd, "ac", 2) == 0) { + else if (strncmp(cmd, "ac", 2) == 0) _webrtc_add_ice_candidate(&g_conns[0], NULL); - } else { + else g_print("%s() > unknown menu[%s]\n", __FUNCTION__, cmd); - } + } static void change_menu_state_3(char *cmd) @@ -4456,12 +4386,7 @@ static void change_menu_state_3(char *cmd) } else if (strncmp(cmd, "sac", 3) == 0) { int i; - _webrtc_set_error_cb(0); - _webrtc_set_state_changed_cb(0); - _webrtc_set_negotiation_needed_cb(0); - _webrtc_set_ice_candidate_cb(0); - _webrtc_set_track_added_cb(0); - _webrtc_set_data_channel_cb(0); + _webrtc_set_all_basic_cbs(0); _webrtc_set_all_negotiation_state_change_cbs(0); for (i = 0; i < MAX_MEDIA_PACKET_SOURCE_LEN; i++) { @@ -4469,12 +4394,17 @@ static void change_menu_state_3(char *cmd) _webrtc_media_packet_source_set_buffer_state_changed_cb(0, g_conns[0].packet_sources[i].source_id); } - } else if (strncmp(cmd, "san", 3) == 0) { - _webrtc_set_all_negotiation_state_change_cbs(0); + } else if (strncmp(cmd, "uac", 3) == 0) { + int i; - } else if (strncmp(cmd, "uan", 3) == 0) { + _webrtc_unset_all_basic_cbs(0); _webrtc_unset_all_negotiation_state_change_cbs(0); + for (i = 0; i < MAX_MEDIA_PACKET_SOURCE_LEN; i++) { + if (g_conns[0].packet_sources[i].source_id > 0) + _webrtc_media_packet_source_unset_buffer_state_changed_cb(0, g_conns[0].packet_sources[i].source_id); + } + } else if (strncmp(cmd, "gan", 3) == 0) { _webrtc_get_all_negotiation_states(0); @@ -4527,10 +4457,10 @@ static void change_menu_state_3(char *cmd) g_menu_state = CURRENT_STATUS_UNSET_CROP_SCREEN_SOURCE; } else if (strncmp(cmd, "sfl", 3) == 0) { - g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_SET_FILE_LOOPING; + g_menu_state = CURRENT_STATUS_FILE_SOURCE_SET_LOOPING; } else if (strncmp(cmd, "gfl", 3) == 0) { - g_menu_state = CURRENT_STATUS_MEDIA_SOURCE_GET_FILE_LOOPING; + g_menu_state = CURRENT_STATUS_FILE_SOURCE_GET_LOOPING; } else if (strncmp(cmd, "sbc", 3) == 0) { g_menu_state = CURRENT_STATUS_DATA_CHANNEL_SET_BUFFERED_AMOUNT_LOW_CB; @@ -4635,10 +4565,31 @@ static void display_main_menu(void) g_print("-----------------------------------------------------------------------------------------\n"); display_handle_status(0); g_print("c. Create\t"); - g_print("d. Destroy\n"); + g_print("d. Destroy\t"); g_print("s. Start\t"); - g_print("t. Stop\n"); + g_print("t. Stop\t\t"); g_print("g. Get state\n"); + g_print("sac. Set all callbacks\t"); + g_print("uac. Unset all callbacks\n"); + g_print("gan. Gets all the negotiation states\n"); + g_print("st. Set STUN server\t"); + g_print("gt. Get STUN server\t"); + g_print("su. Add TURN server\t"); + g_print("gu. Get TURN servers\n"); + g_print("sbp. Set bundle policy\t"); + g_print("gbp. Get bundle policy\n"); + g_print("stp. Set ICE transport policy\t"); + g_print("gtp. Get ICE transport policy\n"); + g_print("co. Create offer\t"); + g_print("ca. Create answer\n"); + g_print("coa. Create offer(async)\t"); + g_print("caa. Create answer(async)\n"); + g_print("sl. Set local description\t"); + g_print("sr. Set remote description\n"); + g_print("ac. Add ICE candidate\n"); + g_print("sdp. *Set RTP packet drop probability\t"); + g_print("gdp. *Get RTP packet drop probability\n"); + g_print("------------------------------------- Media Source --------------------------------------\n"); g_print("a. Add media source\t"); g_print("r. Remove media source\n"); g_print("p. Pause/play media source\t"); @@ -4651,12 +4602,15 @@ static void display_main_menu(void) g_print("m. Get video framerate\n"); g_print("td. Set transceiver direction\t"); g_print("gd. Get transceiver direction\n"); + g_print("pa. Set media path to file source\n"); + 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("sp. Start pushing packet to media packet source\t"); + g_print("tp. Stop pushing packet to media packet source\n"); g_print("scs. *Set crop screen source\t"); g_print("ucs. *Unset crop screen source\n"); - g_print("pa. *Set media path to file source\n"); - 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("------------------------------------- Media Render --------------------------------------\n"); g_print("dt. Set display type\t"); g_print("dm. Set display mode\t"); g_print("gm. Get display mode\n"); @@ -4666,8 +4620,10 @@ static void display_main_menu(void) g_print("ual. Unset audio loopback\n"); g_print("vl. Set video loopback\t"); g_print("uvl. Unset video loopback\n"); - g_print("sdp. *Set RTP packet drop probability\t"); - g_print("gdp. *Get RTP packet drop probability\n"); + g_print("sa. Set encoded audio frame callback\t"); + g_print("ua. Unset encoded audio frame callback\n"); + g_print("sv. Set encoded video frame callback\t"); + g_print("uv. Unset encoded video frame callback\n"); g_print("------------------------------------- Data Channel --------------------------------------\n"); g_print("cd. Create data channel\t"); g_print("dd. Destroy data channel\n"); @@ -4679,48 +4635,9 @@ static void display_main_menu(void) g_print("sbc. Set buffered amount low callback\t"); g_print("ubc. Unset buffered amount low callback\n"); g_print("gbt. Get buffered amount low threshold\n"); - g_print("------------------------------------- Stats ---------------------------------------------\n"); + g_print("---------------------------------------- Stats ------------------------------------------\n"); g_print("sts. Get stats\n"); - g_print("------------------------------------- Callbacks -----------------------------------------\n"); - g_print("sac. Set all callbacks below (except for the encoded frame callbacks)\n"); - g_print("san. Set all the negotiation state change callbacks\t"); - g_print("uan. Unset all the negotiation state change callbacks\n"); - g_print("gan. Gets all the negotiation states\n"); - g_print("se. Set error callback\t"); - g_print("ue. Unset error callback\n"); - g_print("sc. Set state changed callback\t"); - g_print("us. Unset state changed callback\n"); - g_print("sn. Set negotiation needed callback\t"); - g_print("un. Unset negotiation needed callback\n"); - g_print("si. Set ICE candidate callback\t"); - g_print("ui. Unset ICE candidate callback\n"); - g_print("sk. Set track added callback\t"); - g_print("uk. Unset track added callback\n"); - g_print("sa. Set encoded audio frame callback\t"); - g_print("ua. Unset encoded audio frame callback\n"); - g_print("sv. Set encoded video frame callback\t"); - g_print("uv. Unset encoded video frame callback\n"); - g_print("sz. Set data channel callback\t"); - g_print("uz. Unset data channel callback\n"); - g_print("sm. Set media packet source buffer state changed callback\n"); - g_print("um. Unset media packet source buffer state changed callback\n"); - g_print("------------------------------------- Negotiation ---------------------------------------\n"); - g_print("st. Set STUN server\t"); - g_print("gt. Get STUN server\n"); - g_print("su. Add TURN server\t"); - g_print("gu. Get TURN servers\n"); - g_print("sbp. Set bundle policy\t"); - g_print("gbp. Get bundle policy\n"); - g_print("stp. Set ICE transport policy\t"); - g_print("gtp. Get ICE transport policy\n"); - g_print("co. Create offer\t"); - g_print("ca. Create answer\n"); - g_print("coa. Create offer(async)\t"); - g_print("caa. Create answer(async)\n"); - g_print("sl. Set local description\t"); - g_print("sr. Set remote description\n"); - g_print("ac. Add ICE candidate\n"); - g_print("------------------------------------- App. Setting --------------------------------------\n"); + g_print("------------------------------- App. Setting & Signaling --------------------------------\n"); display_setting_status(); g_print("px. Set proxy URL\n"); g_print("ss. Set signaling server URL\n"); @@ -4728,9 +4645,6 @@ static void display_main_menu(void) g_print("rs. Request session of remote peer id\n"); g_print("rj. Request join room\n"); g_print("sd. Send local description\n"); - g_print("sp. Start pushing packet to media packet source\t"); - g_print("tp. Stop pushing packet to media packet source\n"); - g_print("-------------------------------- Private Signaling Server -------------------------------\n"); g_print("ssc. *Create signaling server\t"); g_print("ssd. *Destroy signaling server\n"); g_print("sss. *Start signaling server\t"); @@ -4845,13 +4759,13 @@ static void displaymenu(void) } else if (g_menu_state == CURRENT_STATUS_MEDIA_SOURCE_UNSET_VIDEO_LOOPBACK) { g_print("*** input source id.\n"); - } else if (g_menu_state == CURRENT_STATUS_MEDIA_SOURCE_SET_FILE_LOOPING) { + } else if (g_menu_state == CURRENT_STATUS_FILE_SOURCE_SET_LOOPING) { if (g_cnt == 0) g_print("*** input source id.\n"); else if (g_cnt == 1) g_print("*** input looping state.(1:true 0:false)\n"); - } else if (g_menu_state == CURRENT_STATUS_MEDIA_SOURCE_GET_FILE_LOOPING) { + } else if (g_menu_state == CURRENT_STATUS_FILE_SOURCE_GET_LOOPING) { if (g_cnt == 0) g_print("*** input source id.\n"); @@ -4948,7 +4862,7 @@ static void displaymenu(void) } else if (g_menu_state == CURRENT_STATUS_STOP_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE) { g_print("*** input media packet source id to stop pushing packet.\n"); - } else if (g_menu_state == CURRENT_STATUS_SET_MEDIA_PATH_TO_MEDIA_FILE_SOURCE) { + } else if (g_menu_state == CURRENT_STATUS_FILE_SOURCE_SET_PATH) { if (g_cnt == 0) g_print("*** input source id.\n"); else if (g_cnt == 1) @@ -5415,7 +5329,7 @@ static void interpret(char *cmd) reset_menu_state(); break; } - case CURRENT_STATUS_SET_MEDIA_PATH_TO_MEDIA_FILE_SOURCE: { + case CURRENT_STATUS_FILE_SOURCE_SET_PATH: { static unsigned int id; value = atoi(cmd); @@ -5433,7 +5347,7 @@ static void interpret(char *cmd) } break; } - case CURRENT_STATUS_MEDIA_SOURCE_SET_FILE_LOOPING: { + case CURRENT_STATUS_FILE_SOURCE_SET_LOOPING: { static unsigned int id; value = atoi(cmd); switch (g_cnt) { @@ -5442,7 +5356,7 @@ static void interpret(char *cmd) g_cnt++; break; case 1: - _webrtc_media_source_set_file_looping(0, id, value); + _webrtc_file_source_set_looping(0, id, value); id = 0; g_cnt = 0; reset_menu_state(); @@ -5450,9 +5364,9 @@ static void interpret(char *cmd) } break; } - case CURRENT_STATUS_MEDIA_SOURCE_GET_FILE_LOOPING: { + case CURRENT_STATUS_FILE_SOURCE_GET_LOOPING: { value = atoi(cmd); - _webrtc_media_source_get_file_looping(0, value); + _webrtc_file_source_get_looping(0, value); reset_menu_state(); break; }