forked from mirrors/linphone-iphone
Merge branch 'master' of git.linphone.org:linphone
Conflicts: coreapi/remote_provisioning.c
This commit is contained in:
commit
03b0be72e9
5 changed files with 56 additions and 33 deletions
|
|
@ -555,14 +555,11 @@ static void transfer_already_assigned_payload_types(SalMediaDescription *old, Sa
|
|||
|
||||
static const char *linphone_call_get_bind_ip_for_stream(LinphoneCall *call, int stream_index){
|
||||
const char *bind_ip=call->af==AF_INET6 ? "::0" : "0.0.0.0";
|
||||
|
||||
|
||||
if (stream_index<2 && call->media_ports[stream_index].multicast_ip[0]!='\0'){
|
||||
if (call->dir==LinphoneCallOutgoing){
|
||||
/*as multicast sender, we must decide a local interface to use to send multicast, and bind to it*/
|
||||
/*as multicast sender, we must decide a local interface to use to send multicast, and bind to it*/
|
||||
bind_ip=call->localip;
|
||||
}else{
|
||||
/*as receiver, just bind to the multicast address*/
|
||||
bind_ip=call->media_ports[stream_index].multicast_ip;
|
||||
}
|
||||
}
|
||||
return bind_ip;
|
||||
|
|
@ -1003,8 +1000,8 @@ void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, c
|
|||
if (md->streams[i].rtp_addr[i]!='\0' && ms_is_multicast(md->streams[i].rtp_addr)) {
|
||||
strncpy(call->media_ports[i].multicast_ip,md->streams[i].rtp_addr,sizeof(call->media_ports[i].multicast_ip));
|
||||
ms_message("Disabling rtcp on call [%p], stream [%i] because of multicast",call,i);
|
||||
call->media_ports[i].rtp_port=md->streams[i].rtp_port;
|
||||
call->media_ports[i].rtcp_port=0;
|
||||
call->media_ports[i].mcast_rtp_port=md->streams[i].rtp_port;
|
||||
call->media_ports[i].mcast_rtcp_port=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1844,7 +1841,12 @@ int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer){
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*eventually join to a multicast group if told to do so*/
|
||||
static void linphone_call_join_multicast_group(LinphoneCall *call, int stream_index, MediaStream *ms){
|
||||
if (call->media_ports[stream_index].multicast_ip[stream_index]!='\0' && call->media_ports[stream_index].mcast_rtp_port!=0){
|
||||
media_stream_join_multicast_group(ms, call->media_ports[stream_index].multicast_ip);
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_call_init_audio_stream(LinphoneCall *call){
|
||||
LinphoneCore *lc=call->core;
|
||||
|
|
@ -1859,7 +1861,10 @@ void linphone_call_init_audio_stream(LinphoneCall *call){
|
|||
if (call->audiostream != NULL) return;
|
||||
if (call->sessions[0].rtp_session==NULL){
|
||||
call->audiostream=audiostream=audio_stream_new2(linphone_call_get_bind_ip_for_stream(call,0),
|
||||
call->media_ports[0].rtp_port, call->media_ports[0].rtcp_port);
|
||||
call->media_ports[0].mcast_rtp_port ? call->media_ports[0].mcast_rtp_port : call->media_ports[0].rtp_port,
|
||||
call->media_ports[0].mcast_rtcp_port ? call->media_ports[0].mcast_rtcp_port : call->media_ports[0].rtcp_port);
|
||||
linphone_call_join_multicast_group(call, 0, &audiostream->ms);
|
||||
|
||||
cname = linphone_address_as_string_uri_only(call->me);
|
||||
audio_stream_set_rtcp_information(call->audiostream, cname, rtcp_tool);
|
||||
ms_free(cname);
|
||||
|
|
@ -1965,7 +1970,9 @@ void linphone_call_init_video_stream(LinphoneCall *call){
|
|||
|
||||
if (call->sessions[1].rtp_session==NULL){
|
||||
call->videostream=video_stream_new2(linphone_call_get_bind_ip_for_stream(call,1),
|
||||
call->media_ports[1].rtp_port,call->media_ports[1].rtcp_port);
|
||||
call->media_ports[1].mcast_rtp_port>0 ? call->media_ports[1].mcast_rtp_port : call->media_ports[1].rtp_port,
|
||||
call->media_ports[1].mcast_rtcp_port>0 ? call->media_ports[1].mcast_rtcp_port : call->media_ports[1].rtcp_port);
|
||||
linphone_call_join_multicast_group(call, 1, &call->videostream->ms);
|
||||
cname = linphone_address_as_string_uri_only(call->me);
|
||||
video_stream_set_rtcp_information(call->videostream, cname, rtcp_tool);
|
||||
ms_free(cname);
|
||||
|
|
|
|||
|
|
@ -203,6 +203,8 @@ typedef struct StunCandidate{
|
|||
|
||||
typedef struct _PortConfig{
|
||||
char multicast_ip[LINPHONE_IPADDR_SIZE];
|
||||
int mcast_rtp_port;
|
||||
int mcast_rtcp_port;
|
||||
int rtp_port;
|
||||
int rtcp_port;
|
||||
}PortConfig;
|
||||
|
|
|
|||
|
|
@ -60,33 +60,38 @@ static void linphone_remote_provisioning_apply(LinphoneCore *lc, const char *xml
|
|||
, error_msg);
|
||||
}
|
||||
|
||||
static char *load_file_content(const char *path){
|
||||
FILE *f=fopen(path,"rb");
|
||||
size_t bufsize=2048;
|
||||
size_t step=bufsize;
|
||||
size_t pos=0;
|
||||
size_t count;
|
||||
char *buffer=ms_malloc(bufsize+1);
|
||||
if (!f) {
|
||||
ms_error("load_file_content(): could not open [%s]",path);
|
||||
return NULL;
|
||||
}
|
||||
while((count=fread(buffer+pos, 1, step, f))>0){
|
||||
pos+=count;
|
||||
if (pos+step>=bufsize){
|
||||
bufsize*=2;
|
||||
buffer=ms_realloc(buffer, bufsize+1);
|
||||
}
|
||||
}
|
||||
buffer[pos]='\0';
|
||||
fclose(f);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
int linphone_remote_provisioning_load_file( LinphoneCore* lc, const char* file_path){
|
||||
int status = -1;
|
||||
FILE* f = fopen(file_path, "rb");
|
||||
char* provisioning=load_file_content(file_path);
|
||||
|
||||
if ( f ){
|
||||
long fsize;
|
||||
char* provisioning;
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
fsize = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
provisioning = ms_malloc(fsize + 1);
|
||||
provisioning[fsize]='\0';
|
||||
if (fread(provisioning, fsize, 1, f)==0){
|
||||
ms_error("Could not read xml provisioning file from %s",file_path);
|
||||
status=-1;
|
||||
}else{
|
||||
linphone_remote_provisioning_apply(lc, provisioning);
|
||||
status = 0;
|
||||
}
|
||||
if (provisioning){
|
||||
linphone_remote_provisioning_apply(lc, provisioning);
|
||||
status = 0;
|
||||
ms_free(provisioning);
|
||||
fclose(f);
|
||||
} else {
|
||||
ms_error("Couldn't open file %s for provisioning", file_path);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3272,7 +3272,7 @@ static void call_with_in_dialog_codec_change_base(bool_t no_sdp) {
|
|||
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallUpdatedByRemote,1));
|
||||
CU_ASSERT_TRUE(wait_for(marie->lc,pauline->lc,&pauline->stat.number_of_LinphoneCallStreamsRunning,2));
|
||||
CU_ASSERT_STRING_EQUAL("PCMA",linphone_payload_type_get_mime_type(linphone_call_params_get_used_audio_codec(linphone_call_get_current_params(linphone_core_get_current_call(marie->lc)))));
|
||||
wait_for_until(marie->lc, pauline->lc, &dummy, 1, 3000);
|
||||
wait_for_until(marie->lc, pauline->lc, &dummy, 1, 5000);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(marie->lc))->download_bandwidth>70);
|
||||
CU_ASSERT_TRUE(linphone_call_get_audio_stats(linphone_core_get_current_call(pauline->lc))->download_bandwidth>70);
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,15 @@ static void early_media_with_multicast_base(bool_t video) {
|
|||
int begin;
|
||||
LinphoneVideoPolicy marie_policy, pauline_policy;
|
||||
LpConfig *marie_lp;
|
||||
|
||||
#ifdef WIN32
|
||||
/*
|
||||
* "Do not call IP_ADD_MEMBERSHIP with the same group more than once on the same network interface."
|
||||
* https://msdn.microsoft.com/en-us/library/windows/desktop/ms739174%28v=vs.85%29.aspx
|
||||
*/
|
||||
ms_warning("Call forking with multicast can't be tested on windows, test skipped");
|
||||
return;
|
||||
#endif
|
||||
|
||||
belle_sip_object_enable_leak_detector(TRUE);
|
||||
begin=belle_sip_object_get_object_count();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue