mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-07 05:53:06 +00:00
fix potential crash when receiving an incoming call for which audio is declined (due to incompatible codecs), but video is accepted.
This commit is contained in:
parent
9b06383c7e
commit
76c6886119
3 changed files with 85 additions and 30 deletions
|
|
@ -62,16 +62,19 @@ static void sdp_process(SalOp *h){
|
|||
strcpy(h->result->addr,h->base.remote_media->addr);
|
||||
h->result->bandwidth=h->base.remote_media->bandwidth;
|
||||
|
||||
for(i=0;i<sal_media_description_get_nb_active_streams(h->result);++i){
|
||||
strcpy(h->result->streams[i].rtp_addr,h->base.remote_media->streams[i].rtp_addr);
|
||||
h->result->streams[i].ptime=h->base.remote_media->streams[i].ptime;
|
||||
h->result->streams[i].bandwidth=h->base.remote_media->streams[i].bandwidth;
|
||||
h->result->streams[i].rtp_port=h->base.remote_media->streams[i].rtp_port;
|
||||
strcpy(h->result->streams[i].rtcp_addr,h->base.remote_media->streams[i].rtcp_addr);
|
||||
h->result->streams[i].rtcp_port=h->base.remote_media->streams[i].rtcp_port;
|
||||
for(i=0;i<h->result->nb_streams;++i){
|
||||
/*copy back parameters from remote description that we need in our result description*/
|
||||
if (h->result->streams[i].rtp_port!=0){ /*if stream was accepted*/
|
||||
strcpy(h->result->streams[i].rtp_addr,h->base.remote_media->streams[i].rtp_addr);
|
||||
h->result->streams[i].ptime=h->base.remote_media->streams[i].ptime;
|
||||
h->result->streams[i].bandwidth=h->base.remote_media->streams[i].bandwidth;
|
||||
h->result->streams[i].rtp_port=h->base.remote_media->streams[i].rtp_port;
|
||||
strcpy(h->result->streams[i].rtcp_addr,h->base.remote_media->streams[i].rtcp_addr);
|
||||
h->result->streams[i].rtcp_port=h->base.remote_media->streams[i].rtcp_port;
|
||||
|
||||
if ((h->result->streams[i].proto == SalProtoRtpSavpf) || (h->result->streams[i].proto == SalProtoRtpSavp)) {
|
||||
h->result->streams[i].crypto[0] = h->base.remote_media->streams[i].crypto[0];
|
||||
if ((h->result->streams[i].proto == SalProtoRtpSavpf) || (h->result->streams[i].proto == SalProtoRtpSavp)) {
|
||||
h->result->streams[i].crypto[0] = h->base.remote_media->streams[i].crypto[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1265,6 +1265,32 @@ static void call_paused_resumed_from_callee(void) {
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void audio_call_with_ice_no_matching_audio_codecs(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
|
||||
LinphoneCall *out_call;
|
||||
|
||||
linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMU", 8000, 1), FALSE); /* Disable PCMU */
|
||||
linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMA", 8000, 1), TRUE); /* Enable PCMA */
|
||||
linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
|
||||
linphone_core_set_stun_server(marie->lc, "stun.linphone.org");
|
||||
linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
|
||||
linphone_core_set_stun_server(pauline->lc, "stun.linphone.org");
|
||||
|
||||
out_call = linphone_core_invite_address(marie->lc, pauline->identity);
|
||||
linphone_call_ref(out_call);
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1));
|
||||
|
||||
/* flexisip will retain the 488 until the "urgent reply" timeout arrives. */
|
||||
CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallError, 1, 6000));
|
||||
CU_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable);
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallIncomingReceived, 0);
|
||||
|
||||
linphone_call_unref(out_call);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
#ifdef VIDEO_ENABLED
|
||||
static LinphoneCall* setup_video(LinphoneCoreManager* caller,LinphoneCoreManager* callee) {
|
||||
LinphoneVideoPolicy caller_policy;
|
||||
|
|
@ -1511,6 +1537,7 @@ static void video_call_base(LinphoneCoreManager* pauline,LinphoneCoreManager* ma
|
|||
LinphoneCall* marie_call;
|
||||
LinphoneCall* pauline_call;
|
||||
LinphoneVideoPolicy marie_policy, pauline_policy;
|
||||
|
||||
linphone_core_enable_video_capture(marie->lc, TRUE);
|
||||
linphone_core_enable_video_display(marie->lc, TRUE);
|
||||
linphone_core_enable_video_capture(pauline->lc, TRUE);
|
||||
|
|
@ -1631,27 +1658,51 @@ static void call_with_ice_video_added(void) {
|
|||
linphone_core_manager_destroy(pauline);
|
||||
}
|
||||
|
||||
static void video_call_with_ice_no_matching_audio_codecs(void) {
|
||||
static void video_call_with_early_media_no_matching_audio_codecs(void) {
|
||||
LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc");
|
||||
LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc");
|
||||
LinphoneCall *out_call;
|
||||
|
||||
LinphoneVideoPolicy vpol={0};
|
||||
|
||||
linphone_core_enable_video_capture(marie->lc, TRUE);
|
||||
linphone_core_enable_video_display(marie->lc, TRUE);
|
||||
linphone_core_enable_video_capture(pauline->lc, TRUE);
|
||||
linphone_core_enable_video_display(pauline->lc, FALSE);
|
||||
|
||||
vpol.automatically_initiate=TRUE;
|
||||
vpol.automatically_accept=TRUE;
|
||||
linphone_core_set_video_policy(pauline->lc,&vpol);
|
||||
linphone_core_set_video_policy(marie->lc,&vpol);
|
||||
|
||||
linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMU", 8000, 1), FALSE); /* Disable PCMU */
|
||||
linphone_core_enable_payload_type(marie->lc, linphone_core_find_payload_type(marie->lc, "PCMA", 8000, 1), TRUE); /* Enable PCMA */
|
||||
linphone_core_set_firewall_policy(marie->lc, LinphonePolicyUseIce);
|
||||
linphone_core_set_stun_server(marie->lc, "stun.linphone.org");
|
||||
linphone_core_set_firewall_policy(pauline->lc, LinphonePolicyUseIce);
|
||||
linphone_core_set_stun_server(pauline->lc, "stun.linphone.org");
|
||||
|
||||
out_call = linphone_core_invite_address(marie->lc, pauline->identity);
|
||||
linphone_call_ref(out_call);
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingInit, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingReceived, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingRinging, 1));
|
||||
|
||||
/* flexisip will retain the 488 until the "urgent reply" timeout arrives. */
|
||||
CU_ASSERT_TRUE(wait_for_until(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallError, 1, 6000));
|
||||
CU_ASSERT_EQUAL(linphone_call_get_reason(out_call), LinphoneReasonNotAcceptable);
|
||||
CU_ASSERT_EQUAL(pauline->stat.number_of_LinphoneCallIncomingReceived, 0);
|
||||
linphone_core_accept_early_media(pauline->lc,linphone_core_get_current_call(pauline->lc));
|
||||
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallIncomingEarlyMedia, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallOutgoingEarlyMedia, 1));
|
||||
/*audio stream shall not have been requested to start*/
|
||||
CU_ASSERT_PTR_NULL(linphone_core_get_current_call(pauline->lc)->audiostream->soundread);
|
||||
|
||||
CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(out_call))==TRUE);
|
||||
CU_ASSERT_TRUE(linphone_call_params_video_enabled(linphone_call_get_current_params(linphone_core_get_current_call(pauline->lc)))==TRUE);
|
||||
|
||||
linphone_core_accept_call(pauline->lc, linphone_core_get_current_call(pauline->lc));
|
||||
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 1));
|
||||
|
||||
linphone_core_terminate_call(marie->lc, out_call);
|
||||
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallEnd, 1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallEnd, 1));
|
||||
|
||||
linphone_call_unref(out_call);
|
||||
linphone_core_manager_destroy(marie);
|
||||
linphone_core_manager_destroy(pauline);
|
||||
|
|
@ -3458,6 +3509,7 @@ test_t call_tests[] = {
|
|||
{ "SRTP call with declined srtp", call_with_declined_srtp },
|
||||
{ "Call with file player", call_with_file_player},
|
||||
{ "Call with mkv file player", call_with_mkv_file_player},
|
||||
{ "Audio call with ICE no matching audio codecs", audio_call_with_ice_no_matching_audio_codecs },
|
||||
#ifdef VIDEO_ENABLED
|
||||
{ "Simple video call",video_call},
|
||||
{ "Simple video call using policy",video_call_using_policy},
|
||||
|
|
@ -3473,9 +3525,9 @@ test_t call_tests[] = {
|
|||
{ "Call with multiple early media", multiple_early_media },
|
||||
{ "Call with ICE from video to non-video", call_with_ice_video_to_novideo},
|
||||
{ "Call with ICE and video added", call_with_ice_video_added },
|
||||
{ "Video call with ICE no matching audio codecs", video_call_with_ice_no_matching_audio_codecs },
|
||||
{ "Video call recording", video_call_recording_test },
|
||||
{ "Snapshot", video_call_snapshot },
|
||||
{ "Video call with early media and no matching audio codecs", video_call_with_early_media_no_matching_audio_codecs },
|
||||
#endif
|
||||
{ "SRTP ice call", srtp_ice_call },
|
||||
{ "ZRTP ice call", zrtp_ice_call },
|
||||
|
|
|
|||
|
|
@ -552,12 +552,12 @@ static void early_media_call_forking(void) {
|
|||
|
||||
/*wait a bit that streams are established*/
|
||||
wait_for_list(lcs,&dummy,1,3000);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>70
|
||||
&& linphone_call_get_audio_stats(pauline_call)->download_bandwidth<90);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>70
|
||||
&& linphone_call_get_audio_stats(marie1_call)->download_bandwidth<90);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>70
|
||||
&& linphone_call_get_audio_stats(marie2_call)->download_bandwidth<90);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60
|
||||
&& linphone_call_get_audio_stats(pauline_call)->download_bandwidth<99);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60
|
||||
&& linphone_call_get_audio_stats(marie1_call)->download_bandwidth<99);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie2_call)->download_bandwidth>60
|
||||
&& linphone_call_get_audio_stats(marie2_call)->download_bandwidth<99);
|
||||
|
||||
linphone_core_accept_call(marie1->lc,linphone_core_get_current_call(marie1->lc));
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&marie1->stat.number_of_LinphoneCallStreamsRunning,1,3000));
|
||||
|
|
@ -568,10 +568,10 @@ static void early_media_call_forking(void) {
|
|||
|
||||
/*wait a bit that streams are established*/
|
||||
wait_for_list(lcs,&dummy,1,3000);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>71
|
||||
&& linphone_call_get_audio_stats(pauline_call)->download_bandwidth<91 );
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>71
|
||||
&& linphone_call_get_audio_stats(marie1_call)->download_bandwidth<91 );
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(pauline_call)->download_bandwidth>60
|
||||
&& linphone_call_get_audio_stats(pauline_call)->download_bandwidth<99 );
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(marie1_call)->download_bandwidth>60
|
||||
&& linphone_call_get_audio_stats(marie1_call)->download_bandwidth<99 );
|
||||
|
||||
linphone_core_terminate_all_calls(pauline->lc);
|
||||
CU_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,1,1000));
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue