From: Sangchul Lee Date: Fri, 24 Jun 2022 05:44:15 +0000 (+0900) Subject: webrtc_test: Add support for program execution option X-Git-Tag: submit/tizen/20220706.020113~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0bdfce8c8ad2b04b6e3a0fb4f188e595c2aee673;p=platform%2Fcore%2Fapi%2Fwebrtc.git webrtc_test: Add support for program execution option proxy setting is moved to the execution option from menu item. webrtc_test [OPTION] -p, --proxy proxy URL to use (e.g. http://123.123.123.123:8080) -h, --help help [Version] 0.3.137 [Issue Type] Improvement Change-Id: I438c0d79a5715562901112199318e8ea2c518fd9 Signed-off-by: Sangchul Lee --- diff --git a/packaging/capi-media-webrtc.spec b/packaging/capi-media-webrtc.spec index f61a93e2..2fe08f27 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.136 +Version: 0.3.137 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/webrtc_test.c b/test/webrtc_test.c index 5b8afc4a..739f63f3 100644 --- a/test/webrtc_test.c +++ b/test/webrtc_test.c @@ -21,6 +21,7 @@ #include #include #include +#include #ifdef PACKAGE #undef PACKAGE @@ -5162,11 +5163,6 @@ static void app_setting_and_signaling(char *cmd) reset_menu_state(); break; } - case CURRENT_STATUS_SETTING_PROXY: { - _setting_uri(g_ad.proxy, cmd); - reset_menu_state(); - break; - } case CURRENT_STATUS_CONNECT_SIGNALING_SERVER: { _connect_signaling_server(); reset_menu_state(); @@ -5321,15 +5317,48 @@ static gboolean input_watch_cb(GIOChannel *channel, GIOCondition condition, gpoi return TRUE; } +static void print_usage() +{ + printf("Usage : "); + printf("webrtc_test [option]\n\n" + " -p, --proxy proxy URL to use (e.g. http://123.123.123.123:8080)\n" + " -h, --help help\n"); +} + int main(int argc, char *argv[]) { GIOChannel *stdin_channel = g_io_channel_unix_new(0); g_io_channel_set_flags(stdin_channel, G_IO_FLAG_NONBLOCK, NULL); g_io_add_watch(stdin_channel, G_IO_IN, input_watch_cb, NULL); - displaymenu(); memset(&g_ad, 0x0, sizeof(appdata_s)); ops.data = &g_ad; + while (1) { + int opt; + int opt_idx = 0; + + static struct option long_options[] = { + { "proxy", required_argument, 0, 'p' }, + { "help", no_argument, 0, 'h' }, + { 0, 0, 0, 0 } + }; + + if ((opt = getopt_long(argc, argv, "p:h", long_options, &opt_idx)) == -1) + break; + + switch (opt) { + case 'p': + strncpy(g_ad.proxy, optarg, sizeof(g_ad.proxy) - 1); + break; + case 'h': + default: + print_usage(); + return 0; + } + } + + displaymenu(); + return appcore_efl_main(PACKAGE, &argc, &argv, &ops); } diff --git a/test/webrtc_test_menu.c b/test/webrtc_test_menu.c index f4f9c102..25e95001 100644 --- a/test/webrtc_test_menu.c +++ b/test/webrtc_test_menu.c @@ -102,7 +102,6 @@ menu_info_s g_menu_infos[] = { /* app. setting & signaling */ { "ss", CURRENT_STATUS_SETTING_SIGNALING_SERVER, true }, { "cs", CURRENT_STATUS_CONNECT_SIGNALING_SERVER, false }, - { "px", CURRENT_STATUS_SETTING_PROXY, true }, { "rs", CURRENT_STATUS_REQUEST_SESSION, true }, { "rj", CURRENT_STATUS_REQUEST_JOIN_ROOM, true }, { "sd", CURRENT_STATUS_SEND_LOCAL_DESCRIPTION, true }, @@ -250,7 +249,6 @@ void display_menu_main(void) g_print("sts. Get stats\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"); g_print("cs. Connect to the signaling server\n"); g_print("rs. Request session of remote peer id\n"); @@ -525,9 +523,6 @@ void display_menu_app_signaling(void) case CURRENT_STATUS_SETTING_SIGNALING_SERVER: g_print("*** input signaling server URL.\n"); break; - case CURRENT_STATUS_SETTING_PROXY: - g_print("*** input proxy URL.\n"); - break; case CURRENT_STATUS_REQUEST_SESSION: g_print("*** input remote peer id.\n"); break; diff --git a/test/webrtc_test_priv.h b/test/webrtc_test_priv.h index 44bfd56a..f1ba03a0 100644 --- a/test/webrtc_test_priv.h +++ b/test/webrtc_test_priv.h @@ -138,16 +138,15 @@ enum { /* app. setting & signaling */ CURRENT_STATUS_SETTING_SIGNALING_SERVER = TEST_MENU_APP_SIGNALING | 0x01, CURRENT_STATUS_CONNECT_SIGNALING_SERVER = TEST_MENU_APP_SIGNALING | 0x02, - CURRENT_STATUS_SETTING_PROXY = TEST_MENU_APP_SIGNALING | 0x03, - CURRENT_STATUS_REQUEST_SESSION = TEST_MENU_APP_SIGNALING | 0x04, - CURRENT_STATUS_REQUEST_JOIN_ROOM = TEST_MENU_APP_SIGNALING | 0x05, - CURRENT_STATUS_SEND_LOCAL_DESCRIPTION = TEST_MENU_APP_SIGNALING | 0x06, - CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_CREATE = TEST_MENU_APP_SIGNALING | 0x07, - CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_DESTROY = TEST_MENU_APP_SIGNALING | 0x08, - CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_START = TEST_MENU_APP_SIGNALING | 0x09, - CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_STOP = TEST_MENU_APP_SIGNALING | 0x0A, - CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_CONNECT = TEST_MENU_APP_SIGNALING | 0x0B, - CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_DISCONNECT = TEST_MENU_APP_SIGNALING | 0x0C, + 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_PRIVATE_SIGNALING_SERVER_CREATE = TEST_MENU_APP_SIGNALING | 0x06, + CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_DESTROY = TEST_MENU_APP_SIGNALING | 0x07, + CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_START = TEST_MENU_APP_SIGNALING | 0x08, + CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_STOP = TEST_MENU_APP_SIGNALING | 0x09, + CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_CONNECT = TEST_MENU_APP_SIGNALING | 0x0A, + CURRENT_STATUS_PRIVATE_SIGNALING_SERVER_DISCONNECT = TEST_MENU_APP_SIGNALING | 0x0B, }; enum {