mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-24 14:48:07 +00:00
rework multicast. It is not necessary to bind to the multicast address. 0.0.0.0 just works while the binding to the multicast address is rejected on windows
fixes reading provisionning config file from disk on windows.
This commit is contained in:
parent
5c30b4d6c0
commit
41a3e1e06d
6 changed files with 49 additions and 35 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, "r");
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ef83b7a2899bc838fe9a490afbb31ae017c7d810
|
||||
Subproject commit acca89ed2e726ac53eddce9ffbfd378ea0c9bf9f
|
||||
2
oRTP
2
oRTP
|
|
@ -1 +1 @@
|
|||
Subproject commit cd468445a4f276f54ee9f9948712855f3cd1a0dc
|
||||
Subproject commit cd3f64ec021534413f247b2f0185d9e934348529
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue