Commit b025abb6 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Fix useless media restart on ICE re-invite.

parent 733ce6a0
......@@ -3353,6 +3353,8 @@ void linphone_call_start_media_streams(LinphoneCall *call, LinphoneCallState nex
ms_fatal("start_media_stream() called without prior init !");
return;
}
call->nb_media_starts++;
#if defined(VIDEO_ENABLED)
if (vstream!=NULL && vstream->dir!=SalStreamInactive && vstream->payloads!=NULL){
/*when video is used, do not make adaptive rate control on audio, it is stupid.*/
......
......@@ -302,6 +302,7 @@ struct _LinphoneCall{
int localdesc_changed;/*not a boolean, contains a mask representing changes*/
LinphonePlayer *player;
unsigned long bg_task_id; /*used to prevent device to suspend app while a call is received in background*/
unsigned int nb_media_starts;
char *dtmf_sequence; /*DTMF sequence needed to be sent using #dtmfs_timer*/
belle_sip_source_t *dtmfs_timer; /*DTMF timer needed to send a DTMF sequence*/
......
......@@ -328,8 +328,8 @@ int sal_stream_description_equals(const SalStreamDescription *sd1, const SalStre
if (sd1->dir != sd2->dir) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED;
/* ICE */
if (sd1->ice_ufrag != sd2->ice_ufrag) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED;
if (sd1->ice_pwd != sd2->ice_pwd) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED;
if (strcmp(sd1->ice_ufrag, sd2->ice_ufrag) != 0) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED;
if (strcmp(sd1->ice_pwd, sd2->ice_pwd) != 0) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED;
/*DTLS*/
if (sd1->dtls_role != sd2->dtls_role) result |= SAL_MEDIA_DESCRIPTION_CRYPTO_KEYS_CHANGED;
......@@ -390,8 +390,8 @@ int sal_media_description_equals(const SalMediaDescription *md1, const SalMediaD
if (md1->bandwidth != md2->bandwidth) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED;
/* ICE */
if (md1->ice_ufrag != md2->ice_ufrag) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED;
if (md1->ice_pwd != md2->ice_pwd) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED;
if (strcmp(md1->ice_ufrag, md2->ice_ufrag) != 0) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED;
if (strcmp(md1->ice_pwd, md2->ice_pwd) != 0) result |= SAL_MEDIA_DESCRIPTION_ICE_RESTART_DETECTED;
for(i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i){
if (!sal_stream_description_active(&md1->streams[i]) && !sal_stream_description_active(&md2->streams[i])) continue;
......
......@@ -1087,11 +1087,23 @@ static void _call_with_ice_base(LinphoneCoreManager* pauline,LinphoneCoreManager
return;
if (callee_with_ice && caller_with_ice) {
LinphoneCall *c1, *c2;
/*wait for the ICE reINVITE to complete*/
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
BC_ASSERT_TRUE(wait_for(pauline->lc,marie->lc,&marie->stat.number_of_LinphoneCallStreamsRunning,2));
BC_ASSERT_TRUE(check_ice(pauline,marie,LinphoneIceStateHostConnection));
c1 = linphone_core_get_current_call(pauline->lc);
c2 = linphone_core_get_current_call(marie->lc);
BC_ASSERT_PTR_NOT_NULL(c1);
BC_ASSERT_PTR_NOT_NULL(c2);
if (c1) {
BC_ASSERT_EQUAL(c1->nb_media_starts, 1, unsigned int, "%u");
}
if (c2) {
BC_ASSERT_EQUAL(c2->nb_media_starts, 1, unsigned int, "%u");
}
}
liblinphone_tester_check_rtcp(marie,pauline);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment