[ITC][webrtc][ACR-1776] Apply display feature 04/296504/3
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 31 Jul 2023 00:36:09 +0000 (09:36 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 31 Jul 2023 07:24:44 +0000 (16:24 +0900)
Change-Id: I52690b9367c6521268e40a75a3453efb1aad8833
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
src/itc/webrtc/ITs-webrtc.c

index dadda77d5878f2859759954b2f291ed82efdef53..892d5273ce872102e2b5ab84716d961e1dca9db0 100755 (executable)
@@ -19,6 +19,7 @@
 
 #define MICROPHONE_FEATURE      "http://tizen.org/feature/microphone"
 #define CAMERA_FEATURE          "http://tizen.org/feature/camera"
+#define DISPLAY_FEATURE         "http://tizen.org/feature/display"
 #define TEST_DATA_CHANNEL_LABEL "test data channel"
 #define TEST_STRING_DATA        "test string"
 #define TEST_BUFFER_SIZE        16
@@ -27,6 +28,7 @@
 static char g_test_buffer[TEST_BUFFER_SIZE] = {'t', 'e', 's', 't', 'b', 'u', 'f', '\0', };
 static bool g_bIsMicrophoneFeatureSupported;
 static bool g_bIsCameraFeatureSupported;
+static bool g_bIsDisplayFeatureSupported;
 static Evas_Object *g_win = NULL;
 
 static void winDeleteCB(void *data, Evas_Object *obj, void *event)
@@ -375,6 +377,9 @@ void ITs_webrtc_startup(void)
        g_bIsCameraFeatureSupported = false;
        IS_FEATURE_SUPPORTED(CAMERA_FEATURE, g_bIsCameraFeatureSupported, API_NAMESPACE);
 
+       g_bIsDisplayFeatureSupported = false;
+       IS_FEATURE_SUPPORTED(DISPLAY_FEATURE, g_bIsDisplayFeatureSupported, API_NAMESPACE);
+
        g_bWebRTCCreation = false;
        int nRet = webrtc_create(&g_hWebRtcHandle);
        if (nRet != WEBRTC_ERROR_NONE) {
@@ -1762,7 +1767,10 @@ int ITc_webrtc_media_source_set_unset_video_loopback_p(void)
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet));
 
        nRet = webrtc_media_source_set_video_loopback(g_hWebRtcHandle, nId, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, NULL);
-       PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", WebRtcGetError(nRet));
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(nRet, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", WebRtcGetError(nRet));
 
        g_mutex_lock(&cb_data.mutex);
 
@@ -1778,8 +1786,11 @@ int ITc_webrtc_media_source_set_unset_video_loopback_p(void)
        nRet = webrtc_stop(g_hWebRtcHandle);
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet));
 
-        nRet = webrtc_media_source_unset_video_loopback(g_hWebRtcHandle, nId);
-       PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_unset_video_loopback", WebRtcGetError(nRet));
+       nRet = webrtc_media_source_unset_video_loopback(g_hWebRtcHandle, nId);
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(nRet, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_unset_video_loopback", WebRtcGetError(nRet));
 
        destroyWindow();
 
@@ -1821,7 +1832,10 @@ int ITc_webrtc_set_get_display_mode_p(void)
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet));
 
        nRet = webrtc_media_source_set_video_loopback(g_hWebRtcHandle, nId, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, &nTrackId);
-       PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", WebRtcGetError(nRet));
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(nRet, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", WebRtcGetError(nRet));
 
        g_mutex_lock(&cb_data.mutex);
 
@@ -1835,11 +1849,18 @@ int ITc_webrtc_set_get_display_mode_p(void)
        }
 
        nRet = webrtc_set_display_mode(g_hWebRtcHandle, nTrackId, WEBRTC_DISPLAY_MODE_FULL);
-       PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_display_mode", WebRtcGetError(nRet));
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(nRet, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_display_mode", WebRtcGetError(nRet));
 
        nRet = webrtc_get_display_mode(g_hWebRtcHandle, nTrackId, &eMode);
-       PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_display_mode", WebRtcGetError(nRet));
-       PRINT_RESULT(WEBRTC_DISPLAY_MODE_FULL, eMode, "webrtc_get_display_mode", WebRtcGetError(nRet));
+       if (!g_bIsDisplayFeatureSupported) {
+               assert_eq(nRet, WEBRTC_ERROR_NOT_SUPPORTED);
+       } else {
+               PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_display_mode", WebRtcGetError(nRet));
+               PRINT_RESULT(WEBRTC_DISPLAY_MODE_FULL, eMode, "webrtc_get_display_mode", WebRtcGetError(nRet));
+       }
 
        nRet = webrtc_stop(g_hWebRtcHandle);
        PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet));
@@ -1883,7 +1904,10 @@ int ITc_webrtc_set_get_display_visible_p(void)
        createWindow();
 
        nRet = webrtc_media_source_set_video_loopback(g_hWebRtcHandle, nId, WEBRTC_DISPLAY_TYPE_OVERLAY, g_win, &nTrackId);
-       PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", WebRtcGetError(nRet));
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(nRet, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_media_source_set_video_loopback", WebRtcGetError(nRet));
 
        g_mutex_lock(&cb_data.mutex);
 
@@ -1897,11 +1921,18 @@ int ITc_webrtc_set_get_display_visible_p(void)
        }
 
        nRet = webrtc_set_display_visible(g_hWebRtcHandle, nTrackId, bSetVisible);
-       PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_display_visible", WebRtcGetError(nRet));
+       if (!g_bIsDisplayFeatureSupported)
+               assert_eq(nRet, WEBRTC_ERROR_NOT_SUPPORTED);
+       else
+               PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_display_visible", WebRtcGetError(nRet));
 
        nRet = webrtc_get_display_visible(g_hWebRtcHandle, nTrackId, &bGetVisible);
-       PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_display_visible", WebRtcGetError(nRet));
-       PRINT_RESULT(bGetVisible, bSetVisible, "webrtc_get_display_visible", WebRtcGetError(nRet));
+       if (!g_bIsDisplayFeatureSupported) {
+               assert_eq(nRet, WEBRTC_ERROR_NOT_SUPPORTED);
+       } else {
+               PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_get_display_visible", WebRtcGetError(nRet));
+               PRINT_RESULT(bGetVisible, bSetVisible, "webrtc_get_display_visible", WebRtcGetError(nRet));
+       }
 
        nRet = webrtc_stop(g_hWebRtcHandle);
        PRINT_RESULT_NORETURN(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet));
@@ -2226,7 +2257,7 @@ int ITc_webrtc_start_and_finish_negotiation_p(void)
 * @reviewer                            SRID(shobhit.v)
 * @type                                auto
 * @description                 Gets the buffered amount of the data channel.
-* @scenario                            Sets and Gets the display mode of the video track.
+* @scenario                            Gets the buffered amount of the data channel.
 * @apicovered                  webrtc_create_data_chanel,webrtc_data_channel_get_buffered_amount, webrtc_destroy_data_channel
 * @passcase                            If webrtc_data_channel_get_buffered_amount is successful
 * @failcase                    If webrtc_data_channel_get_buffered_amount is unsuccessful
@@ -2263,8 +2294,8 @@ int ITc_webrtc_data_channel_get_buffered_amount_p(void)
 * @author                              SRID(ankit.sri1)
 * @reviewer                            SRID(shobhit.v)
 * @type                                auto
-* @description                 Sets and unsets the buffered amount of the data channel.
-* @scenario                            Sets and Gets the display mode of the video track.
+* @description                 Sets and unsets the buffered amount low callback of the data channel.
+* @scenario                            Sets and unsets the buffered amount low callback of the data channel.
 * @apicovered                  webrtc_create_data_chanel,webrtc_data_channel_set_buffered_amount_low_cb, webrtc_data_channel_unset_buffered_amount_low_cb, webrtc_destroy_data_channel
 * @passcase                            If webrtc_data_channel_set_buffered_amount_low_cb and webrtc_data_channel_unset_buffered_amount_low_cb is successful
 * @failcase                    If webrtc_data_channel_set_buffered_amount_low_cb or webrtc_data_channel_unset_buffered_amount_low_cb fails