test: Add menu for activating transceiver encoding 75/305375/3
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 17 Jan 2024 08:11:17 +0000 (17:11 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Sun, 4 Feb 2024 23:54:26 +0000 (08:54 +0900)
[Version] 0.4.42
[Issue Type] Test application

Change-Id: If83d2eac958ba87d8a24d53862297c224e7ee734
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 45fcf489be160a39acb6a1da6ee352af7c67111c..5d73a051c7ff35578c152d4780cf6d00405a9e2d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.4.41
+Version:    0.4.42
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index ccb02a7fc3a81fa7dd21948f131d42de06b5117f..dbc1006ecd31703189c640fbe512fec388f63d85 100644 (file)
@@ -1186,6 +1186,15 @@ static void _webrtc_media_source_remove_transceiver_encoding(int index, unsigned
                source_id, g_webrtc_media_type_str[media_type], rid);
 }
 
+static void _webrtc_media_source_active_transceiver_encoding(int index, unsigned int source_id, webrtc_media_type_e media_type, const char *rid, bool active)
+{
+       int ret = webrtc_media_source_active_transceiver_encoding(g_ad.conns[index].webrtc, source_id, media_type, rid, active);
+       RET_IF(ret != WEBRTC_ERROR_NONE, "ret[0x%x]", ret);
+
+       g_print("webrtc_media_source_active_transceiver_encoding() success, source_id[%u], media_type[%s], rid[%s], active[%d]\n",
+               source_id, g_webrtc_media_type_str[media_type], rid, active);
+}
+
 static void __offer_created_cb(webrtc_h webrtc, const char *description, void *user_data)
 {
        connection_s *conn = (connection_s *)user_data;
@@ -3678,6 +3687,36 @@ static void test_webrtc_media_source(char *cmd)
                }
                break;
        }
+       case CURRENT_STATUS_MEDIA_SOURCE_ACTIVE_TRANSCEIVER_ENCODING: {
+               static unsigned int id;
+               static unsigned int media_type;
+               static char *rid;
+
+               switch (g_ad.input_count) {
+               case 0:
+                       id = value;
+                       g_ad.input_count++;
+                       return;
+               case 1:
+                       media_type = value - 1;
+                       g_ad.input_count++;
+                       return;
+               case 2:
+                       rid = strdup(cmd);
+                       g_ad.input_count++;
+                       return;
+               case 3:
+                       _webrtc_media_source_active_transceiver_encoding(0, id, media_type, rid, value > 0);
+                       id = media_type = 0;
+                       if (rid) {
+                               free(rid);
+                               rid = NULL;
+                       }
+                       g_ad.input_count = 0;
+                       break;
+               }
+               break;
+       }
        }
 
        reset_menu_state();
index 6812ff5dec60ac8a699c766daabe7f310fff9dd4..933163803276d3f5e8980e6d563e6385b475972e 100644 (file)
@@ -80,6 +80,7 @@ menu_info_s g_menu_infos[] = {
        { "gpt", CURRENT_STATUS_MEDIA_SOURCE_GET_PAYLOAD_TYPE, true },
        { "ae", CURRENT_STATUS_MEDIA_SOURCE_ADD_TRANSCEIVER_ENCODING, true },
        { "re", CURRENT_STATUS_MEDIA_SOURCE_REMOVE_TRANSCEIVER_ENCODING, true },
+       { "te", CURRENT_STATUS_MEDIA_SOURCE_ACTIVE_TRANSCEIVER_ENCODING, true },
        /* webrtc media render */
        { "dt", CURRENT_STATUS_SET_DISPLAY_TYPE, true },
        { "dm", CURRENT_STATUS_SET_DISPLAY_MODE, true },
@@ -251,7 +252,8 @@ void display_menu_main(void)
        g_print("scs. *Set screen source crop\t");
        g_print("ucs. *Unset screen source crop\n");
        g_print("ae. *Add transceiver encoding\t");
-       g_print("re. *Remove transceiver encoding\n");
+       g_print("re. *Remove transceiver encoding\t");
+       g_print("te. *Active transceiver encoding\n");
        g_print("------------------------------------- Media Render --------------------------------------\n");
        g_print("dt. Set display type\t");
        g_print("dm. Set display mode\t");
@@ -536,6 +538,16 @@ void display_menu_webrtc_media_source(void)
                else if (get_appdata()->input_count == 2)
                        g_print("*** input rid.\n");
                break;
+       case CURRENT_STATUS_MEDIA_SOURCE_ACTIVE_TRANSCEIVER_ENCODING:
+               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 rid.\n");
+               else if (get_appdata()->input_count == 3)
+                       g_print("*** input active or not.(1.active 0:inactive)\n");
+               break;
        }
        g_print(" >>> ");
 }
index 2b4ca71426fbc1100455e3649ef9e9289802afa4..44195c14158959f14ff03a117fa6e936ca0540e5 100644 (file)
@@ -119,6 +119,7 @@ enum {
        CURRENT_STATUS_MEDIA_SOURCE_GET_PAYLOAD_TYPE = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x1F,
        CURRENT_STATUS_MEDIA_SOURCE_ADD_TRANSCEIVER_ENCODING = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x21,
        CURRENT_STATUS_MEDIA_SOURCE_REMOVE_TRANSCEIVER_ENCODING = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x22,
+       CURRENT_STATUS_MEDIA_SOURCE_ACTIVE_TRANSCEIVER_ENCODING = TEST_MENU_WEBRTC_MEDIA_SOURCE | 0x23,
        /* 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,