[ITC][webrtc][non-ACR] Check 'not supported error' that occurs when the feature is... 84/265284/1
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 14 Oct 2021 05:22:14 +0000 (14:22 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Thu, 14 Oct 2021 05:22:14 +0000 (14:22 +0900)
Change-Id: I12fc554460c58f2b4dd9009763d80aea03847b29
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
src/itc/webrtc/ITs-webrtc.c

index 4c989ce283490a28d278f3bfbee2e9e59d1f53f5..bf14e48c0ec659617f79dba299fbf83a36cceeab 100755 (executable)
@@ -334,6 +334,10 @@ int ITc_media_webrtc_add_remove_media_source_p(void)
        unsigned int nId;
 
        int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId);
+       if (nRet == WEBRTC_ERROR_NOT_SUPPORTED) {
+               dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] microphone feature is not supported, skip it", __FUNCTION__, __LINE__);
+               return 0;
+       }
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet));
 
        nRet = webrtc_remove_media_source(g_hWebRtcHandle, nId);
@@ -659,6 +663,11 @@ int ITc_media_webrtc_mic_source_set_sound_stream_info_p(void)
        CHECK_HANDLE(hStreamInfo, "sound_manager_create_stream_information");
 
        nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId);
+       if (nRet == WEBRTC_ERROR_NOT_SUPPORTED) {
+               dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] microphone feature is not supported, skip it", __FUNCTION__, __LINE__);
+               sound_manager_destroy_stream_information(hStreamInfo);
+               return 0;
+       }
        PRINT_RESULT_CLEANUP(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet),sound_manager_destroy_stream_information(hStreamInfo));
 
        nRet = webrtc_mic_source_set_sound_stream_info(g_hWebRtcHandle, nId, hStreamInfo);
@@ -1020,7 +1029,7 @@ int ITc_media_webrtc_set_local_description_p(void)
        g_bCallbackCalled = false;
        int nTimeoutId = -1;
 
-       int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId);
+       int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST, &nId);
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet));
 
        nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL);
@@ -1077,7 +1086,7 @@ int ITc_media_webrtc_set_remote_description_p(void)
        unsigned int nId;
        char *pszOffer;
 
-       int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId);
+       int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST, &nId);
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet));
 
        nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL);
@@ -1380,6 +1389,10 @@ int ITc_media_webrtc_create_offer_async_p(void)
        int nTimeoutId = -1;
 
        int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_CAMERA, &nId);
+       if (nRet == WEBRTC_ERROR_NOT_SUPPORTED) {
+               dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] camera feature is not supported, skip it", __FUNCTION__, __LINE__);
+               return 0;
+       }
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet));
 
        nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL);
@@ -1437,7 +1450,7 @@ int ITc_media_webrtc_create_answer_async_p(void)
        g_bCallbackCalled = false;
        int nTimeoutId = -1;
 
-       int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId);
+       int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST, &nId);
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet));
 
        nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL);
@@ -1539,7 +1552,7 @@ int ITc_media_webrtc_media_source_set_audio_loopback_p(void)
        int nTimeoutId = -1;
 
        createWindow();
-       int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_MIC, &nId);
+       int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_AUDIOTEST, &nId);
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet));
 
        nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL);
@@ -1712,8 +1725,11 @@ int ITc_media_webrtc_set_get_display_visible_p(void)
        webrtc_display_mode_e eMode;
        bool bGetVisible, bSetVisible = false;
 
-       createWindow();
        int nRet = webrtc_add_media_source(g_hWebRtcHandle, WEBRTC_MEDIA_SOURCE_TYPE_CAMERA, &nId);
+       if (nRet == WEBRTC_ERROR_NOT_SUPPORTED) {
+               dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] camera feature is not supported, skip it", __FUNCTION__, __LINE__);
+               return 0;
+       }
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_add_media_source", WebRtcGetError(nRet));
 
        nRet = webrtc_set_ice_candidate_cb(g_hWebRtcHandle, webrtcIceCandidateCB, NULL);
@@ -1722,6 +1738,8 @@ int ITc_media_webrtc_set_get_display_visible_p(void)
        nRet = webrtc_set_state_changed_cb(g_hWebRtcHandle, webrtcStateChangedCB, NULL);
        PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_state_changed_cb", WebRtcGetError(nRet));
 
+       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));