Commit c8f1f3b6 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Do not use anymore nb_streams but SAL_MEDIA_DESCRIPTION_MAX_STREAMS and skip...

Do not use anymore nb_streams but SAL_MEDIA_DESCRIPTION_MAX_STREAMS and skip inactive ones because active streams won't be at the start of the array anymore
parent 15b6353e
......@@ -66,7 +66,7 @@ static void sdp_process(SalOp *h){
/*for backward compatibility purpose*/
if(h->cnx_ip_to_0000_if_sendonly_enabled && sal_media_description_has_dir(h->result,SalStreamSendOnly)) {
set_addr_to_0000(h->result->addr);
for(i=0;i<h->result->nb_streams;++i){
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
if (h->result->streams[i].dir == SalStreamSendOnly)
set_addr_to_0000(h->result->streams[i].rtp_addr);
set_addr_to_0000(h->result->streams[i].rtcp_addr);
......@@ -78,7 +78,7 @@ static void sdp_process(SalOp *h){
strcpy(h->result->addr,h->base.remote_media->addr);
h->result->bandwidth=h->base.remote_media->bandwidth;
for(i=0;i<h->result->nb_streams;++i){
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
/*copy back parameters from remote description that we need in our result description*/
if (h->result->streams[i].rtp_port!=0){ /*if stream was accepted*/
strcpy(h->result->streams[i].rtp_addr,h->base.remote_media->streams[i].rtp_addr);
......
......@@ -416,7 +416,8 @@ belle_sdp_session_description_t * media_description_to_sdp ( const SalMediaDescr
belle_sdp_session_description_add_attribute(session_desc, create_rtcp_xr_attribute(&desc->rtcp_xr));
}
for ( i=0; i<desc->nb_streams; i++ ) {
for ( i=0; i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++ ) {
if (!sal_stream_description_active(&desc->streams[i])) continue;
stream_description_to_sdp(session_desc, desc, &desc->streams[i]);
}
return session_desc;
......
......@@ -266,7 +266,7 @@ LinphoneCallParams * linphone_call_params_new(void) {
LinphoneCallParams *cp=belle_sip_object_new(LinphoneCallParams);
cp->audio_dir=LinphoneMediaDirectionSendRecv;
cp->video_dir=LinphoneMediaDirectionSendRecv;
cp->realtimetext_enabled=TRUE; /*fixme*/
cp->realtimetext_enabled = FALSE;
return cp;
}
......
......@@ -49,7 +49,7 @@ void linphone_core_update_streams_destinations(LinphoneCore *lc, LinphoneCall *c
char *rtp_addr, *rtcp_addr;
int i;
for (i = 0; i < new_md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&new_md->streams[i])) continue;
if (new_md->streams[i].type == SalAudio) {
new_audiodesc = &new_md->streams[i];
......@@ -188,8 +188,9 @@ void linphone_core_update_streams(LinphoneCore *lc, LinphoneCall *call, SalMedia
linphone_call_stop_media_streams (call);
if (md_changed & SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED){
ms_message("Media ip type has changed, destroying sessions context on call [%p]",call);
ms_media_stream_sessions_uninit(&call->sessions[0]);
ms_media_stream_sessions_uninit(&call->sessions[1]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_audio_stream_index]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_video_stream_index]);
if (call->params->realtimetext_enabled) ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]);
}
linphone_call_init_media_streams (call);
}
......@@ -368,7 +369,7 @@ static void try_early_media_forking(LinphoneCall *call, SalMediaDescription *md)
SalStreamDescription *ref_stream,*new_stream;
ms_message("Early media response received from another branch, checking if media can be forked to this new destination.");
for (i=0;i<cur_md->nb_streams;++i){
for (i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
if (!sal_stream_description_active(&cur_md->streams[i])) continue;
ref_stream=&cur_md->streams[i];
new_stream=&md->streams[i];
......
This diff is collapsed.
......@@ -2831,8 +2831,9 @@ int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *c
int linphone_core_restart_invite(LinphoneCore *lc, LinphoneCall *call){
linphone_call_create_op(call);
linphone_call_stop_media_streams(call);
ms_media_stream_sessions_uninit(&call->sessions[0]);
ms_media_stream_sessions_uninit(&call->sessions[1]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_audio_stream_index]);
ms_media_stream_sessions_uninit(&call->sessions[call->main_video_stream_index]);
if (call->params->realtimetext_enabled) ms_media_stream_sessions_uninit(&call->sessions[call->main_text_stream_index]);
linphone_call_init_media_streams(call);
return linphone_core_start_invite(lc,call, NULL);
}
......@@ -6157,6 +6158,11 @@ void rtp_config_uninit(LinphoneCore *lc)
} else {
lp_config_set_range(lc->config, "rtp", "video_rtp_port", config->video_rtp_min_port, config->video_rtp_max_port);
}
if (config->text_rtp_min_port == config->text_rtp_max_port) {
lp_config_set_int(lc->config, "rtp", "text_rtp_port", config->text_rtp_min_port);
} else {
lp_config_set_range(lc->config, "rtp", "text_rtp_port", config->text_rtp_min_port, config->text_rtp_max_port);
}
lp_config_set_int(lc->config,"rtp","audio_jitt_comp",config->audio_jitt_comp);
lp_config_set_int(lc->config,"rtp","video_jitt_comp",config->video_jitt_comp);
lp_config_set_int(lc->config,"rtp","nortp_timeout",config->nortp_timeout);
......
......@@ -409,22 +409,23 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
const char *server=linphone_core_get_stun_server(lc);
StunCandidate *ac=&call->ac;
StunCandidate *vc=&call->vc;
StunCandidate *tc=&call->tc;
if (lc->sip_conf.ipv6_enabled){
ms_warning("stun support is not implemented for ipv6");
return -1;
}
if (call->media_ports[0].rtp_port==-1){
if (call->media_ports[call->main_audio_stream_index].rtp_port==-1){
ms_warning("Stun-only support not available for system random port");
return -1;
}
if (server!=NULL){
const struct addrinfo *ai=linphone_core_get_stun_server_addrinfo(lc);
ortp_socket_t sock1=-1, sock2=-1;
ortp_socket_t sock1=-1, sock2=-1, sock3=-1;
int loops=0;
bool_t video_enabled=linphone_core_video_enabled(lc);
bool_t got_audio,got_video;
bool_t cone_audio=FALSE,cone_video=FALSE;
bool_t got_audio,got_video,got_text;
bool_t cone_audio=FALSE,cone_video=FALSE,cone_text=FALSE;
struct timeval init,cur;
double elapsed;
int ret=0;
......@@ -436,14 +437,19 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
linphone_core_notify_display_status(lc,_("Stun lookup in progress..."));
/*create the two audio and video RTP sockets, and send STUN message to our stun server */
sock1=create_socket(call->media_ports[0].rtp_port);
sock1=create_socket(call->media_ports[call->main_audio_stream_index].rtp_port);
if (sock1==-1) return -1;
if (video_enabled){
sock2=create_socket(call->media_ports[1].rtp_port);
sock2=create_socket(call->media_ports[call->main_video_stream_index].rtp_port);
if (sock2==-1) return -1;
}
if (call->params->realtimetext_enabled) {
sock3=create_socket(call->media_ports[call->main_text_stream_index].rtp_port);
if (sock3==-1) return -1;
}
got_audio=FALSE;
got_video=FALSE;
got_text=FALSE;
ortp_gettimeofday(&init,NULL);
do{
......@@ -456,6 +462,10 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
sendStunRequest(sock2,ai->ai_addr,ai->ai_addrlen,22,TRUE);
sendStunRequest(sock2,ai->ai_addr,ai->ai_addrlen,2,FALSE);
}
if (sock3!=-1){
sendStunRequest(sock3,ai->ai_addr,ai->ai_addrlen,33,TRUE);
sendStunRequest(sock3,ai->ai_addr,ai->ai_addrlen,3,FALSE);
}
}
ms_usleep(10000);
......@@ -477,6 +487,15 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
cone_video=TRUE;
got_video=TRUE;
}
if (recvStunResponse(sock3,tc->addr,
&tc->port,&id)>0){
ms_message("STUN test result: local text port maps to %s:%i",
tc->addr,
tc->port);
if (id==33)
cone_text=TRUE;
got_text=TRUE;
}
ortp_gettimeofday(&cur,NULL);
elapsed=((cur.tv_sec-init.tv_sec)*1000.0) + ((cur.tv_usec-init.tv_usec)/1000.0);
if (elapsed>2000) {
......@@ -485,7 +504,7 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
break;
}
loops++;
}while(!(got_audio && (got_video||sock2==-1) ) );
}while(!(got_audio && (got_video||sock2==-1) && (got_text||sock3==-1) ) );
if (ret==0) ret=(int)elapsed;
if (!got_audio){
ms_error("No stun server response for audio port.");
......@@ -503,8 +522,18 @@ int linphone_core_run_stun_tests(LinphoneCore *lc, LinphoneCall *call){
}
}
}
if (sock3!=-1){
if (!got_text){
ms_error("No stun server response for text port.");
}else{
if (!cone_text) {
ms_message("NAT is symmetric for text port.");
}
}
}
close_socket(sock1);
if (sock2!=-1) close_socket(sock2);
if (sock3!=-1) close_socket(sock3);
return ret;
}
return -1;
......@@ -622,14 +651,14 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call)
return -1;
}
if ((ice_check_list_state(audio_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(audio_check_list) == FALSE)) {
ice_add_local_candidate(audio_check_list, "host", local_addr, call->media_ports[0].rtp_port, 1, NULL);
ice_add_local_candidate(audio_check_list, "host", local_addr, call->media_ports[0].rtcp_port, 2, NULL);
ice_add_local_candidate(audio_check_list, "host", local_addr, call->media_ports[call->main_audio_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(audio_check_list, "host", local_addr, call->media_ports[call->main_audio_stream_index].rtcp_port, 2, NULL);
call->stats[LINPHONE_CALL_STATS_AUDIO].ice_state = LinphoneIceStateInProgress;
}
if (linphone_core_video_enabled(lc) && (video_check_list != NULL)
&& (ice_check_list_state(video_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(video_check_list) == FALSE)) {
ice_add_local_candidate(video_check_list, "host", local_addr, call->media_ports[1].rtp_port, 1, NULL);
ice_add_local_candidate(video_check_list, "host", local_addr, call->media_ports[1].rtcp_port, 2, NULL);
ice_add_local_candidate(video_check_list, "host", local_addr, call->media_ports[call->main_video_stream_index].rtp_port, 1, NULL);
ice_add_local_candidate(video_check_list, "host", local_addr, call->media_ports[call->main_video_stream_index].rtcp_port, 2, NULL);
call->stats[LINPHONE_CALL_STATS_VIDEO].ice_state = LinphoneIceStateInProgress;
}
......@@ -759,7 +788,7 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess
}
strncpy(desc->ice_pwd, ice_session_local_pwd(session), sizeof(desc->ice_pwd));
strncpy(desc->ice_ufrag, ice_session_local_ufrag(session), sizeof(desc->ice_ufrag));
for (i = 0; i < desc->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
SalStreamDescription *stream = &desc->streams[i];
IceCheckList *cl = ice_session_check_list(session, i);
nb_candidates = 0;
......@@ -866,9 +895,10 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
ice_params_found=TRUE;
} else {
int i;
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
const SalStreamDescription *stream = &md->streams[i];
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
if (!sal_stream_description_active(stream)) continue;
if (cl) {
if ((stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) {
ice_params_found=TRUE;
......@@ -887,9 +917,10 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
ice_session_restart(call->ice_session);
ice_restarted = TRUE;
} else {
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
const SalStreamDescription *stream = &md->streams[i];
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
if (!sal_stream_description_active(stream)) continue;
if (cl && (strcmp(stream->rtp_addr, "0.0.0.0") == 0)) {
ice_session_restart(call->ice_session);
ice_restarted = TRUE;
......@@ -906,9 +937,10 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
}
ice_session_set_remote_credentials(call->ice_session, md->ice_ufrag, md->ice_pwd);
}
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
const SalStreamDescription *stream = &md->streams[i];
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
if (!sal_stream_description_active(stream)) continue;
if (cl && (stream->ice_pwd[0] != '\0') && (stream->ice_ufrag[0] != '\0')) {
if (ice_check_list_remote_credentials_changed(cl, stream->ice_ufrag, stream->ice_pwd)) {
if (ice_restarted == FALSE
......@@ -925,9 +957,10 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
}
/* Create ICE check lists if needed and parse ICE attributes. */
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
const SalStreamDescription *stream = &md->streams[i];
IceCheckList *cl = ice_session_check_list(call->ice_session, i);
if (!sal_stream_description_active(stream)) continue;
/*
if ((cl == NULL) && (i < md->n_active_streams)) {
cl = ice_check_list_new();
......@@ -986,7 +1019,7 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
}
}
}
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
IceCheckList * cl = ice_session_check_list(call->ice_session, i);
if (!sal_stream_description_active(&md->streams[i]) && (cl != NULL)) {
ice_session_remove_check_list_from_idx(call->ice_session, i);
......@@ -1007,7 +1040,7 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
bool_t linphone_core_media_description_contains_video_stream(const SalMediaDescription *md){
int i;
for (i = 0; md && i < md->nb_streams; i++) {
for (i = 0; md && i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (md->streams[i].type == SalVideo && md->streams[i].rtp_port!=0)
return TRUE;
}
......
......@@ -493,9 +493,10 @@ int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer,
int i,j;
const SalStreamDescription *ls,*rs;
for(i=0,j=0;i<local_offer->nb_streams;++i){
ms_message("Processing for stream %i",i);
for(i=0,j=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
ls=&local_offer->streams[i];
if (!sal_stream_description_active(ls)) continue;
ms_message("Processing for stream %i",i);
rs=sal_media_description_find_stream((SalMediaDescription*)remote_answer,ls->proto,ls->type);
if (rs) {
initiate_outgoing(ls,rs,&result->streams[j]);
......@@ -522,7 +523,7 @@ int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer,
static bool_t local_stream_not_already_used(const SalMediaDescription *result, const SalStreamDescription *stream){
int i;
for(i=0;i<result->nb_streams;++i){
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
const SalStreamDescription *ss=&result->streams[i];
if (strcmp(ss->name,stream->name)==0){
ms_message("video stream already used in answer");
......@@ -544,7 +545,7 @@ static bool_t proto_compatible(SalMediaProto local, SalMediaProto remote) {
static const SalStreamDescription *find_local_matching_stream(const SalMediaDescription *result, const SalMediaDescription *local_capabilities, const SalStreamDescription *remote_stream){
int i;
for(i=0;i<local_capabilities->nb_streams;++i){
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
const SalStreamDescription *ss=&local_capabilities->streams[i];
if (!sal_stream_description_active(ss)) continue;
if (ss->type==remote_stream->type && proto_compatible(ss->proto,remote_stream->proto)
......@@ -564,8 +565,9 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities
int i;
const SalStreamDescription *ls=NULL,*rs;
for(i=0;i<remote_offer->nb_streams;++i){
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
rs=&remote_offer->streams[i];
if (!sal_stream_description_active(rs)) continue;
if (rs->proto!=SalProtoOther){
ls=find_local_matching_stream(result,local_capabilities,rs);
}else ms_warning("Unknown protocol for mline %i, declining",i);
......
......@@ -390,8 +390,8 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
static const SalStreamDescription * get_media_stream_for_desc(const SalMediaDescription * smd, SalStreamType sal_stream_type) {
int count;
if (smd != NULL) {
for (count = 0; count < smd->nb_streams; ++count) {
if (smd->streams[count].type == sal_stream_type) {
for (count = 0; count < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++count) {
if (sal_stream_description_active(&smd->streams[count]) && smd->streams[count].type == sal_stream_type) {
return &smd->streams[count];
}
}
......
......@@ -55,7 +55,11 @@ SalTransport sal_transport_parse(const char* param) {
SalMediaDescription *sal_media_description_new(){
SalMediaDescription *md=ms_new0(SalMediaDescription,1);
int i;
md->refcount=1;
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;i++){
md->streams[i].dir=SalStreamInactive;
}
return md;
}
......@@ -85,7 +89,7 @@ void sal_media_description_unref(SalMediaDescription *md){
SalStreamDescription *sal_media_description_find_stream(SalMediaDescription *md,
SalMediaProto proto, SalStreamType type){
int i;
for(i=0;i<md->nb_streams;++i){
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
SalStreamDescription *ss=&md->streams[i];
if (!sal_stream_description_active(ss)) continue;
if (ss->proto==proto && ss->type==type) return ss;
......@@ -96,7 +100,7 @@ SalStreamDescription *sal_media_description_find_stream(SalMediaDescription *md,
unsigned int sal_media_description_nb_active_streams_of_type(SalMediaDescription *md, SalStreamType type) {
unsigned int i;
unsigned int nb = 0;
for (i = 0; i < md->nb_streams; ++i) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i) {
if (!sal_stream_description_active(&md->streams[i])) continue;
if (md->streams[i].type == type) nb++;
}
......@@ -105,7 +109,7 @@ unsigned int sal_media_description_nb_active_streams_of_type(SalMediaDescription
SalStreamDescription * sal_media_description_get_active_stream_of_type(SalMediaDescription *md, SalStreamType type, unsigned int idx) {
unsigned int i;
for (i = 0; i < md->nb_streams; ++i) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i) {
if (!sal_stream_description_active(&md->streams[i])) continue;
if (md->streams[i].type == type) {
if (idx-- == 0) return &md->streams[i];
......@@ -137,7 +141,7 @@ bool_t sal_media_description_empty(const SalMediaDescription *md){
void sal_media_description_set_dir(SalMediaDescription *md, SalStreamDir stream_dir){
int i;
for(i=0;i<md->nb_streams;++i){
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
SalStreamDescription *ss=&md->streams[i];
if (!sal_stream_description_active(ss)) continue;
ss->dir=stream_dir;
......@@ -147,7 +151,7 @@ void sal_media_description_set_dir(SalMediaDescription *md, SalStreamDir stream_
int sal_media_description_get_nb_active_streams(const SalMediaDescription *md) {
int i;
int nb = 0;
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (sal_stream_description_active(&md->streams[i])) nb++;
}
return nb;
......@@ -162,7 +166,7 @@ static bool_t has_dir(const SalMediaDescription *md, SalStreamDir stream_dir){
int i;
/* we are looking for at least one stream with requested direction, inactive streams are ignored*/
for(i=0;i<md->nb_streams;++i){
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
const SalStreamDescription *ss=&md->streams[i];
if (!sal_stream_description_active(ss)) continue;
if (ss->dir==stream_dir) {
......@@ -211,7 +215,7 @@ bool_t sal_stream_description_has_dtls(const SalStreamDescription *sd) {
bool_t sal_media_description_has_avpf(const SalMediaDescription *md) {
int i;
if (md->nb_streams == 0) return FALSE;
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&md->streams[i])) continue;
if (sal_stream_description_has_avpf(&md->streams[i]) != TRUE) return FALSE;
}
......@@ -221,7 +225,7 @@ bool_t sal_media_description_has_avpf(const SalMediaDescription *md) {
bool_t sal_media_description_has_srtp(const SalMediaDescription *md) {
int i;
if (md->nb_streams == 0) return FALSE;
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&md->streams[i])) continue;
if (sal_stream_description_has_srtp(&md->streams[i]) != TRUE) return FALSE;
}
......@@ -231,7 +235,7 @@ bool_t sal_media_description_has_srtp(const SalMediaDescription *md) {
bool_t sal_media_description_has_dtls(const SalMediaDescription *md) {
int i;
if (md->nb_streams == 0) return FALSE;
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
if (!sal_stream_description_active(&md->streams[i])) continue;
if (sal_stream_description_has_dtls(&md->streams[i]) != TRUE) return FALSE;
}
......@@ -336,7 +340,8 @@ int sal_media_description_equals(const SalMediaDescription *md1, const SalMediaD
result |= SAL_MEDIA_DESCRIPTION_NETWORK_XXXCAST_CHANGED;
if (md1->nb_streams != md2->nb_streams) result |= SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED;
if (md1->bandwidth != md2->bandwidth) result |= SAL_MEDIA_DESCRIPTION_CODEC_CHANGED;
for(i = 0; i < md1->nb_streams; ++i){
for(i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i){
if (!sal_stream_description_active(&md1->streams[i]) || !sal_stream_description_active(&md2->streams[i])) continue;
result |= sal_stream_description_equals(&md1->streams[i], &md2->streams[i]);
}
return result;
......
......@@ -698,19 +698,19 @@ int linphone_core_update_upnp_audio_video(LinphoneCall *call, bool_t audio, bool
* Audio part
*/
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->audio->rtp,
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->media_ports[0].rtp_port:0, UPNP_CALL_RETRY_DELAY);
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->media_ports[call->main_audio_stream_index].rtp_port:0, UPNP_CALL_RETRY_DELAY);
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->audio->rtcp,
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->media_ports[0].rtcp_port:0, UPNP_CALL_RETRY_DELAY);
UPNP_IGD_IP_PROTOCOL_UDP, (audio)? call->media_ports[call->main_audio_stream_index].rtcp_port:0, UPNP_CALL_RETRY_DELAY);
/*
* Video part
*/
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->video->rtp,
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->media_ports[1].rtp_port:0, UPNP_CALL_RETRY_DELAY);
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->media_ports[call->main_video_stream_index].rtp_port:0, UPNP_CALL_RETRY_DELAY);
linphone_upnp_update_port_binding(lupnp, &call->upnp_session->video->rtcp,
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->media_ports[1].rtcp_port:0, UPNP_CALL_RETRY_DELAY);
UPNP_IGD_IP_PROTOCOL_UDP, (video)? call->media_ports[call->main_video_stream_index].rtcp_port:0, UPNP_CALL_RETRY_DELAY);
}
ms_mutex_unlock(&lupnp->mutex);
......@@ -731,8 +731,9 @@ int linphone_core_update_upnp_from_remote_media_description(LinphoneCall *call,
int i;
const SalStreamDescription *stream;
for (i = 0; i < md->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
stream = &md->streams[i];
if (!sal_stream_description_active(stream)) continue;
if(stream->type == SalAudio) {
audio = TRUE;
} else if(stream->type == SalVideo) {
......@@ -1060,7 +1061,7 @@ int linphone_core_update_local_media_description_from_upnp(SalMediaDescription *
SalStreamDescription *stream;
UpnpStream *upnpStream;
for (i = 0; i < desc->nb_streams; i++) {
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
stream = &desc->streams[i];
if (!sal_stream_description_active(stream)) continue;
upnpStream = NULL;
......
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