From: Sangchul Lee Date: Wed, 14 Sep 2022 05:14:50 +0000 (+0900) Subject: [ITC][webrtc][Non-ACR] Fix bug in ITc_webrtc_start_and_finish_negotiation_p() X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11fa90513ab72ad4d802a5fa02210eb01a7095f8;p=test%2Ftct%2Fnative%2Fapi.git [ITC][webrtc][Non-ACR] Fix bug in ITc_webrtc_start_and_finish_negotiation_p() Previously, checking track_added_cb was omitted and the webrtc state was released immediately after setting remote description to offerer handle which is not expected. It is fixed now. Change-Id: I5508b047a8157fc2daeef8853ea7f695a7749c1d Signed-off-by: Sangchul Lee --- diff --git a/src/itc/webrtc/ITs-webrtc.c b/src/itc/webrtc/ITs-webrtc.c index aa9607cbd..231465ce7 100755 --- a/src/itc/webrtc/ITs-webrtc.c +++ b/src/itc/webrtc/ITs-webrtc.c @@ -2065,8 +2065,10 @@ int ITc_webrtc_start_and_finish_negotiation_p(void) GList *answerICECandidates = NULL; callback_data cb_data; callback_data cb_data2; + callback_data cb_data3; INIT_CALLBACK_DATA(cb_data); INIT_CALLBACK_DATA(cb_data2); + INIT_CALLBACK_DATA(cb_data3); nRet = webrtc_create(&webrtcOfferer); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_create", WebRtcGetError(nRet)); @@ -2113,7 +2115,7 @@ int ITc_webrtc_start_and_finish_negotiation_p(void) nRet = webrtc_set_ice_gathering_state_change_cb(webrtcAnswerer, webrtcIceGatheringStateChangeCB, &cb_data2); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_ice_gathering_state_change_cb", WebRtcGetError(nRet)); - nRet = webrtc_set_track_added_cb(webrtcAnswerer, webrtcTrackAddedCB, &cb_data2); + nRet = webrtc_set_track_added_cb(webrtcAnswerer, webrtcTrackAddedCB, &cb_data3); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_track_added_cb", WebRtcGetError(nRet)); g_mutex_lock(&cb_data2.mutex); @@ -2169,22 +2171,24 @@ int ITc_webrtc_start_and_finish_negotiation_p(void) FPRINTF("[Line : %d][%s] Callback webrtcIceGatheringStateChangeCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; } + cb_data2.is_invoked = false; g_list_foreach(offerICECandidates, __foreach_ice_candidate, webrtcAnswerer); g_list_foreach(answerICECandidates, __foreach_ice_candidate, webrtcOfferer); - g_mutex_lock(&cb_data2.mutex); + g_mutex_lock(&cb_data3.mutex); nRet = webrtc_set_remote_description(webrtcOfferer, answerSDP); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_set_remote_description", WebRtcGetError(nRet)); FREE_MEMORY(answerSDP); /* wait for track added callback of answerer */ - RUN_POLLING_LOOP(cb_data2); - if (!cb_data2.is_invoked) { + RUN_POLLING_LOOP(cb_data3); + if (!cb_data3.is_invoked) { FPRINTF("[Line : %d][%s] Callback webrtcTrackAddedCB not invoked\\n", __LINE__, API_NAMESPACE); return 1; } + cb_data3.is_invoked = false; nRet = webrtc_stop(webrtcOfferer); PRINT_RESULT(WEBRTC_ERROR_NONE, nRet, "webrtc_stop", WebRtcGetError(nRet));