From: Sangchul Lee Date: Tue, 4 Jan 2022 07:02:14 +0000 (+0900) Subject: [ITC][webrtc][non-ACR] Add parameter to RUN_POLLING_LOOP and QUIT_LOOP macros X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F268886%2F2;p=test%2Ftct%2Fnative%2Fapi.git [ITC][webrtc][non-ACR] Add parameter to RUN_POLLING_LOOP and QUIT_LOOP macros Change-Id: I94a93bc8d1b59a0db6796636d43b7f0f4def3a09 Signed-off-by: Sangchul Lee --- diff --git a/src/itc/webrtc/ITs-webrtc-common.h b/src/itc/webrtc/ITs-webrtc-common.h index 787bfa2b9..76c04758b 100755 --- a/src/itc/webrtc/ITs-webrtc-common.h +++ b/src/itc/webrtc/ITs-webrtc-common.h @@ -39,24 +39,25 @@ }\ } -#define RUN_POLLING_LOOP {\ - if(!g_bCallbackCalled) {\ - guint nTimeoutId;\ - g_pMainLoop = g_main_loop_new(NULL, false);\ - nTimeoutId = g_timeout_add(TIMEOUT_CB, Timeout, g_pMainLoop);\ - dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] call g_main_loop_run(), g_pMainLoop[%p]", __FUNCTION__, __LINE__, g_pMainLoop);\ - g_main_loop_run(g_pMainLoop);\ - g_source_remove(nTimeoutId);\ - g_pMainLoop = NULL;\ - }\ -} +#define RUN_POLLING_LOOP(x_mainloop, x_cb_called)\ +do {\ + if(x_cb_called)\ + break;\ + x_mainloop = g_main_loop_new(NULL, false);\ + guint timeout_id = g_timeout_add(TIMEOUT_CB, Timeout, x_mainloop);\ + dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] call g_main_loop_run(), mainloop[%p]", __FUNCTION__, __LINE__, x_mainloop);\ + g_main_loop_run(x_mainloop);\ + g_source_remove(timeout_id);\ + x_mainloop = NULL;\ +} while (0) -#define QUIT_LOOP {\ - if (g_pMainLoop) {\ - dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] call g_main_loop_quit(), g_pMainLoop[%p]", __FUNCTION__, __LINE__, g_pMainLoop);\ - g_main_loop_quit(g_pMainLoop);\ - }\ -} +#define QUIT_LOOP(x_mainloop)\ +do {\ + if (!x_mainloop)\ + break;\ + dlog_print(DLOG_DEBUG, "NativeTCT", "[%s(%d)] call g_main_loop_quit(), mainloop[%p]", __FUNCTION__, __LINE__, x_mainloop);\ + g_main_loop_quit(x_mainloop);\ +} while (0) #define CHECK_HANDLE_CLEANUP(Handle, API, FreeResource) {\ if (!Handle) {\ diff --git a/src/itc/webrtc/ITs-webrtc.c b/src/itc/webrtc/ITs-webrtc.c index 89758d189..f7d614ddb 100755 --- a/src/itc/webrtc/ITs-webrtc.c +++ b/src/itc/webrtc/ITs-webrtc.c @@ -67,7 +67,7 @@ static void webrtcSessionDescriptionCreatedCB(webrtc_h webrtc, const char *descr { g_bCallbackCalled = true; FPRINTF("[Line : %d][%s] Callback webrtcSessionDescriptionCreatedCB called\\n", __LINE__, API_NAMESPACE); - QUIT_LOOP; + QUIT_LOOP(g_pMainLoop); } /** @@ -99,7 +99,7 @@ static void webrtcStateChangedCB(webrtc_h webrtc, webrtc_state_e previous, webrt { g_bCallbackCalled = true; FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB called\\n", __LINE__, API_NAMESPACE); - QUIT_LOOP; + QUIT_LOOP(g_pMainLoop); } /** @@ -111,7 +111,7 @@ static void webrtcSignalingStateChangeCB(webrtc_h webrtc, webrtc_signaling_state { g_bCallbackCalled = true; FPRINTF("[Line : %d][%s] Callback webrtcSignalingStateChangeCB called\\n", __LINE__, API_NAMESPACE); - QUIT_LOOP; + QUIT_LOOP(g_pMainLoop); } /** @@ -246,7 +246,7 @@ int ITc_webrtc_start_stop_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked for %s\\n", __LINE__, API_NAMESPACE, "webrtc_set_state_changed_cb"); return 1; @@ -916,7 +916,7 @@ int ITc_media_webrtc_create_offer_answer_p(void) nRet = webrtc_start(hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -942,7 +942,7 @@ int ITc_media_webrtc_create_offer_answer_p(void) nRet = webrtc_start(hLocalWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -952,7 +952,7 @@ int ITc_media_webrtc_create_offer_answer_p(void) nRet = webrtc_set_remote_description(hLocalWebRtcHandle, pszOffer); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_remote_description", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcSignalingStateChangeCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1016,7 +1016,7 @@ int ITc_media_webrtc_set_local_description_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1072,7 +1072,7 @@ int ITc_media_webrtc_set_remote_description_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1094,7 +1094,7 @@ int ITc_media_webrtc_set_remote_description_p(void) nRet = webrtc_start(hLocalWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1147,7 +1147,7 @@ int ITc_media_webrtc_add_ice_candidate_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1373,7 +1373,7 @@ int ITc_media_webrtc_create_offer_async_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1382,7 +1382,7 @@ int ITc_media_webrtc_create_offer_async_p(void) nRet = webrtc_create_offer_async(g_hWebRtcHandle, NULL, webrtcSessionDescriptionCreatedCB, NULL); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_offer_async", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcSessionDescriptionCreatedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1430,7 +1430,7 @@ int ITc_media_webrtc_create_answer_async_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1455,7 +1455,7 @@ int ITc_media_webrtc_create_answer_async_p(void) nRet = webrtc_start(hLocalWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1465,7 +1465,7 @@ int ITc_media_webrtc_create_answer_async_p(void) nRet = webrtc_set_remote_description(hLocalWebRtcHandle, pszOffer); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_remote_description", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcSignalingStateChangeCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1475,7 +1475,7 @@ int ITc_media_webrtc_create_answer_async_p(void) nRet = webrtc_create_answer_async(hLocalWebRtcHandle, NULL, webrtcSessionDescriptionCreatedCB, NULL); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create_answer_async", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcSessionDescriptionCreatedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1537,7 +1537,7 @@ int ITc_media_webrtc_media_source_set_audio_loopback_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1591,7 +1591,7 @@ int ITc_media_webrtc_media_source_set_video_loopback_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1643,7 +1643,7 @@ int ITc_media_webrtc_set_get_display_mode_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; @@ -1706,7 +1706,7 @@ int ITc_media_webrtc_set_get_display_visible_p(void) nRet = webrtc_start(g_hWebRtcHandle); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_start", WebRtcGetError(nRet)); - RUN_POLLING_LOOP; + RUN_POLLING_LOOP(g_pMainLoop, g_bCallbackCalled); if (!g_bCallbackCalled) { FPRINTF("[Line : %d][%s] Callback webrtcStateChangedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1;