webrtc_test: Add test cases for payload type 62/280062/2
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 23 Aug 2022 06:12:17 +0000 (15:12 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Wed, 24 Aug 2022 00:40:48 +0000 (09:40 +0900)
spt. Set payload type
gpt. Get payload type

[Version] 0.3.210
[Issue Type] Add

Change-Id: I5312ed8437ab1e7210c12bb67fed42e8e6ec48f4
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/capi-media-webrtc.spec
test/webrtc_test.c
test/webrtc_test_menu.c
test/webrtc_test_priv.h

index 08faf486fe8b933828b442f648d3a89c6541f42b..3beba9e9ce5b56e632cc9b07a3d8bf179f87c1e9 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.209
+Version:    0.3.210
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index 739a9431eacd24d9c42441b7f116430b7d2c1d7a..87db0cd1cfd63a9e73dcba87c8131c931ec9e298 100644 (file)
@@ -1063,6 +1063,25 @@ static void _webrtc_screen_source_unset_crop(int index, unsigned int source_id)
                g_print("failed to webrtc_screen_source_unset_crop(), source_id[%d], ret[0x%x]\n", source_id, ret);
 }
 
+static void _webrtc_media_source_get_payload_type(int index, unsigned int source_id, webrtc_media_type_e media_type)
+{
+       unsigned int pt;
+       int ret = webrtc_media_source_get_payload_type(g_ad.conns[index].webrtc, source_id, media_type, &pt);
+       RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret);
+
+       g_print("webrtc_media_source_get_payload_type() success, source_id[%u], media_type[%s], pt[%u]\n",
+               source_id, g_webrtc_media_type_str[media_type], pt);
+}
+
+static void _webrtc_media_source_set_payload_type(int index, unsigned int source_id, webrtc_media_type_e media_type, int value)
+{
+       int ret = webrtc_media_source_set_payload_type(g_ad.conns[index].webrtc, source_id, media_type, (unsigned int)value);
+       RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret);
+
+       g_print("webrtc_media_source_set_payload_type() success, source_id[%u], media_type[%s], pt[%u]\n",
+               source_id, g_webrtc_media_type_str[media_type], value);
+}
+
 static void __offer_created_cb(webrtc_h webrtc, const char *description, void *user_data)
 {
        connection_s *conn = (connection_s *)user_data;
@@ -3553,6 +3572,49 @@ static void test_webrtc_media_source(char *cmd)
                reset_menu_state();
                break;
        }
+       case CURRENT_STATUS_MEDIA_SOURCE_SET_PAYLOAD_TYPE: {
+               static unsigned int id;
+               static unsigned int media_type;
+               value = atoi(cmd);
+
+               switch (g_ad.input_count) {
+               case 0:
+                       id = value;
+                       g_ad.input_count++;
+                       break;
+               case 1:
+                       media_type = value - 1;
+                       g_ad.input_count++;
+                       break;
+               case 2:
+                       _webrtc_media_source_set_payload_type(0, id, media_type, value);
+                       id = media_type = 0;
+                       g_ad.input_count = 0;
+                       reset_menu_state();
+                       break;
+               }
+               break;
+       }
+       case CURRENT_STATUS_MEDIA_SOURCE_GET_PAYLOAD_TYPE: {
+               static unsigned int id;
+               static unsigned int media_type;
+               value = atoi(cmd);
+
+               switch (g_ad.input_count) {
+               case 0:
+                       id = value;
+                       g_ad.input_count++;
+                       break;
+               case 1:
+                       media_type = value - 1;
+                       _webrtc_media_source_get_payload_type(0, id, media_type);
+                       id = media_type = 0;
+                       g_ad.input_count = 0;
+                       reset_menu_state();
+                       break;
+               }
+               break;
+       }
        }
 }
 
index a201976b468832228b9e0fda12b09c3b339f7430..8792bd361a5c6a08e992db6ebad92f21a73d5a6a 100644 (file)
@@ -76,6 +76,8 @@ menu_info_s g_menu_infos[] = {
        { "tp", CURRENT_STATUS_STOP_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE, true },
        { "scs", CURRENT_STATUS_SCREEN_SOURCE_SET_CROP, true },
        { "ucs", CURRENT_STATUS_SCREEN_SOURCE_UNSET_CROP, true },
+       { "spt", CURRENT_STATUS_MEDIA_SOURCE_SET_PAYLOAD_TYPE, true },
+       { "gpt", CURRENT_STATUS_MEDIA_SOURCE_GET_PAYLOAD_TYPE, true },
        /* webrtc media render */
        { "dt", CURRENT_STATUS_SET_DISPLAY_TYPE, true },
        { "dm", CURRENT_STATUS_SET_DISPLAY_MODE, true },
@@ -232,6 +234,8 @@ void display_menu_main(void)
        g_print("fc. Get supported transceiver codecs\t");
        g_print("tc. Set transceiver codec\t");
        g_print("gc. Get transceiver codec\n");
+       g_print("spt. *Set payload type\t");
+       g_print("gpt. *Get payload type\n");
        g_print("pa. Set media path to file source\n");
        g_print("sfl. Set file source looping\t");
        g_print("gfl. Get file source looping\n");
@@ -486,6 +490,20 @@ void display_menu_webrtc_media_source(void)
                if (get_appdata()->input_count == 0)
                        g_print("*** input source id.\n");
                break;
+       case CURRENT_STATUS_MEDIA_SOURCE_SET_PAYLOAD_TYPE:
+               if (get_appdata()->input_count == 0)
+                       g_print("*** input source id.\n");
+               else if (get_appdata()->input_count == 1)
+                       g_print("*** input media type.(1:audio 2:video)\n");
+               else if (get_appdata()->input_count == 2)
+                       g_print("*** input payload type.\n");
+               break;
+       case CURRENT_STATUS_MEDIA_SOURCE_GET_PAYLOAD_TYPE:
+               if (get_appdata()->input_count == 0)
+                       g_print("*** input source id.\n");
+               else if (get_appdata()->input_count == 1)
+                       g_print("*** input media type.(1:audio 2:video)\n");
+               break;
        }
        g_print(" >>> ");
 }
index 89fb653041bba47e6b1fbee0ff325a5a064258a6..813d07fa6e9742166abf0ceb9623336bdd9d3845 100644 (file)
@@ -115,6 +115,8 @@ enum {
        CURRENT_STATUS_STOP_PUSHING_PACKET_TO_MEDIA_PACKET_SOURCE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x1B,
        CURRENT_STATUS_SCREEN_SOURCE_SET_CROP = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x1C,
        CURRENT_STATUS_SCREEN_SOURCE_UNSET_CROP = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x1D,
+       CURRENT_STATUS_MEDIA_SOURCE_SET_PAYLOAD_TYPE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x1E,
+       CURRENT_STATUS_MEDIA_SOURCE_GET_PAYLOAD_TYPE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x1F,
        /* 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,