mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
Fix stream indexes computed too late
This commit is contained in:
parent
c8f1f3b61e
commit
405ca6abbd
6 changed files with 43 additions and 24 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -50,6 +50,8 @@ coreapi/help/chatroom
|
|||
coreapi/help/doc/
|
||||
coreapi/help/helloworld
|
||||
coreapi/help/registration
|
||||
coreapi/help/realtimetext_receiver
|
||||
coreapi/help/realtimetext_sender
|
||||
coreapi/test_ecc
|
||||
coreapi/test_lsd
|
||||
gtk/version_date.h
|
||||
|
|
|
|||
|
|
@ -750,8 +750,8 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
|
|||
|
||||
/* Deactivate inactive streams. */
|
||||
for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
|
||||
if (md->streams[i].dir == SalStreamInactive) {
|
||||
md->streams[i].rtp_port = 0;
|
||||
if (md->streams[i].rtp_port == 0) {
|
||||
md->streams[i].dir = SalStreamInactive;
|
||||
md->streams[i].rtcp_port = 0;
|
||||
if (call->biggestdesc && i < call->biggestdesc->nb_streams) {
|
||||
md->streams[i].proto = call->biggestdesc->streams[i].proto;
|
||||
|
|
@ -1022,7 +1022,7 @@ LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddr
|
|||
|
||||
call->main_audio_stream_index = LINPHONE_CALL_STATS_AUDIO;
|
||||
call->main_video_stream_index = LINPHONE_CALL_STATS_VIDEO;
|
||||
call->main_text_stream_index = params->realtimetext_enabled ? LINPHONE_CALL_STATS_TEXT : -1;
|
||||
call->main_text_stream_index = params->realtimetext_enabled ? LINPHONE_CALL_STATS_TEXT : STREAM_INDEX_UNKNOWN;
|
||||
|
||||
call->dir=LinphoneCallOutgoing;
|
||||
call->core=lc;
|
||||
|
|
@ -1088,15 +1088,32 @@ void linphone_call_set_compatible_incoming_call_parameters(LinphoneCall *call, c
|
|||
|
||||
}
|
||||
|
||||
static void linphone_call_compute_streams_indexes(LinphoneCall *call, SalMediaDescription *md) {
|
||||
int 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 == SalAudio && call->main_audio_stream_index == STREAM_INDEX_UNKNOWN) {
|
||||
call->main_audio_stream_index = i;
|
||||
ms_message("audio stream index updated: %i", i);
|
||||
} else if (md->streams[i].type == SalVideo && call->main_video_stream_index == STREAM_INDEX_UNKNOWN) {
|
||||
call->main_video_stream_index = i;
|
||||
ms_message("video stream index updated: %i", i);
|
||||
} else if (md->streams[i].type == SalText && call->main_text_stream_index == STREAM_INDEX_UNKNOWN) {
|
||||
call->main_text_stream_index = i;
|
||||
ms_message("text stream index updated: %i", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){
|
||||
LinphoneCall *call = belle_sip_object_new(LinphoneCall);
|
||||
SalMediaDescription *md;
|
||||
LinphoneFirewallPolicy fpol;
|
||||
int i;
|
||||
|
||||
call->main_audio_stream_index = -1;
|
||||
call->main_video_stream_index = -1;
|
||||
call->main_text_stream_index = -1;
|
||||
call->main_audio_stream_index = STREAM_INDEX_UNKNOWN;
|
||||
call->main_video_stream_index = STREAM_INDEX_UNKNOWN;
|
||||
call->main_text_stream_index = STREAM_INDEX_UNKNOWN;
|
||||
|
||||
call->dir=LinphoneCallIncoming;
|
||||
sal_op_set_user_pointer(op,call);
|
||||
|
|
@ -1106,6 +1123,9 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
|
|||
linphone_call_incoming_select_ip_version(call);
|
||||
|
||||
sal_op_cnx_ip_to_0000_if_sendonly_enable(op,lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0));
|
||||
|
||||
md = sal_call_get_remote_media_description(op);
|
||||
linphone_call_compute_streams_indexes(call, md);
|
||||
|
||||
if (lc->sip_conf.ping_with_options){
|
||||
#ifdef BUILD_UPNP
|
||||
|
|
@ -1142,7 +1162,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
|
|||
/*set privacy*/
|
||||
call->current_params->privacy=(LinphonePrivacyMask)sal_op_get_privacy(call->op);
|
||||
/*set video support */
|
||||
md=sal_call_get_remote_media_description(op);
|
||||
call->params->has_video = linphone_core_video_enabled(lc) && lc->video_policy.automatically_accept;
|
||||
if (md) {
|
||||
// It is licit to receive an INVITE without SDP
|
||||
|
|
@ -1159,19 +1178,6 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
|
|||
md->streams[i].multicast_role = SalMulticastReceiver;
|
||||
strncpy(call->media_ports[i].multicast_ip,md->streams[i].rtp_addr,sizeof(call->media_ports[i].multicast_ip));
|
||||
}
|
||||
|
||||
if (sal_stream_description_active(&md->streams[i])) {
|
||||
if (md->streams[i].type == SalAudio) {
|
||||
call->main_audio_stream_index = i;
|
||||
ms_message("audio stream index updated: %i", i);
|
||||
} else if (md->streams[i].type == SalVideo) {
|
||||
call->main_video_stream_index = i;
|
||||
ms_message("video stream index updated: %i", i);
|
||||
} else if (md->streams[i].type == SalText) {
|
||||
call->main_text_stream_index = i;
|
||||
ms_message("text stream index updated: %i", i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -627,11 +627,13 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call)
|
|||
const struct addrinfo *ai;
|
||||
IceCheckList *audio_check_list;
|
||||
IceCheckList *video_check_list;
|
||||
IceCheckList *text_check_list;
|
||||
const char *server = linphone_core_get_stun_server(lc);
|
||||
|
||||
if ((server == NULL) || (call->ice_session == NULL)) return -1;
|
||||
audio_check_list = ice_session_check_list(call->ice_session, 0);
|
||||
video_check_list = ice_session_check_list(call->ice_session, 1);
|
||||
text_check_list = ice_session_check_list(call->ice_session, 2);
|
||||
if (audio_check_list == NULL) return -1;
|
||||
|
||||
if (call->af==AF_INET6){
|
||||
|
|
@ -661,6 +663,12 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call)
|
|||
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;
|
||||
}
|
||||
if (call->params->realtimetext_enabled && (text_check_list != NULL)
|
||||
&& (ice_check_list_state(text_check_list) != ICL_Completed) && (ice_check_list_candidates_gathered(text_check_list) == FALSE)) {
|
||||
ice_add_local_candidate(text_check_list, "host", local_addr, call->media_ports[call->main_text_stream_index].rtp_port, 1, NULL);
|
||||
ice_add_local_candidate(text_check_list, "host", local_addr, call->media_ports[call->main_text_stream_index].rtcp_port, 2, NULL);
|
||||
call->stats[LINPHONE_CALL_STATS_TEXT].ice_state = LinphoneIceStateInProgress;
|
||||
}
|
||||
|
||||
ms_message("ICE: gathering candidate from [%s]",server);
|
||||
/* Gather local srflx candidates. */
|
||||
|
|
|
|||
|
|
@ -544,7 +544,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;
|
||||
int 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;
|
||||
|
|
|
|||
|
|
@ -240,6 +240,8 @@ typedef struct _PortConfig{
|
|||
int rtcp_port;
|
||||
}PortConfig;
|
||||
|
||||
#define STREAM_INDEX_UNKNOWN -1
|
||||
|
||||
struct _LinphoneCall{
|
||||
belle_sip_object_t base;
|
||||
void *user_data;
|
||||
|
|
|
|||
|
|
@ -57,8 +57,10 @@ 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++){
|
||||
for(i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
|
||||
md->streams[i].dir=SalStreamInactive;
|
||||
md->streams[i].rtp_port = 0;
|
||||
md->streams[i].rtcp_port = 0;
|
||||
}
|
||||
return md;
|
||||
}
|
||||
|
|
@ -86,8 +88,7 @@ void sal_media_description_unref(SalMediaDescription *md){
|
|||
}
|
||||
}
|
||||
|
||||
SalStreamDescription *sal_media_description_find_stream(SalMediaDescription *md,
|
||||
SalMediaProto proto, SalStreamType type){
|
||||
SalStreamDescription *sal_media_description_find_stream(SalMediaDescription *md, SalMediaProto proto, SalStreamType type){
|
||||
int i;
|
||||
for(i=0;i<SAL_MEDIA_DESCRIPTION_MAX_STREAMS;++i){
|
||||
SalStreamDescription *ss=&md->streams[i];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue