mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 07:08:11 +00:00
display MSTicker's load each second
This commit is contained in:
parent
85a7e928de
commit
9fe0c5b8d2
4 changed files with 62 additions and 49 deletions
|
|
@ -1121,3 +1121,61 @@ float linphone_call_get_record_volume(LinphoneCall *call){
|
|||
return LINPHONE_VOLUME_DB_LOWEST;
|
||||
}
|
||||
|
||||
|
||||
static void display_bandwidth(RtpSession *as, RtpSession *vs){
|
||||
ms_message("bandwidth usage: audio=[d=%.1f,u=%.1f] video=[d=%.1f,u=%.1f] kbit/sec",
|
||||
(as!=NULL) ? (rtp_session_compute_recv_bandwidth(as)*1e-3) : 0,
|
||||
(as!=NULL) ? (rtp_session_compute_send_bandwidth(as)*1e-3) : 0,
|
||||
(vs!=NULL) ? (rtp_session_compute_recv_bandwidth(vs)*1e-3) : 0,
|
||||
(vs!=NULL) ? (rtp_session_compute_send_bandwidth(vs)*1e-3) : 0);
|
||||
}
|
||||
|
||||
static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
|
||||
char temp[256];
|
||||
char *from=NULL;
|
||||
if(call)
|
||||
from = linphone_call_get_remote_address_as_string(call);
|
||||
if (from)
|
||||
{
|
||||
snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from);
|
||||
free(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(temp,sizeof(temp),"Remote end seems to have disconnected, the call is going to be closed.");
|
||||
}
|
||||
if (lc->vtable.display_warning!=NULL)
|
||||
lc->vtable.display_warning(lc,temp);
|
||||
linphone_core_terminate_call(lc,call);
|
||||
}
|
||||
|
||||
void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed){
|
||||
int disconnect_timeout = linphone_core_get_nortp_timeout(call->core);
|
||||
bool_t disconnected=FALSE;
|
||||
|
||||
if (call->state==LinphoneCallStreamsRunning && one_second_elapsed){
|
||||
RtpSession *as=NULL,*vs=NULL;
|
||||
float audio_load=0, video_load=0;
|
||||
if (call->audiostream!=NULL){
|
||||
as=call->audiostream->session;
|
||||
if (call->audiostream->ticker)
|
||||
audio_load=ms_ticker_get_average_load(call->audiostream->ticker);
|
||||
}
|
||||
if (call->videostream!=NULL){
|
||||
if (call->videostream->ticker)
|
||||
video_load=ms_ticker_get_average_load(call->videostream->ticker);
|
||||
vs=call->videostream->session;
|
||||
}
|
||||
display_bandwidth(as,vs);
|
||||
ms_message("Thread processing load: audio=%f\tvideo=%f",audio_load,video_load);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
if (call->videostream!=NULL)
|
||||
video_stream_iterate(call->videostream);
|
||||
#endif
|
||||
if (one_second_elapsed && call->audiostream!=NULL && disconnect_timeout>0 )
|
||||
disconnected=!audio_stream_alive(call->audiostream,disconnect_timeout);
|
||||
if (disconnected)
|
||||
linphone_core_disconnected(call->core,call);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1487,32 +1487,6 @@ void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val){
|
|||
}
|
||||
}
|
||||
|
||||
static void display_bandwidth(RtpSession *as, RtpSession *vs){
|
||||
ms_message("bandwidth usage: audio=[d=%.1f,u=%.1f] video=[d=%.1f,u=%.1f] kbit/sec",
|
||||
(as!=NULL) ? (rtp_session_compute_recv_bandwidth(as)*1e-3) : 0,
|
||||
(as!=NULL) ? (rtp_session_compute_send_bandwidth(as)*1e-3) : 0,
|
||||
(vs!=NULL) ? (rtp_session_compute_recv_bandwidth(vs)*1e-3) : 0,
|
||||
(vs!=NULL) ? (rtp_session_compute_send_bandwidth(vs)*1e-3) : 0);
|
||||
}
|
||||
|
||||
static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
|
||||
char temp[256];
|
||||
char *from=NULL;
|
||||
if(call)
|
||||
from = linphone_call_get_remote_address_as_string(call);
|
||||
if(from)
|
||||
{
|
||||
snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from);
|
||||
free(from);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(temp,sizeof(temp),"Remote end seems to have disconnected, the call is going to be closed.");
|
||||
}
|
||||
if (lc->vtable.display_warning!=NULL)
|
||||
lc->vtable.display_warning(lc,temp);
|
||||
linphone_core_terminate_call(lc,call);
|
||||
}
|
||||
|
||||
static void monitor_network_state(LinphoneCore *lc, time_t curtime){
|
||||
static time_t last_check=0;
|
||||
|
|
@ -1639,11 +1613,9 @@ static void linphone_core_do_plugin_tasks(LinphoneCore *lc){
|
|||
void linphone_core_iterate(LinphoneCore *lc){
|
||||
MSList *calls;
|
||||
LinphoneCall *call;
|
||||
int disconnect_timeout = linphone_core_get_nortp_timeout(lc);
|
||||
time_t curtime=time(NULL);
|
||||
int elapsed;
|
||||
bool_t one_second_elapsed=FALSE;
|
||||
bool_t disconnected=FALSE;
|
||||
|
||||
if (curtime-lc->prevtime>=1){
|
||||
lc->prevtime=curtime;
|
||||
|
|
@ -1706,24 +1678,7 @@ void linphone_core_iterate(LinphoneCore *lc){
|
|||
}
|
||||
call = linphone_core_get_current_call(lc);
|
||||
if(call)
|
||||
{
|
||||
if (call->state==LinphoneCallStreamsRunning && one_second_elapsed)
|
||||
{
|
||||
RtpSession *as=NULL,*vs=NULL;
|
||||
lc->prevtime=curtime;
|
||||
if (call->audiostream!=NULL)
|
||||
as=call->audiostream->session;
|
||||
if (call->videostream!=NULL)
|
||||
vs=call->videostream->session;
|
||||
display_bandwidth(as,vs);
|
||||
}
|
||||
#ifdef VIDEO_ENABLED
|
||||
if (call->videostream!=NULL)
|
||||
video_stream_iterate(call->videostream);
|
||||
#endif
|
||||
if (call->audiostream!=NULL && disconnect_timeout>0)
|
||||
disconnected=!audio_stream_alive(call->audiostream,disconnect_timeout);
|
||||
}
|
||||
linphone_call_background_tasks(call,one_second_elapsed);
|
||||
if (linphone_core_video_preview_enabled(lc)){
|
||||
if (lc->previewstream==NULL && lc->calls==NULL)
|
||||
toggle_video_preview(lc,TRUE);
|
||||
|
|
@ -1734,8 +1689,6 @@ void linphone_core_iterate(LinphoneCore *lc){
|
|||
if (lc->previewstream!=NULL)
|
||||
toggle_video_preview(lc,FALSE);
|
||||
}
|
||||
if (disconnected)
|
||||
linphone_core_disconnected(lc,call);
|
||||
|
||||
linphone_core_run_hooks(lc);
|
||||
linphone_core_do_plugin_tasks(lc);
|
||||
|
|
|
|||
|
|
@ -480,6 +480,8 @@ LinphoneEcCalibratorStatus ec_calibrator_get_status(EcCalibrator *ecc);
|
|||
|
||||
void ec_calibrator_destroy(EcCalibrator *ecc);
|
||||
|
||||
void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed);
|
||||
|
||||
#define HOLD_OFF (0)
|
||||
#define HOLD_ON (1)
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 3564b6ff2ca81094706348ce7be621a5c08c336a
|
||||
Subproject commit bbde91a403ae91f115058ff0ed9de90137d0b6f9
|
||||
Loading…
Add table
Reference in a new issue