From 93f7cbd86ffd15ca45d7d26f3da1f2276a4a5ea3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 25 Jan 2016 17:13:48 +0100 Subject: [PATCH 1/9] fix ice restart tests --- coreapi/callbacks.c | 11 +++++---- coreapi/linphonecall.c | 9 ++++---- coreapi/misc.c | 13 +++++------ coreapi/private.h | 2 +- mediastreamer2 | 2 +- oRTP | 2 +- tester/call_tester.c | 51 +++++++++++++++++++++++++++++------------- 7 files changed, 56 insertions(+), 34 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index af1cfb919..22af840f4 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -503,10 +503,7 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o if (call->params->internal_call_update) call->params->internal_call_update = FALSE; - /* Handle remote ICE attributes if any. */ - if (call->ice_session != NULL && rmd) { - linphone_call_update_ice_from_remote_media_description(call, rmd); - } + #ifdef BUILD_UPNP if (call->upnp_session != NULL && rmd) { linphone_core_update_upnp_from_remote_media_description(call, rmd); @@ -522,6 +519,12 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o md = NULL; } if (md){ /*there is a valid SDP in the response, either offer or answer, and we're able to start/update the streams*/ + + /* Handle remote ICE attributes if any. */ + if (call->ice_session != NULL && rmd) { + linphone_call_update_ice_from_remote_media_description(call, rmd, FALSE); + } + switch (call->state){ case LinphoneCallResuming: linphone_core_notify_display_status(lc,_("Call resumed.")); diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 52d5e0620..b46038764 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2236,7 +2236,7 @@ int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer){ if (call->params->realtimetext_enabled) _linphone_call_prepare_ice_for_stream(call,call->main_text_stream_index,TRUE); /*start ICE gathering*/ if (incoming_offer) - linphone_call_update_ice_from_remote_media_description(call,remote); /*this may delete the ice session*/ + linphone_call_update_ice_from_remote_media_description(call, remote, TRUE); /*this may delete the ice session*/ if (call->ice_session && !ice_session_candidates_gathered(call->ice_session)){ if (call->audiostream->ms.state==MSStreamInitialized) audio_stream_prepare_sound(call->audiostream, NULL, NULL); @@ -4309,8 +4309,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_update_ice_state_in_call_stats(call); } } else if (evt == ORTP_EVENT_ICE_RESTART_NEEDED) { - ice_session_restart(call->ice_session); - ice_session_set_role(call->ice_session, IR_Controlling); + ice_session_restart(call->ice_session, IR_Controlling); linphone_core_update_call(call->core, call, call->current_params); } } @@ -4846,6 +4845,7 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ /*First, make sure that the proxy from which we received this call, or to which we routed this call is registered*/ if (!call->dest_proxy || linphone_proxy_config_get_state(call->dest_proxy) != LinphoneRegistrationOk) return; + if (!call->core->media_network_reachable) return; switch (call->state){ case LinphoneCallStreamsRunning: @@ -4853,8 +4853,7 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ case LinphoneCallPausedByRemote: ms_message("LinphoneCall[%p] is going to be updated (reINVITE) in order to recover from lost connectivity", call); if (call->ice_session){ - ice_session_restart(call->ice_session); - ice_session_set_role(call->ice_session, IR_Controlling); + ice_session_restart(call->ice_session, IR_Controlling); } params = linphone_core_create_call_params(call->core, call); linphone_core_update_call(call->core, call, params); diff --git a/coreapi/misc.c b/coreapi/misc.c index df32829dc..9f5fece93 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -944,8 +944,7 @@ void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMedi } } -void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md) -{ +void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer){ const SalStreamDescription *stream; IceCheckList *cl = NULL; bool_t default_candidate = FALSE; @@ -975,14 +974,14 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, if (ice_params_found) { /* Check for ICE restart and set remote credentials. */ if ((strcmp(md->addr, "0.0.0.0") == 0) || (strcmp(md->addr, "::0") == 0)) { - ice_session_restart(call->ice_session); + ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); ice_restarted = TRUE; } else { for (i = 0; i < md->nb_streams; i++) { stream = &md->streams[i]; cl = ice_session_check_list(call->ice_session, i); if (cl && (strcmp(stream->rtp_addr, "0.0.0.0") == 0)) { - ice_session_restart(call->ice_session); + ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); ice_restarted = TRUE; break; } @@ -992,7 +991,7 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); } else if (ice_session_remote_credentials_changed(call->ice_session, md->ice_ufrag, md->ice_pwd)) { if (ice_restarted == FALSE) { - ice_session_restart(call->ice_session); + ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); ice_restarted = TRUE; } ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd); @@ -1005,8 +1004,8 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, if (ice_restarted == FALSE && ice_check_list_get_remote_ufrag(cl) && ice_check_list_get_remote_pwd(cl)) { - /* restart onlu if remote ufrag/paswd was already set*/ - ice_session_restart(call->ice_session); + /* restart only if remote ufrag/paswd was already set*/ + ice_session_restart(call->ice_session, is_offer ? IR_Controlled : IR_Controlling); ice_restarted = TRUE; } ice_check_list_set_remote_credentials(cl, stream->ice_ufrag, stream->ice_pwd); diff --git a/coreapi/private.h b/coreapi/private.h index 6f3dfe7ce..8730bb1df 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -487,7 +487,7 @@ void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEve void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDescription *result); void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy); void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call); -void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); +void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md, bool_t is_offer); void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md); bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md); diff --git a/mediastreamer2 b/mediastreamer2 index 7b1b79e27..c8c9ef1cd 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7b1b79e2767fd4dcfe2d3db3d6c5c20951ac4c7a +Subproject commit c8c9ef1cd2d0abc54f76a0ed4e035027ff5e8075 diff --git a/oRTP b/oRTP index 02ce979cf..83bf0a09c 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 02ce979cfdf80b68f1d13e1d0185bf2b827f4b7e +Subproject commit 83bf0a09cc2127086e15817d16793320c9fb9af0 diff --git a/tester/call_tester.c b/tester/call_tester.c index 8a7404714..1b0a59990 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -5474,7 +5474,6 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); MSList *lcs = NULL; - int ice_reinvite = use_ice ? 1 : 0; bool_t call_ok; lcs = ms_list_append(lcs, marie->lc); @@ -5508,11 +5507,22 @@ static void _call_with_network_switch(bool_t use_ice, bool_t with_socket_refresh linphone_core_set_network_reachable(marie->lc, TRUE); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 2)); - /*pauline shall receive a reINVITE to update the session*/ - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1+ice_reinvite)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1+ice_reinvite)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2+ice_reinvite)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2+ice_reinvite)); + if (use_ice){ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 3)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 3)); + /*now comes the ICE reINVITE*/ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 4)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 4)); + }else{ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); + } /*check that media is back*/ check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionInvalid); @@ -5539,7 +5549,7 @@ static void call_with_network_switch_and_socket_refresh(void){ _call_with_network_switch(TRUE, TRUE); } -static void call_with_sip_and_rtp_independant_switches(){ +static void call_with_sip_and_rtp_independant_switches(void){ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); MSList *lcs = NULL; @@ -5573,24 +5583,35 @@ static void call_with_sip_and_rtp_independant_switches(){ } /*marie looses the SIP network and reconnects*/ linphone_core_set_sip_network_reachable(marie->lc, FALSE); + linphone_core_set_media_network_reachable(marie->lc, FALSE); wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000); /*marie will reconnect and register*/ linphone_core_set_sip_network_reachable(marie->lc, TRUE); BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneRegistrationOk, 2)); - wait_for_until(marie->lc, pauline->lc, NULL, 0, 1000); + wait_for_until(marie->lc, pauline->lc, NULL, 0, 5000); /*at this stage, no reINVITE is expected to be send*/ - BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallUpdating, 1, int, "%i"); /*1: because of ICE reinvite*/ + BC_ASSERT_EQUAL(marie->stat.number_of_LinphoneCallUpdating, 0, int, "%i"); /*now we notify the a reconnection of media network*/ - linphone_core_set_media_network_reachable(marie->lc, FALSE); linphone_core_set_media_network_reachable(marie->lc, TRUE); - /*pauline shall receive a reINVITE to update the session*/ - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 2)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 2)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 3)); - BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 3)); + if (use_ice){ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 3)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 3)); + /*now comes the ICE reINVITE*/ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 4)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 4)); + }else{ + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallUpdating, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallUpdatedByRemote, 1)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2)); + BC_ASSERT_TRUE(wait_for(marie->lc, pauline->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); + } /*check that media is back*/ check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, LinphoneMediaDirectionInvalid); From cd3beba1c46a3e8b6bb33c762cdc062a2195aa8e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 25 Jan 2016 20:32:41 +0100 Subject: [PATCH 2/9] fix crash in handle_stream_events() where the MediaStream object is destroyed and recreated during the loop of event processing (typicall with ice events). --- coreapi/linphonecall.c | 34 +++++++++++++++++++++++++++++++--- mediastreamer2 | 2 +- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b46038764..dea6cd017 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -4368,6 +4368,28 @@ void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){ } } +static MediaStream * linphone_call_get_media_stream(LinphoneCall *call, int stream_index){ + if (stream_index == call->main_audio_stream_index) + return (MediaStream*)call->audiostream; + if (stream_index == call->main_video_stream_index) + return (MediaStream*)call->videostream; + if (stream_index == call->main_text_stream_index) + return (MediaStream*)call->textstream; + ms_error("linphone_call_get_media_stream(): no stream index %i", stream_index); + return NULL; +} + +static OrtpEvQueue *linphone_call_get_event_queue(LinphoneCall *call, int stream_index){ + if (stream_index == call->main_audio_stream_index) + return call->audiostream_app_evq; + if (stream_index == call->main_video_stream_index) + return call->videostream_app_evq; + if (stream_index == call->main_text_stream_index) + return call->textstream_app_evq; + ms_error("linphone_call_get_event_queue(): no stream index %i", stream_index); + return NULL; +} + void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){ MediaStream *ms = stream_index == call->main_audio_stream_index ? (MediaStream *)call->audiostream : (stream_index == call->main_video_stream_index ? (MediaStream *)call->videostream : (MediaStream *)call->textstream); OrtpEvQueue *evq; @@ -4396,11 +4418,15 @@ void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){ } } /*yes the event queue has to be taken at each iteration, because ice events may perform operations re-creating the streams*/ - while ((evq = stream_index == call->main_audio_stream_index ? call->audiostream_app_evq : (stream_index == call->main_video_stream_index ? call->videostream_app_evq : call->textstream_app_evq)) && (NULL != (ev=ortp_ev_queue_get(evq)))){ + while((evq = linphone_call_get_event_queue(call, stream_index)) != NULL && NULL != (ev=ortp_ev_queue_get(evq))){ OrtpEventType evt=ortp_event_get_type(ev); OrtpEventData *evd=ortp_event_get_data(ev); - int stats_index = stream_index == call->main_audio_stream_index ? LINPHONE_CALL_STATS_AUDIO : (stream_index == call->main_video_stream_index ? LINPHONE_CALL_STATS_VIDEO : LINPHONE_CALL_STATS_TEXT); + + /*and yes the MediaStream must be taken at each iteration, because it may have changed due to the handling of events + * in this loop*/ + ms = linphone_call_get_media_stream(call, stream_index); + if (ms) linphone_call_stats_fill(&call->stats[stats_index],ms,ev); linphone_call_notify_stats_updated(call,stats_index); @@ -4785,8 +4811,10 @@ MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index) return MSVideo; } else if (stream_index == call->main_text_stream_index) { return MSText; + } else if (stream_index == call->main_audio_stream_index){ + return MSAudio; } - return MSAudio; + return MSUnknownMedia; } RtpTransport* linphone_call_get_meta_rtp_transport(LinphoneCall *call, int stream_index) { diff --git a/mediastreamer2 b/mediastreamer2 index c8c9ef1cd..200c3523b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c8c9ef1cd2d0abc54f76a0ed4e035027ff5e8075 +Subproject commit 200c3523befdc4677bafc0eb074a75a3d3b7b0b5 From f5a8a0c803b4fa8233111f4ef2ef08f81cf07a2a Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 25 Jan 2016 21:49:02 +0100 Subject: [PATCH 3/9] don't notify periodical updates for non-established streams. --- coreapi/linphonecall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index dea6cd017..7e7ff388d 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -4166,17 +4166,17 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_upload_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_up_bw(ts)*1e-3) : 0.f; call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + if (as_active) linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; if (as) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + if (vs_active) linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; if (vs) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); + if (ts_active) linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; if (ts) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); From 2ce9d4ecc0a060680c91b8bd70ad3a43ee7075f5 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 25 Jan 2016 21:52:28 +0100 Subject: [PATCH 4/9] fix bug in stats update JNI upcall, since introduction of text stream --- coreapi/linphonecore_jni.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index a952908ac..94911a48d 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -944,8 +944,11 @@ public: callobj = getCall(env, call); if (stats->type == LINPHONE_CALL_STATS_AUDIO) env->CallVoidMethod(callobj, ljb->callSetAudioStatsId, statsobj); - else + else if (stats->type == LINPHONE_CALL_STATS_VIDEO){ env->CallVoidMethod(callobj, ljb->callSetVideoStatsId, statsobj); + }else{ + //text stats not updated yet. + } env->CallVoidMethod(lcData->listener, ljb->callStatsUpdatedId, lcData->core, callobj, statsobj); handle_possible_java_exception(env, lcData->listener); if (statsobj) env->DeleteLocalRef(statsobj); From b0ea18f83cd642243c5a2e1690d5cf95bfe55000 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 25 Jan 2016 22:34:19 +0100 Subject: [PATCH 5/9] update ms2 to workaround ICE regression --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 200c3523b..7d0ab1d08 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 200c3523befdc4677bafc0eb074a75a3d3b7b0b5 +Subproject commit 7d0ab1d08127fa40b299f6ec80895e016a62e6b7 From a6ae0d02d61c806bb7b305c6c69b3383f79c53bf Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 26 Jan 2016 15:23:02 +0100 Subject: [PATCH 6/9] Use correct namespaces and winmd name when building for Windows 10. --- tester/CMakeLists.txt | 10 +++- tester/liblinphone_tester_windows.cpp | 26 +++++----- tester/liblinphone_tester_windows.h | 68 +++++++++++++++------------ 3 files changed, 59 insertions(+), 45 deletions(-) diff --git a/tester/CMakeLists.txt b/tester/CMakeLists.txt index cacb65dee..ff819df51 100644 --- a/tester/CMakeLists.txt +++ b/tester/CMakeLists.txt @@ -89,6 +89,8 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") target_compile_options(linphone_tester_runtime PRIVATE "/wd4996") target_link_libraries(linphone_tester_runtime linphone_tester_static) set_target_properties(linphone_tester_runtime PROPERTIES VS_WINRT_COMPONENT TRUE) + set_target_properties(linphone_tester_runtime PROPERTIES LIBRARY_OUTPUT_NAME "BelledonneCommunications.Linphone.Tester") + set_target_properties(linphone_tester_runtime PROPERTIES LINK_FLAGS "/WINMDFILE:BelledonneCommunications.Linphone.Tester.winmd") install(TARGETS linphone_tester_runtime RUNTIME DESTINATION bin @@ -96,7 +98,13 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") ARCHIVE DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE ) - install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/linphone_tester_runtime.winmd" DESTINATION bin) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/BelledonneCommunications.Linphone.Tester.winmd" DESTINATION lib) + if(CMAKE_BUILD_TYPE STREQUAL "Debug") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/BelledonneCommunications.Linphone.Tester.pdb + DESTINATION lib + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + endif() else() add_executable(liblinphone_tester ${SOURCE_FILES}) set_target_properties(liblinphone_tester PROPERTIES LINKER_LANGUAGE CXX) diff --git a/tester/liblinphone_tester_windows.cpp b/tester/liblinphone_tester_windows.cpp index 790f696c8..015af02d2 100644 --- a/tester/liblinphone_tester_windows.cpp +++ b/tester/liblinphone_tester_windows.cpp @@ -2,7 +2,7 @@ #include "liblinphone_tester_windows.h" -using namespace linphone_tester_runtime; +using namespace BelledonneCommunications::Linphone::Tester; using namespace Platform; using namespace Windows::Foundation; using namespace Windows::Storage; @@ -14,7 +14,7 @@ using namespace Windows::System::Threading; static OutputTraceListener^ sTraceListener; -LibLinphoneTester^ LibLinphoneTester::_instance = ref new LibLinphoneTester(); +NativeTester^ NativeTester::_instance = ref new NativeTester(); static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args) { @@ -45,27 +45,27 @@ static void nativeOutputTraceHandler(int lev, const char *fmt, va_list args) } } -static void libLinphoneNativeOutputTraceHandler(OrtpLogLevel lev, const char *fmt, va_list args) +static void libLinphoneNativeOutputTraceHandler(const char *domain, OrtpLogLevel lev, const char *fmt, va_list args) { nativeOutputTraceHandler((int)lev, fmt, args); } -LibLinphoneTester::LibLinphoneTester() +NativeTester::NativeTester() { } -LibLinphoneTester::~LibLinphoneTester() +NativeTester::~NativeTester() { liblinphone_tester_uninit(); } -void LibLinphoneTester::setOutputTraceListener(OutputTraceListener^ traceListener) +void NativeTester::setOutputTraceListener(OutputTraceListener^ traceListener) { sTraceListener = traceListener; } -void LibLinphoneTester::initialize(StorageFolder^ writableDirectory, Platform::Boolean ui) +void NativeTester::initialize(StorageFolder^ writableDirectory, Platform::Boolean ui) { if (ui) { liblinphone_tester_init(nativeOutputTraceHandler); @@ -91,7 +91,7 @@ void LibLinphoneTester::initialize(StorageFolder^ writableDirectory, Platform::B } } -bool LibLinphoneTester::run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose) +bool NativeTester::run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose) { std::wstring all(L"ALL"); std::wstring wssuitename = suiteName->Data(); @@ -111,7 +111,7 @@ bool LibLinphoneTester::run(Platform::String^ suiteName, Platform::String^ caseN return bc_tester_run_tests(wssuitename == all ? 0 : csuitename, wscasename == all ? 0 : ccasename) != 0; } -void LibLinphoneTester::runAllToXml() +void NativeTester::runAllToXml() { auto workItem = ref new WorkItemHandler([this](IAsyncAction ^workItem) { bc_tester_start(NULL); @@ -120,12 +120,12 @@ void LibLinphoneTester::runAllToXml() _asyncAction = ThreadPool::RunAsync(workItem); } -unsigned int LibLinphoneTester::nbTestSuites() +unsigned int NativeTester::nbTestSuites() { return bc_tester_nb_suites(); } -unsigned int LibLinphoneTester::nbTests(Platform::String^ suiteName) +unsigned int NativeTester::nbTests(Platform::String^ suiteName) { std::wstring suitename = suiteName->Data(); char cname[MAX_SUITE_NAME_SIZE] = { 0 }; @@ -133,7 +133,7 @@ unsigned int LibLinphoneTester::nbTests(Platform::String^ suiteName) return bc_tester_nb_tests(cname); } -Platform::String^ LibLinphoneTester::testSuiteName(int index) +Platform::String^ NativeTester::testSuiteName(int index) { const char *cname = bc_tester_suite_name(index); wchar_t wcname[MAX_SUITE_NAME_SIZE]; @@ -141,7 +141,7 @@ Platform::String^ LibLinphoneTester::testSuiteName(int index) return ref new String(wcname); } -Platform::String^ LibLinphoneTester::testName(Platform::String^ suiteName, int testIndex) +Platform::String^ NativeTester::testName(Platform::String^ suiteName, int testIndex) { std::wstring suitename = suiteName->Data(); char csuitename[MAX_SUITE_NAME_SIZE] = { 0 }; diff --git a/tester/liblinphone_tester_windows.h b/tester/liblinphone_tester_windows.h index c7701143c..dec64cb48 100644 --- a/tester/liblinphone_tester_windows.h +++ b/tester/liblinphone_tester_windows.h @@ -3,39 +3,45 @@ #include "linphonecore.h" #include "liblinphone_tester.h" -namespace linphone_tester_runtime +namespace BelledonneCommunications { - public interface class OutputTraceListener + namespace Linphone { - public: - void outputTrace(Platform::String^ lev, Platform::String^ msg); - }; - - public ref class LibLinphoneTester sealed - { - public: - void setOutputTraceListener(OutputTraceListener^ traceListener); - unsigned int nbTestSuites(); - unsigned int nbTests(Platform::String^ suiteName); - Platform::String^ testSuiteName(int index); - Platform::String^ testName(Platform::String^ suiteName, int testIndex); - void initialize(Windows::Storage::StorageFolder^ writableDirectory, Platform::Boolean ui); - bool run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose); - void runAllToXml(); - - static property LibLinphoneTester^ Instance + namespace Tester { - LibLinphoneTester^ get() { return _instance; } - } - property Windows::Foundation::IAsyncAction^ AsyncAction - { - Windows::Foundation::IAsyncAction^ get() { return _asyncAction; } - } - private: - LibLinphoneTester(); - ~LibLinphoneTester(); + public interface class OutputTraceListener + { + public: + void outputTrace(Platform::String^ lev, Platform::String^ msg); + }; - static LibLinphoneTester^ _instance; - Windows::Foundation::IAsyncAction^ _asyncAction; - }; + public ref class NativeTester sealed + { + public: + void setOutputTraceListener(OutputTraceListener^ traceListener); + unsigned int nbTestSuites(); + unsigned int nbTests(Platform::String^ suiteName); + Platform::String^ testSuiteName(int index); + Platform::String^ testName(Platform::String^ suiteName, int testIndex); + void initialize(Windows::Storage::StorageFolder^ writableDirectory, Platform::Boolean ui); + bool run(Platform::String^ suiteName, Platform::String^ caseName, Platform::Boolean verbose); + void runAllToXml(); + + static property NativeTester^ Instance + { + NativeTester^ get() { return _instance; } + } + property Windows::Foundation::IAsyncAction^ AsyncAction + { + Windows::Foundation::IAsyncAction^ get() { return _asyncAction; } + } + private: + NativeTester(); + ~NativeTester(); + + static NativeTester^ _instance; + Windows::Foundation::IAsyncAction^ _asyncAction; + }; + } + } } \ No newline at end of file From 60e70816d222c650d89e453796fdc073be8b28b9 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 26 Jan 2016 15:23:22 +0100 Subject: [PATCH 7/9] Update ms2 submodule. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7d0ab1d08..b49feebe9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7d0ab1d08127fa40b299f6ec80895e016a62e6b7 +Subproject commit b49feebe9e76ea8605bee0ca4f5803083c119f01 From 0965d49f7a4611ddd86655f3d3f0e4c85062ff8e Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 26 Jan 2016 17:24:54 +0100 Subject: [PATCH 8/9] handle expired client dialogs for p2p presence, and report them for LinphoneEvent. remove deprecation of LinphoneChatMessageStateCb, since it is already marked as deprecated in all functions using it. fix a few warnings --- console/commands.c | 7 ++++--- console/linphonec.c | 2 +- coreapi/bellesip_sal/sal_op_events.c | 11 ++++++++++- coreapi/bellesip_sal/sal_op_presence.c | 11 ++++++++++- coreapi/linphonecore.h | 2 +- mediastreamer2 | 2 +- 6 files changed, 27 insertions(+), 8 deletions(-) diff --git a/console/commands.c b/console/commands.c index cf462b990..6f527831e 100644 --- a/console/commands.c +++ b/console/commands.c @@ -414,7 +414,8 @@ linphonec_parse_command_line(LinphoneCore *lc, char *cl) { while ( isdigit(*cl) || *cl == '#' || *cl == '*' ) { - linphone_core_send_dtmf(lc, *cl); + if (linphone_core_get_current_call(lc)) + linphone_call_send_dtmf(linphone_core_get_current_call(lc), *cl); linphone_core_play_dtmf (lc,*cl,100); ms_sleep(1); // be nice ++cl; @@ -2336,12 +2337,12 @@ static int lpc_cmd_echolimiter(LinphoneCore *lc, char *args){ static int lpc_cmd_mute_mic(LinphoneCore *lc, char *args) { - linphone_core_mute_mic(lc, 1); + linphone_core_enable_mic(lc, 0); return 1; } static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){ - linphone_core_mute_mic(lc, 0); + linphone_core_enable_mic(lc, 1); return 1; } diff --git a/console/linphonec.c b/console/linphonec.c index 709940269..ee7b76617 100644 --- a/console/linphonec.c +++ b/console/linphonec.c @@ -102,7 +102,7 @@ static int linphonec_main_loop (LinphoneCore * opm); static int linphonec_idle_call (void); #ifdef HAVE_READLINE static int linphonec_initialize_readline(void); -static int linphonec_finish_readline(); +static int linphonec_finish_readline(void); static char **linephonec_readline_completion(const char *text, int start, int end); #endif diff --git a/coreapi/bellesip_sal/sal_op_events.c b/coreapi/bellesip_sal/sal_op_events.c index 631e23b36..802e5d334 100644 --- a/coreapi/bellesip_sal/sal_op_events.c +++ b/coreapi/bellesip_sal/sal_op_events.c @@ -61,10 +61,20 @@ static void subscribe_process_io_error(void *user_ctx, const belle_sip_io_error_ } static void subscribe_process_dialog_terminated(void *ctx, const belle_sip_dialog_terminated_event_t *event) { + belle_sip_dialog_t *dialog = belle_sip_dialog_terminated_event_get_dialog(event); SalOp* op= (SalOp*)ctx; if (op->dialog) { op->dialog=NULL; + if (!belle_sip_dialog_is_server(dialog) && belle_sip_dialog_terminated_event_is_expired(event)){ + /*notify the app that our subscription is dead*/ + const char *eventname = NULL; + if (op->event){ + eventname = belle_sip_header_get_unparsed_value(op->event); + } + op->base.root->callbacks.notify(op, SalSubscribeTerminated, eventname, NULL); + } sal_op_unref(op); + } } @@ -198,7 +208,6 @@ int sal_subscribe(SalOp *op, const char *from, const char *to, const char *event if (!op->dialog){ sal_op_subscribe_fill_cbs(op); - /*???sal_exosip_fix_route(op); make sure to ha ;lr*/ req=sal_op_build_request(op,"SUBSCRIBE"); if( req == NULL ) { return -1; diff --git a/coreapi/bellesip_sal/sal_op_presence.c b/coreapi/bellesip_sal/sal_op_presence.c index f5ec79ad8..dab484b1a 100644 --- a/coreapi/bellesip_sal/sal_op_presence.c +++ b/coreapi/bellesip_sal/sal_op_presence.c @@ -58,8 +58,17 @@ static void presence_process_dialog_terminated(void *ctx, const belle_sip_dialog if (!op->op_released){ op->base.root->callbacks.subscribe_presence_closed(op, sal_op_get_from(op)); } + set_or_update_dialog(op, NULL); + }else{ + if (belle_sip_dialog_terminated_event_is_expired(event)){ + ms_warning("Outgoing presence subscription expired."); + if (op->refresher){ + /*send a new SUBSCRIBE, that will attempt to establish a new dialog*/ + sal_subscribe_presence(op,NULL,NULL,-1); + } + } } - set_or_update_dialog(op, NULL); + } } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index d4925f50a..255dbcf2b 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1252,7 +1252,7 @@ typedef enum _LinphoneChatMessageState { * @param ud application user data * @deprecated */ -typedef LINPHONE_DEPRECATED void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud); +typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud); /** * Call back used to notify message delivery status diff --git a/mediastreamer2 b/mediastreamer2 index b49feebe9..f3651d2c5 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b49feebe9e76ea8605bee0ca4f5803083c119f01 +Subproject commit f3651d2c516ca74edd310e3868fa74d1149744c8 From 0a9ab97bd46833f99dd67e2ae2f20118a1ee4ec3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 26 Jan 2016 21:32:55 +0100 Subject: [PATCH 9/9] keep using periodical updates (even for non-existent streams) at least for tests, because it is convenient to be notified everytime linphonecore updates bandwidth measurement. This may change in the future when bandwidth computations will be done in real time (every mediastreamer2 tick). --- coreapi/linphonecall.c | 27 +++++++++++++++------------ coreapi/linphonecore.c | 2 +- coreapi/private.h | 10 ++++++---- coreapi/upnp.c | 6 +++--- tester/call_tester.c | 15 +++++++-------- tester/liblinphone_tester.h | 2 -- tester/tester.c | 2 ++ 7 files changed, 34 insertions(+), 30 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 7e7ff388d..59af9315e 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -932,6 +932,7 @@ static void port_config_set(LinphoneCall *call, int stream_index, int min_port, static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){ int min_port, max_port; ms_message("New LinphoneCall [%p] initialized (LinphoneCore version: %s)",call,linphone_core_get_version()); + call->core->send_call_stats_periodical_updates = lp_config_get_int(call->core->config, "misc", "send_call_stats_periodical_updates", 0); call->main_audio_stream_index = LINPHONE_CALL_STATS_AUDIO; call->main_video_stream_index = LINPHONE_CALL_STATS_VIDEO; call->main_text_stream_index = LINPHONE_CALL_STATS_TEXT; @@ -4165,20 +4166,22 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_download_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_down_bw(ts)*1e-3) : 0.f; call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_upload_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_up_bw(ts)*1e-3) : 0.f; - call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - if (as_active) linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; - if (as) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); + if (call->core->send_call_stats_periodical_updates){ + call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; + if (as_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); - call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - if (vs_active) linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; - if (vs) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); + call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; + if (vs_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); - call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - if (ts_active) linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); - call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; - if (ts) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); + call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); + call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; + if (ts_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); + } ms_message( "Bandwidth usage for call [%p]:\n" diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 0584c9b4f..034057a47 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -7064,7 +7064,7 @@ void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *para params->realtimetext_enabled = linphone_core_realtime_text_enabled(lc); params->privacy=LinphonePrivacyDefault; params->avpf_enabled=linphone_core_get_avpf_mode(lc); - params->implicit_rtcp_fb = lp_config_get_int(lc->config,"rtp","rtcp_fb_implicit_rtcp_fb",TRUE); + params->implicit_rtcp_fb = lp_config_get_int(lc->config,"rtp","rtcp_fb_implicit_rtcp_fb",TRUE); params->audio_dir=LinphoneMediaDirectionSendRecv; params->video_dir=LinphoneMediaDirectionSendRecv; params->real_early_media=lp_config_get_int(lc->config,"misc","real_early_media",FALSE); diff --git a/coreapi/private.h b/coreapi/private.h index 8730bb1df..6f80e93ff 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -152,16 +152,17 @@ struct _LinphoneCallParams{ bool_t has_audio; bool_t has_video; bool_t avpf_enabled; /* RTCP feedback messages are enabled */ - bool_t implicit_rtcp_fb; + bool_t implicit_rtcp_fb; + bool_t real_early_media; /*send real media even during early media (for outgoing calls)*/ bool_t in_conference; /*in conference mode */ - bool_t low_bandwidth; bool_t no_user_consent;/*when set to TRUE an UPDATE request will be used instead of reINVITE*/ + uint16_t avpf_rr_interval; /*in milliseconds*/ - bool_t internal_call_update; /*use mark that call update was requested internally (might be by ice) - unused for the moment*/ bool_t video_multicast_enabled; + bool_t audio_multicast_enabled; bool_t realtimetext_enabled; bool_t update_call_when_ice_completed; @@ -930,7 +931,8 @@ struct _LinphoneCore bool_t ringstream_autorelease; bool_t vtables_running; - bool_t pad[3]; + bool_t send_call_stats_periodical_updates; + bool_t pad[2]; char localip[LINPHONE_IPADDR_SIZE]; int device_rotation; int max_calls; diff --git a/coreapi/upnp.c b/coreapi/upnp.c index ef8b544aa..b41b8292c 100644 --- a/coreapi/upnp.c +++ b/coreapi/upnp.c @@ -89,7 +89,7 @@ bool_t linphone_core_upnp_hook(void *data); void linphone_upnp_update(UpnpContext *ctx); bool_t linphone_upnp_is_blacklisted(UpnpContext *ctx); -UpnpPortBinding *linphone_upnp_port_binding_new(); +UpnpPortBinding *linphone_upnp_port_binding_new(void); UpnpPortBinding *linphone_upnp_port_binding_new_with_parameters(upnp_igd_ip_protocol protocol, int local_port, int external_port); UpnpPortBinding *linphone_upnp_port_binding_new_or_collect(MSList *list, upnp_igd_ip_protocol protocol, int local_port, int external_port); UpnpPortBinding *linphone_upnp_port_binding_copy(const UpnpPortBinding *port); @@ -1089,7 +1089,7 @@ int linphone_core_update_local_media_description_from_upnp(SalMediaDescription * * uPnP Port Binding */ -UpnpPortBinding *linphone_upnp_port_binding_new() { +UpnpPortBinding *linphone_upnp_port_binding_new(void) { UpnpPortBinding *port = NULL; port = ms_new0(UpnpPortBinding,1); ms_mutex_init(&port->mutex, NULL); @@ -1221,7 +1221,7 @@ void linphone_upnp_port_binding_release(UpnpPortBinding *port) { * uPnP Stream */ -UpnpStream* linphone_upnp_stream_new() { +UpnpStream* linphone_upnp_stream_new(void) { UpnpStream *stream = ms_new0(UpnpStream,1); stream->state = LinphoneUpnpStateIdle; stream->rtp = NULL; diff --git a/tester/call_tester.c b/tester/call_tester.c index 1b0a59990..f015d5285 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -43,6 +43,7 @@ extern void libmsopenh264_init(void); #endif #endif + void call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg){ char* to=linphone_address_as_string(linphone_call_get_call_log(call)->to); char* from=linphone_address_as_string(linphone_call_get_call_log(call)->from); @@ -96,9 +97,6 @@ void call_stats_updated(LinphoneCore *lc, LinphoneCall *call, const LinphoneCall int tab_size = sizeof (counters->audio_download_bandwidth)/sizeof(int); int index = (counters->current_bandwidth_index++) % tab_size; - counters->current_audio_download_bandwidth = counters->audio_download_bandwidth + index; - counters->current_audio_upload_bandwidth = counters->audio_upload_bandwidth +index; - counters->audio_download_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->download_bandwidth; counters->audio_upload_bandwidth[index] = (int)linphone_call_get_audio_stats(call)->upload_bandwidth; counters->video_download_bandwidth[index] = (int)linphone_call_get_video_stats(call)->download_bandwidth; @@ -532,7 +530,7 @@ static void call_outbound_with_multiple_proxy(void) { LinphoneProxyConfig* lpc = NULL; LinphoneProxyConfig* registered_lpc = linphone_core_create_proxy_config(marie->lc); - linphone_core_get_default_proxy(marie->lc, &lpc); + lpc = linphone_core_get_default_proxy_config(marie->lc); linphone_core_set_default_proxy(marie->lc,NULL); BC_ASSERT_FATAL(lpc != NULL); @@ -824,7 +822,7 @@ static void simple_call_compatibility_mode(void) { char*tmp; LCSipTransports transport; - linphone_core_get_default_proxy(lc_marie,&proxy); + proxy = linphone_core_get_default_proxy_config(lc_marie); BC_ASSERT_PTR_NOT_NULL (proxy); identity = linphone_proxy_config_get_identity_address(proxy); @@ -1466,7 +1464,8 @@ static void call_paused_resumed_with_video_base(bool_t sdp_200_ack vpol.automatically_initiate = TRUE; /* needed to present a video mline*/ linphone_core_set_video_policy(marie->lc, &vpol); - linphone_core_enable_video(marie->lc, TRUE, TRUE); + linphone_core_enable_video_capture(marie->lc, TRUE); + linphone_core_enable_video_display(marie->lc, TRUE); vpol.automatically_accept = FALSE; vpol.automatically_initiate = TRUE; @@ -2696,7 +2695,7 @@ static void call_with_privacy(void) { end_call(pauline, marie); /*test proxy config privacy*/ - linphone_core_get_default_proxy(pauline->lc,&pauline_proxy); + pauline_proxy = linphone_core_get_default_proxy_config(pauline->lc); linphone_proxy_config_set_privacy(pauline_proxy,LinphonePrivacyId); BC_ASSERT_TRUE(call(pauline,marie)); @@ -2730,7 +2729,7 @@ static void call_with_privacy2(void) { params=linphone_core_create_call_params(pauline->lc, NULL); linphone_call_params_set_privacy(params,LinphonePrivacyId); - linphone_core_get_default_proxy(pauline->lc,&pauline_proxy); + pauline_proxy = linphone_core_get_default_proxy_config(pauline->lc); linphone_proxy_config_edit(pauline_proxy); linphone_proxy_config_enable_register(pauline_proxy,FALSE); linphone_proxy_config_done(pauline_proxy); diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index d16134b4e..ee1b2eec8 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -234,9 +234,7 @@ typedef struct _stats { int number_of_LinphoneCoreLogCollectionUploadStateNotDelivered; int number_of_LinphoneCoreLogCollectionUploadStateInProgress; int audio_download_bandwidth[3]; - int *current_audio_download_bandwidth; int audio_upload_bandwidth[3]; - int *current_audio_upload_bandwidth; int video_download_bandwidth[3]; int video_upload_bandwidth[3]; diff --git a/tester/tester.c b/tester/tester.c index 40f1461e2..edc63322b 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -327,6 +327,8 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { } linphone_core_set_user_certificates_path(mgr->lc,bc_tester_get_writable_dir_prefix()); + /*for now, we need the periodical updates facility to compute bandwidth measurements correctly during tests*/ + lp_config_set_int(linphone_core_get_config(mgr->lc), "misc", "send_call_stats_periodical_updates", 1); if (rc_path) ms_free(rc_path); }