Commit 0a9ab97b authored by Simon Morlat's avatar Simon Morlat
Browse files

keep using periodical updates (even for non-existent streams) at least for...

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).
parent 0965d49f
......@@ -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"
......
......@@ -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);
......
......@@ -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;
......
......@@ -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;
......
......@@ -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);
......
......@@ -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];
......
......@@ -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);
}
......
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