Commit 15b915e0 authored by jehan's avatar jehan

-No longer rewrite callparams->has_video, but use dedicated params to save...

-No longer rewrite callparams->has_video, but use dedicated params to save offers answer result regarding video
-Invoke FIR in method linphone_core_send_vfu_request
-Invoke CallStatsUpdated even in case of scheduled updates
-Fix media direction in case of paused/resumed with paused by « inactive »
parent 706ed3cf
......@@ -491,8 +491,6 @@ static void call_accepted(SalOp *op){
#endif //BUILD_UPNP
md=sal_call_get_final_media_description(op);
if (md) /*make sure re-invite will not propose video again*/
call->params->has_video &= linphone_core_media_description_contains_video_stream(md);
switch (call->state){
case LinphoneCallOutgoingProgress:
......
......@@ -647,7 +647,7 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
ms_warning("Cannot get audio local ssrc for call [%p]",call);
nb_active_streams++;
if (call->params->has_video){
if (call->params->has_video && (!call->params->internal_call_update || !call->current_params->video_declined)){
strncpy(md->streams[1].rtp_addr,linphone_call_get_public_ip_for_stream(call,1),sizeof(md->streams[1].rtp_addr));
strncpy(md->streams[1].rtcp_addr,linphone_call_get_public_ip_for_stream(call,1),sizeof(md->streams[1].rtcp_addr));
strncpy(md->streams[1].name,"Video",sizeof(md->streams[1].name)-1);
......@@ -670,6 +670,8 @@ void linphone_call_make_local_media_description(LinphoneCore *lc, LinphoneCall *
else
ms_warning("Cannot get video local ssrc for call [%p]",call);
nb_active_streams++;
} else {
ms_message("Don't put video stream on local offer for call [%p]",call);
}
if (md->nb_streams < nb_active_streams)
......@@ -973,7 +975,6 @@ static void linphone_call_incoming_select_ip_version(LinphoneCall *call){
*/
void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, const SalMediaDescription *md) {
int i;
call->params->has_video &= linphone_core_media_description_contains_video_stream(md);
/* Handle AVPF, SRTP and DTLS. */
call->params->avpf_enabled = sal_media_description_has_avpf(md);
......@@ -1171,8 +1172,11 @@ static void linphone_call_set_terminated(LinphoneCall *call){
}
void linphone_call_fix_call_parameters(LinphoneCall *call){
call->params->has_video=call->current_params->has_video;
if (sal_call_is_offerer(call->op)) {
/*get remote params*/
const LinphoneCallParams* lcp = linphone_call_get_remote_params(call);
call->current_params->video_declined = call->params->has_video && !lcp->has_video;
}
switch(call->params->media_encryption) {
case LinphoneMediaEncryptionZRTP:
case LinphoneMediaEncryptionDTLS:
......@@ -1669,7 +1673,11 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){
**/
void linphone_call_send_vfu_request(LinphoneCall *call) {
#ifdef VIDEO_ENABLED
if (call->core->sip_conf.vfu_with_info) {
const LinphoneCallParams *current_params = linphone_call_get_current_params(call);
if (current_params->avpf_enabled && call->videostream && media_stream_get_state((const MediaStream *)call->videostream) == MSStreamStarted) {
ms_message("Request Full Intra Request on call [%p]", call);
video_stream_send_fir(call->videostream);
} else if (call->core->sip_conf.vfu_with_info) {
if (LinphoneCallStreamsRunning == linphone_call_get_state(call))
sal_call_send_vfu_request(call->op);
} else {
......@@ -3313,6 +3321,17 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v
call->stats[LINPHONE_CALL_STATS_AUDIO].rtcp_upload_bandwidth=(as_active) ? (media_stream_get_rtcp_up_bw(as)*1e-3) : 0;
call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_download_bandwidth=(vs_active) ? (media_stream_get_rtcp_down_bw(vs)*1e-3) : 0;
call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_upload_bandwidth=(vs_active) ? (media_stream_get_rtcp_up_bw(vs)*1e-3) : 0;
if (as_active) {
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 (vs_active) {
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;
}
ms_message( "Bandwidth usage for call [%p]:\n"
"\tRTP audio=[d=%5.1f,u=%5.1f], video=[d=%5.1f,u=%5.1f] kbits/sec\n"
......@@ -3327,6 +3346,7 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v
call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_download_bandwidth,
call->stats[LINPHONE_CALL_STATS_VIDEO].rtcp_upload_bandwidth
);
}
static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
......@@ -3394,6 +3414,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
ice_session_select_candidates(call->ice_session);
if (ice_session_role(call->ice_session) == IR_Controlling
&& lp_config_get_int(call->core->config, "sip", "update_call_when_ice_completed", TRUE)) {
params->internal_call_update = TRUE;
linphone_core_update_call(call->core, call, params);
}
change_ice_media_destinations(call);
......@@ -3404,6 +3425,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
ice_session_select_candidates(call->ice_session);
if (ice_session_role(call->ice_session) == IR_Controlling) {
/* At least one ICE session has succeeded, so perform a call update. */
params->internal_call_update = TRUE;
linphone_core_update_call(call->core, call, params);
}
}
......@@ -3499,7 +3521,13 @@ void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){
LinphoneCallStats *stats=&call->stats[stream_index];
LinphoneCore *lc=call->core;
if (stats->updated){
linphone_reporting_on_rtcp_update(call, stream_index);
switch(stats->updated) {
case LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE:
case LINPHONE_CALL_STATS_SENT_RTCP_UPDATE:
linphone_reporting_on_rtcp_update(call, stream_index);
break;
default:break;
}
linphone_core_notify_call_stats_updated(lc, call, stats);
stats->updated = 0;
}
......@@ -3563,18 +3591,29 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
int disconnect_timeout = linphone_core_get_nortp_timeout(call->core);
bool_t disconnected=FALSE;
if ((call->state==LinphoneCallStreamsRunning || call->state==LinphoneCallOutgoingEarlyMedia || call->state==LinphoneCallIncomingEarlyMedia) && one_second_elapsed){
float audio_load=0, video_load=0;
if (call->audiostream!=NULL){
if (call->audiostream->ms.sessions.ticker)
audio_load=ms_ticker_get_average_load(call->audiostream->ms.sessions.ticker);
}
if (call->videostream!=NULL){
if (call->videostream->ms.sessions.ticker)
video_load=ms_ticker_get_average_load(call->videostream->ms.sessions.ticker);
switch (call->state) {
case LinphoneCallStreamsRunning:
case LinphoneCallOutgoingEarlyMedia:
case LinphoneCallIncomingEarlyMedia:
case LinphoneCallPausedByRemote:
case LinphoneCallPaused:
if (one_second_elapsed){
float audio_load=0, video_load=0;
if (call->audiostream!=NULL){
if (call->audiostream->ms.sessions.ticker)
audio_load=ms_ticker_get_average_load(call->audiostream->ms.sessions.ticker);
}
if (call->videostream!=NULL){
if (call->videostream->ms.sessions.ticker)
video_load=ms_ticker_get_average_load(call->videostream->ms.sessions.ticker);
}
report_bandwidth(call,(MediaStream*)call->audiostream,(MediaStream*)call->videostream);
ms_message("Thread processing load: audio=%f\tvideo=%f",audio_load,video_load);
}
report_bandwidth(call,(MediaStream*)call->audiostream,(MediaStream*)call->videostream);
ms_message("Thread processing load: audio=%f\tvideo=%f",audio_load,video_load);
break;
default:
/*no stats for other states*/
break;
}
#ifdef BUILD_UPNP
......
......@@ -3643,7 +3643,6 @@ int _linphone_core_accept_call_update(LinphoneCore *lc, LinphoneCall *call, cons
ms_warning("Video isn't supported in conference");
call->params->has_video = FALSE;
}
call->params->has_video &= linphone_core_media_description_contains_video_stream(remote_desc);
linphone_call_init_media_streams(call); /*so that video stream is initialized if necessary*/
if (call->ice_session != NULL) {
if (linphone_call_prepare_ice(call,TRUE)==1)
......@@ -6890,9 +6889,7 @@ const char *linphone_media_encryption_to_string(LinphoneMediaEncryption menc){
return "INVALID";
}
/**
* Returns whether a media encryption scheme is supported by the LinphoneCore engine
**/
bool_t linphone_core_media_encryption_supported(const LinphoneCore *lc, LinphoneMediaEncryption menc){
switch(menc){
case LinphoneMediaEncryptionSRTP:
......
......@@ -513,6 +513,7 @@ typedef enum _LinphoneUpnpState LinphoneUpnpState;
#define LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE (1 << 0) /**< received_rtcp field of LinphoneCallStats object has been updated */
#define LINPHONE_CALL_STATS_SENT_RTCP_UPDATE (1 << 1) /**< sent_rtcp field of LinphoneCallStats object has been updated */
#define LINPHONE_CALL_STATS_PERIODICAL_UPDATE (1 << 2) /**< Every seconds LinphoneCallStats object has been updated */
/**
......@@ -529,7 +530,7 @@ typedef struct _LinphoneCallStats LinphoneCallStats;
* The LinphoneCallStats objects carries various statistic informations regarding quality of audio or video streams.
*
* To receive these informations periodically and as soon as they are computed, the application is invited to place a #LinphoneCoreCallStatsUpdatedCb callback in the LinphoneCoreVTable structure
* it passes for instanciating the LinphoneCore object (see linphone_core_new() ).
* it passes for instantiating the LinphoneCore object (see linphone_core_new() ).
*
* At any time, the application can access last computed statistics using linphone_call_get_audio_stats() or linphone_call_get_video_stats().
**/
......
......@@ -110,6 +110,8 @@ struct _LinphoneCallParams{
LinphonePrivacyMask privacy;
LinphoneMediaDirection audio_dir;
LinphoneMediaDirection video_dir;
bool_t video_declined; /*use to keep traces of declined video to avoid to re-offer video in case of automatic RE-INVITE*/
bool_t internal_call_update; /*use mark that call update was requested internally (might be by ice)*/
};
......@@ -438,6 +440,9 @@ void linphone_core_stop_waiting(LinphoneCore *lc);
int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy);
int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, const LinphoneAddress* destination/* = NULL if to be taken from the call log */);
int linphone_core_restart_invite(LinphoneCore *lc, LinphoneCall *call);
/*
* param automatic_offering aims is to take into account previous answer for video in case of automatic re-invite.
* Purpose is to avoid to re-ask video previously declined */
int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState next_state, const char *state_info);
void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call);
......
This diff is collapsed.
......@@ -202,6 +202,7 @@ typedef struct _stats {
char * dtmf_list_received;
int dtmf_count;
int number_of_LinphoneCallStatsUpdated;
int number_of_rtcp_sent;
int number_of_rtcp_received;
......
......@@ -259,6 +259,26 @@ LinphoneCoreManager* linphone_core_manager_init(const char* rc_file) {
linphone_core_set_ringback(mgr->lc, NULL);
#endif
#ifdef VIDEO_ENABLED
{
MSWebCam *cam;
#ifdef _MSC_VER
extern __declspec(dllimport) MSWebCamDesc mire_desc;
#else
extern MSWebCamDesc mire_desc;
#endif
cam = ms_web_cam_manager_get_cam(ms_web_cam_manager_get(), "Mire: Mire (synthetic moving picture)");
if (cam == NULL) {
cam=ms_web_cam_new(&mire_desc);
ms_web_cam_manager_add_cam(ms_web_cam_manager_get(),cam);
}
}
#endif
if( manager_count >= 2){
char hellopath[512];
char *recordpath = ms_strdup_printf("%s/record_for_lc_%p.wav",bc_tester_writable_dir_prefix,mgr->lc);
......
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