From 0ca32414559e0377973f10afc2c01316b1ce5710 Mon Sep 17 00:00:00 2001 From: sylvain Date: Thu, 22 Sep 2011 16:26:03 +0200 Subject: [PATCH 1/6] new interface for protocols and ports in preferences screen --- gtk/parameters.ui | 264 ++++++++++++++++++++++++---------------------- gtk/propertybox.c | 99 ++++++++++++++--- 2 files changed, 222 insertions(+), 141 deletions(-) diff --git a/gtk/parameters.ui b/gtk/parameters.ui index 8b43f12aa..9af426212 100644 --- a/gtk/parameters.ui +++ b/gtk/parameters.ui @@ -41,6 +41,13 @@ 1 10 + + 1 + 65535 + 5060 + 1 + 9.9999999995529656 + 65535 1 @@ -127,6 +134,23 @@ + + + + + + + + SIP (UDP) + + + SIP (TCP) + + + SIP (TLS) + + + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK @@ -275,134 +299,126 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 12 - + True False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 4 - 2 - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - True - True - adjustment2 - - - - 1 - 2 - 3 - 4 - + - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - True - True - adjustment3 - - - - 1 - 2 - 2 - 3 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - True - True - adjustment_tcp_port - - - - 1 - 2 - 1 - 2 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - False - True - True - adjustment4 - - - - 1 - 2 - - - - + True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Video RTP/UDP: - right + 3 + 2 + + + True + False + model8 + + + + + 0 + + + + + + + True + True + + True + False + False + True + True + adjustment7 + + + + 1 + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + True + False + False + True + True + adjustment2 + + + + 1 + 2 + 1 + 2 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + True + False + False + True + True + adjustment3 + + + + 1 + 2 + 2 + 3 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Video RTP/UDP: + right + + + 1 + 2 + + + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + Audio RTP/UDP: + right + + + 2 + 3 + + - 3 - 4 + True + True + 1 - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - Audio RTP/UDP: - right - - - 2 - 3 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - SIP (TCP): - right - - - 1 - 2 - - - - - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - SIP (UDP): - right - - @@ -412,7 +428,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - <b>Ports</b> + <b>Network protocol and ports</b> True @@ -760,7 +776,7 @@ model1 - + 0 @@ -782,7 +798,7 @@ model2 - + 0 @@ -858,7 +874,7 @@ model3 - + 0 @@ -946,7 +962,7 @@ model4 - + 0 @@ -977,7 +993,7 @@ 0 - + 0 @@ -1600,7 +1616,7 @@ virtual network ! 0 - + 0 @@ -1973,7 +1989,7 @@ virtual network ! model7 - + 0 diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 625fd8293..ce090d638 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -33,7 +33,7 @@ static void linphone_gtk_fill_combo_box(GtkWidget *combo, const char **devices, This dummy text needs to be removed first*/ gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),0); for(;*p!=NULL;++p){ - if ( cap==CAP_IGNORE + if ( cap==CAP_IGNORE || (cap==CAP_CAPTURE && linphone_core_sound_device_can_capture(linphone_gtk_get_core(),*p)) || (cap==CAP_PLAYBACK && linphone_core_sound_device_can_playback(linphone_gtk_get_core(),*p)) ){ gtk_combo_box_append_text(GTK_COMBO_BOX(combo),*p); @@ -87,6 +87,49 @@ void linphone_gtk_update_my_contact(GtkWidget *w){ linphone_gtk_load_identities(); } +void linphone_gtk_update_my_port(GtkWidget *w){ + GtkWidget *pb=gtk_widget_get_toplevel(GTK_WIDGET(w)); + LCSipTransports tr; + LinphoneCore *lc=linphone_gtk_get_core(); + GtkComboBox *combo = GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo")); + + gint port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); + if (port == 1) { // We use default port if not specified + if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (UDP)") == 0) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), + 5060); + } + else if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (TCP)") == 0) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), + 5060); + } + else if (strcmp(gtk_combo_box_get_active_text(combo), "SIP (TLS)") == 0) { + gtk_spin_button_set_value(GTK_SPIN_BUTTON(w), + 5061); + } + } + + linphone_core_get_sip_transports(lc,&tr); + gchar *selected = gtk_combo_box_get_active_text(combo); + if (strcmp(selected, "SIP (TCP)") == 0) { + tr.tcp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); + tr.udp_port = 0; + tr.tls_port = 0; + } + else if (strcmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo"))), "SIP (UDP)") == 0) { + tr.udp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); + tr.tcp_port = 0; + tr.tls_port = 0; + } + else if (strcmp(gtk_combo_box_get_active_text(GTK_COMBO_BOX(linphone_gtk_get_widget(pb, "proto_combo"))), "SIP (TLS)") == 0){ + tr.udp_port = 0; + tr.tcp_port = 0; + tr.tls_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); + } + + linphone_core_set_sip_transports(lc,&tr); +} + void linphone_gtk_stun_server_changed(GtkWidget *w){ const gchar *addr=gtk_entry_get_text(GTK_ENTRY(w)); linphone_core_set_stun_server(linphone_gtk_get_core(),addr); @@ -102,7 +145,7 @@ void linphone_gtk_ipv6_toggled(GtkWidget *w){ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))); } -void linphone_gtk_udp_sip_port_changed(GtkWidget *w){ +/* void linphone_gtk_udp_sip_port_changed(GtkWidget *w){ LCSipTransports tr; LinphoneCore *lc=linphone_gtk_get_core(); @@ -118,7 +161,7 @@ void linphone_gtk_tcp_sip_port_changed(GtkWidget *w){ linphone_core_get_sip_transports(lc,&tr); tr.tcp_port = (gint)gtk_spin_button_get_value(GTK_SPIN_BUTTON(w)); linphone_core_set_sip_transports(lc,&tr); -} +} */ void linphone_gtk_audio_port_changed(GtkWidget *w){ linphone_core_set_audio_port(linphone_gtk_get_core(), @@ -329,7 +372,7 @@ static void linphone_gtk_show_codecs(GtkTreeView *listview, const MSList *codecl for(elem=codeclist; elem!=NULL; elem=elem->next){ gchar *status; gint rate; - gfloat bitrate; + gfloat bitrate; const gchar *color; const char *params=""; @@ -355,9 +398,9 @@ static void linphone_gtk_show_codecs(GtkTreeView *listview, const MSList *codecl CODEC_INFO,(gpointer)linphone_core_get_payload_type_description(linphone_gtk_get_core(),pt), -1); } - - - + + + /* Setup the selection handler */ selection = gtk_tree_view_get_selection (listview); gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); @@ -374,10 +417,10 @@ static void linphone_gtk_check_codec_bandwidth(GtkTreeView *v){ g_return_if_fail(gtk_tree_model_get_iter_first(model,&iter)); do{ PayloadType *pt=NULL; - + gfloat bitrate; gtk_tree_model_get(model,&iter,CODEC_PRIVDATA,&pt,-1); - + bitrate=payload_type_get_bitrate(pt)/1000.0; gtk_list_store_set(GTK_LIST_STORE(model),&iter,CODEC_COLOR, (gpointer)get_codec_color(linphone_gtk_get_core(),pt), CODEC_BITRATE, bitrate,-1); @@ -397,7 +440,7 @@ static void linphone_gtk_select_codec(GtkTreeView *v, PayloadType *ref){ if (pt==ref){ gtk_tree_selection_select_iter(selection,&iter); } - + }while(gtk_tree_model_iter_next(model,&iter)); } @@ -516,7 +559,7 @@ void linphone_gtk_show_sip_accounts(GtkWidget *w){ GtkTreeViewColumn *column; /* create the proxy list */ store = gtk_list_store_new (PROXY_CONFIG_NCOL, G_TYPE_STRING, G_TYPE_POINTER); - + gtk_tree_view_set_model(v,GTK_TREE_MODEL(store)); g_object_unref(G_OBJECT(store)); renderer = gtk_cell_renderer_text_new (); @@ -525,7 +568,7 @@ void linphone_gtk_show_sip_accounts(GtkWidget *w){ "text", PROXY_CONFIG_IDENTITY, NULL); gtk_tree_view_append_column (v, column); - + select = gtk_tree_view_get_selection (v); gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE); model=GTK_TREE_MODEL(store); @@ -712,7 +755,7 @@ static void linphone_gtk_fill_langs(GtkWidget *pb){ name=lang_get_name(code); snprintf(text,sizeof(text)-1,"%s : %s",code,name!=NULL ? _(name) : code); gtk_combo_box_append_text(GTK_COMBO_BOX(combo),text); - if (cur_lang_index==-1 && lang_equals(cur_lang,code)) + if (cur_lang_index==-1 && lang_equals(cur_lang,code)) cur_lang_index=index; index++; } @@ -743,6 +786,14 @@ void linphone_gtk_lang_changed(GtkComboBox *combo){ } } +void linphone_gtk_proto_changed(GtkComboBox *combo){ + GtkWidget *pb=gtk_widget_get_toplevel(GTK_WIDGET(combo)); + + GtkWidget *proto_port = linphone_gtk_get_widget(pb, "proto_port"); + // When we change the network protocol, we call update_my_port to move the port number from the old protocol to the new one + linphone_gtk_update_my_port(proto_port); +} + static void linphone_gtk_ui_level_adapt(GtkWidget *top) { gboolean ui_advanced; const char *simple_ui = linphone_gtk_get_ui_config("simple_ui", "parameters.codec_tab parameters.transport_frame parameters.ports_frame"); @@ -781,14 +832,28 @@ void linphone_gtk_show_parameters(void){ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(pb,"ipv6_enabled")), linphone_core_ipv6_enabled(lc)); linphone_core_get_sip_transports(lc,&tr); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"udp_sip_port")), - tr.udp_port); - gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"tcp_sip_port")), + + if (tr.tcp_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 1); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), tr.tcp_port); + } + else if (tr.tls_port > 0) { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 2); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.tls_port); + } + else { + gtk_combo_box_set_active(GTK_COMBO_BOX(linphone_gtk_get_widget(pb,"proto_combo")), 0); + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"proto_port")), + tr.udp_port); + } + gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"audio_rtp_port")), linphone_core_get_audio_port(lc)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"video_rtp_port")), linphone_core_get_video_port(lc)); + tmp=linphone_core_get_nat_address(lc); if (tmp) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"nat_address")),tmp); tmp=linphone_core_get_stun_server(lc); @@ -852,7 +917,7 @@ void linphone_gtk_show_parameters(void){ linphone_core_get_download_bandwidth(lc)); gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"upload_bw")), linphone_core_get_upload_bandwidth(lc)); - + /* UI CONFIG */ linphone_gtk_fill_langs(pb); From eea317e56db603db25338f43b412045de854eaf6 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Tue, 4 Oct 2011 16:20:21 +0200 Subject: [PATCH 2/6] Fix ios compilation error --- coreapi/lsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/lsd.c b/coreapi/lsd.c index f22a5b207..e47023f4f 100644 --- a/coreapi/lsd.c +++ b/coreapi/lsd.c @@ -215,7 +215,7 @@ bool_t lsd_player_loop_enabled(const LsdPlayer *p){ void lsd_player_set_gain(LsdPlayer *p, float gain){ MSAudioMixerCtl gainctl; gainctl.pin=p->mixer_pin; - gainctl.gain=gain; + gainctl.param.gain=gain; ms_filter_call_method(p->lsd->mixer,MS_AUDIO_MIXER_SET_INPUT_GAIN,&gainctl); } From 044b0546b7764226e3387a3872a22923aec20940 Mon Sep 17 00:00:00 2001 From: = <=> Date: Thu, 6 Oct 2011 15:53:08 +0200 Subject: [PATCH 3/6] Fixed the issue when video parameter change during a call on hold --- coreapi/linphonecall.c | 153 +++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 75 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 8ab925cf4..bcde3270c 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -1,7 +1,7 @@ /* linphone -Copyright (C) 2010 Belledonne Communications SARL +Copyright (C) 2010 Belledonne Communications SARL (simon.morlat@linphone.org) This program is free software; you can redistribute it and/or @@ -169,14 +169,14 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li LinphoneAddress *addr=linphone_address_new(me); const char *username=linphone_address_get_username (addr); SalMediaDescription *md=sal_media_description_new(); - + md->session_id=session_id; md->session_ver=session_ver; md->nstreams=1; strncpy(md->addr,call->localip,sizeof(md->addr)); strncpy(md->username,username,sizeof(md->username)); md->bandwidth=linphone_core_get_download_bandwidth(lc); - + /*set audio capabilities */ strncpy(md->streams[0].addr,call->localip,sizeof(md->streams[0].addr)); md->streams[0].port=call->audio_port; @@ -187,7 +187,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event")); l=ms_list_append(l,pt); md->streams[0].payloads=l; - + if (call->params.has_video){ md->nstreams++; @@ -254,7 +254,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, if (port_offset==-1) return; call->audio_port=linphone_core_get_audio_port(call->core)+port_offset; call->video_port=linphone_core_get_video_port(call->core)+port_offset; - + } static void discover_mtu(LinphoneCore *lc, const char *remote){ @@ -310,7 +310,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro sal_ping(call->ping_op,linphone_core_find_best_identity(lc,from,NULL),from_str); ms_free(from_str); } - + linphone_address_clean(from); linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip); linphone_call_init_common(call, from, to); @@ -331,13 +331,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro static void linphone_call_set_terminated(LinphoneCall *call){ LinphoneCore *lc=call->core; - + linphone_core_update_allocated_audio_bandwidth(lc); call->owns_call_log=FALSE; linphone_call_log_completed(call); - - + + if (call == lc->current_call){ ms_message("Resetting the current call"); lc->current_call=NULL; @@ -346,10 +346,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){ if (linphone_core_del_call(lc,call) != 0){ ms_error("Could not remove the call from the list !!!"); } - + if (ms_list_size(lc->calls)==0) linphone_core_notify_all_friends(lc,lc->presence_mode); - + } const char *linphone_call_state_to_string(LinphoneCallState cs){ @@ -423,7 +423,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const if (cstate == LinphoneCallConnected) { call->log->status=LinphoneCallSuccess; } - + if (lc->vtable.call_state_changed) lc->vtable.call_state_changed(lc,call,cstate,message); if (cstate==LinphoneCallReleased){ @@ -592,7 +592,7 @@ const char *linphone_call_get_remote_user_agent(LinphoneCall *call){ * executed yet. * Pending transfers are executed when this call is being paused or closed, * locally or by remote endpoint. - * If the call is already paused while receiving the transfer request, the + * If the call is already paused while receiving the transfer request, the * transfer immediately occurs. **/ bool_t linphone_call_has_transfer_pending(const LinphoneCall *call){ @@ -757,7 +757,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; AudioStream *audiostream; - + call->audiostream=audiostream=audio_stream_new(md->streams[0].port,linphone_core_ipv6_enabled(lc)); if (linphone_core_echo_limiter_enabled(lc)){ const char *type=lp_config_get_string(lc->config,"sound","el_type","mic"); @@ -783,7 +783,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){ int enabled=lp_config_get_int(lc->config,"sound","noisegate",0); audio_stream_enable_noise_gate(audiostream,enabled); } - + if (lc->a_rtp) rtp_session_set_transports(audiostream->session,lc->a_rtp,lc->a_rtcp); @@ -852,10 +852,10 @@ void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t mute float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05); float ng_floorgain=lp_config_get_float(lc->config,"sound","ng_floorgain",0); int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0); - + if (!muted) audio_stream_set_mic_gain(st,mic_gain); - else + else audio_stream_set_mic_gain(st,0); recv_gain = lc->sound_conf.soft_play_lev; @@ -914,11 +914,11 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m LinphoneCore *lc=call->core; int up_ptime=0; *used_pt=-1; - + for(elem=desc->payloads;elem!=NULL;elem=elem->next){ PayloadType *pt=(PayloadType*)elem->data; int number; - + if ((pt->flags & PAYLOAD_TYPE_FLAG_CAN_SEND) && first) { if (desc->type==SalAudio){ linphone_core_update_allocated_audio_bandwidth_in_call(call,pt); @@ -935,8 +935,8 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m remote_bw=get_video_bandwidth(remote_bw,call->audio_bw); } } - - if (desc->type==SalAudio){ + + if (desc->type==SalAudio){ bw=get_min_bandwidth(call->audio_bw,remote_bw); }else bw=get_min_bandwidth(get_video_bandwidth(linphone_core_get_upload_bandwidth (lc),call->audio_bw),remote_bw); if (bw>0) pt->normal_bitrate=bw*1000; @@ -975,9 +975,9 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna int used_pt=-1; const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpAvp,SalAudio); - + if (stream && stream->dir!=SalStreamInactive && stream->port!=0){ - MSSndCard *playcard=lc->sound_conf.lsd_card ? + MSSndCard *playcard=lc->sound_conf.lsd_card ? lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard; MSSndCard *captcard=lc->sound_conf.capt_sndcard; const char *playfile=lc->play_file; @@ -1051,7 +1051,7 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, const char *cna linphone_call_add_to_conf(call); } }else ms_warning("No audio stream accepted ?"); - } + } } static void linphone_call_start_video_stream(LinphoneCall *call, const char *cname,bool_t all_inputs_muted){ @@ -1075,44 +1075,47 @@ static void linphone_call_start_video_stream(LinphoneCall *call, const char *cna bool_t is_inactive=FALSE; call->current_params.has_video=TRUE; - - video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc)); - video_stream_enable_self_view(call->videostream,lc->video_conf.selfview); - if (lc->video_window_id!=0) - video_stream_set_native_window_id(call->videostream,lc->video_window_id); - if (lc->preview_window_id!=0) - video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id); - video_stream_use_preview_video_window (call->videostream,lc->use_preview_window); - - if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){ - cam=get_nowebcam_device(); - dir=VideoStreamSendOnly; - }else if (vstream->dir==SalStreamRecvOnly && lc->video_conf.display ){ - dir=VideoStreamRecvOnly; - }else if (vstream->dir==SalStreamSendRecv){ - if (lc->video_conf.display && lc->video_conf.capture) - dir=VideoStreamSendRecv; - else if (lc->video_conf.display) - dir=VideoStreamRecvOnly; - else - dir=VideoStreamSendOnly; - }else{ - ms_warning("video stream is inactive."); - /*either inactive or incompatible with local capabilities*/ - is_inactive=TRUE; - } - if (call->camera_active==FALSE || all_inputs_muted){ - cam=get_nowebcam_device(); - } - if (!is_inactive){ - video_stream_set_direction (call->videostream, dir); - ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); - video_stream_set_device_rotation(call->videostream, lc->device_rotation); - video_stream_start(call->videostream, - call->video_profile, addr, vstream->port, - vstream->port+1, - used_pt, lc->rtp_conf.audio_jitt_comp, cam); - video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); + + if (call->videostream != NULL) + { + video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc)); + video_stream_enable_self_view(call->videostream,lc->video_conf.selfview); + if (lc->video_window_id!=0) + video_stream_set_native_window_id(call->videostream,lc->video_window_id); + if (lc->preview_window_id!=0) + video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id); + video_stream_use_preview_video_window (call->videostream,lc->use_preview_window); + + if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){ + cam=get_nowebcam_device(); + dir=VideoStreamSendOnly; + }else if (vstream->dir==SalStreamRecvOnly && lc->video_conf.display ){ + dir=VideoStreamRecvOnly; + }else if (vstream->dir==SalStreamSendRecv){ + if (lc->video_conf.display && lc->video_conf.capture) + dir=VideoStreamSendRecv; + else if (lc->video_conf.display) + dir=VideoStreamRecvOnly; + else + dir=VideoStreamSendOnly; + }else{ + ms_warning("video stream is inactive."); + /*either inactive or incompatible with local capabilities*/ + is_inactive=TRUE; + } + if (call->camera_active==FALSE || all_inputs_muted){ + cam=get_nowebcam_device(); + } + if (!is_inactive){ + video_stream_set_direction (call->videostream, dir); + ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation); + video_stream_set_device_rotation(call->videostream, lc->device_rotation); + video_stream_start(call->videostream, + call->video_profile, addr, vstream->port, + vstream->port+1, + used_pt, lc->rtp_conf.audio_jitt_comp, cam); + video_stream_set_rtcp_information(call->videostream, cname,LINPHONE_RTCP_SDES_TOOL); + } } }else ms_warning("No video stream accepted."); }else{ @@ -1130,7 +1133,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut const SalStreamDescription *vstream=sal_media_description_find_stream(call->resultdesc, SalProtoRtpAvp,SalVideo); #endif - + if(call->audiostream == NULL) { ms_fatal("start_media_stream() called without prior init !"); @@ -1152,7 +1155,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut call->all_muted=all_inputs_muted; call->playing_ringbacktone=send_ringbacktone; call->up_bw=linphone_core_get_upload_bandwidth(lc); - + if (ortp_zrtp_available()) { OrtpZrtpParams params; params.zid=get_hexa_zrtp_identifier(lc); @@ -1203,7 +1206,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){ call->videostream=NULL; } ms_event_queue_skip(call->core->msevq); - + #endif if (call->audio_profile){ rtp_profile_clear_all(call->audio_profile); @@ -1260,11 +1263,11 @@ bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call){ /** * @addtogroup call_misc * @{ -**/ +**/ /** * Returns the measured sound volume played locally (received from remote) - * It is expressed in dbm0. + * It is expressed in dbm0. **/ float linphone_call_get_play_volume(LinphoneCall *call){ AudioStream *st=call->audiostream; @@ -1272,14 +1275,14 @@ float linphone_call_get_play_volume(LinphoneCall *call){ float vol=0; ms_filter_call_method(st->volrecv,MS_VOLUME_GET,&vol); return vol; - + } return LINPHONE_VOLUME_DB_LOWEST; } /** * Returns the measured sound volume recorded locally (sent to remote) - * It is expressed in dbm0. + * It is expressed in dbm0. **/ float linphone_call_get_record_volume(LinphoneCall *call){ AudioStream *st=call->audiostream; @@ -1287,7 +1290,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){ float vol=0; ms_filter_call_method(st->volsend,MS_VOLUME_GET,&vol); return vol; - + } return LINPHONE_VOLUME_DB_LOWEST; } @@ -1306,7 +1309,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){ * 1-2 = very poor quality
* 0-1 = can't be worse, mostly unusable
* - * @returns The function returns -1 if no quality measurement is available, for example if no + * @returns The function returns -1 if no quality measurement is available, for example if no * active audio stream exist. Otherwise it returns the quality rating. **/ float linphone_call_get_current_quality(LinphoneCall *call){ @@ -1349,7 +1352,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ { snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from); free(from); - } + } else { snprintf(temp,sizeof(temp),"Remote end seems to have disconnected, the call is going to be closed."); @@ -1362,7 +1365,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed){ int disconnect_timeout = linphone_core_get_nortp_timeout(call->core); bool_t disconnected=FALSE; - + if (call->state==LinphoneCallStreamsRunning && one_second_elapsed){ RtpSession *as=NULL,*vs=NULL; float audio_load=0, video_load=0; @@ -1426,9 +1429,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse void linphone_call_log_completed(LinphoneCall *call){ LinphoneCore *lc=call->core; - + call->log->duration=time(NULL)-call->start_time; - + if (call->log->status==LinphoneCallMissed){ char *info; lc->missed_calls++; From 490945660d975abd2520f92a95ef781b1eaff7e3 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 7 Oct 2011 09:48:52 +0200 Subject: [PATCH 4/6] JNI function getCall now returns a LinphoneCall. --- coreapi/linphonecore_jni.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index b6c7ca47c..0b68fdd7e 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1394,8 +1394,10 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv extern "C" void Java_org_linphone_core_LinphoneCoreImpl_terminateAllCalls(JNIEnv *env,jobject thiz,jlong pCore) { linphone_core_terminate_all_calls((LinphoneCore *) pCore); } -extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,jobject thiz,jlong pCore,jint position) { - return (jlong)ms_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position); +extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getCall(JNIEnv *env,jobject thiz,jlong pCore,jint position) { + LinphoneCoreData *lcd=(LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)pCore); + LinphoneCall* lCall = (LinphoneCall*) ms_list_nth_data(linphone_core_get_calls((LinphoneCore *) pCore),position); + return lcd->getCall(env,lCall); } extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getCallsNb(JNIEnv *env,jobject thiz,jlong pCore) { return ms_list_size(linphone_core_get_calls((LinphoneCore *) pCore)); From 3ef3935785c1618bb5b537c52c6c61b6e19050bf Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 7 Oct 2011 14:40:15 +0200 Subject: [PATCH 5/6] Don't crash when terminating already terminated call. --- coreapi/sal_eXosip2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c index 5b9500509..03fec5b47 100644 --- a/coreapi/sal_eXosip2.c +++ b/coreapi/sal_eXosip2.c @@ -810,6 +810,7 @@ static void pop_auth_from_exosip() { int sal_call_terminate(SalOp *h){ int err; + if (h == NULL) return -1; if (h->auth_info) push_auth_to_exosip(h->auth_info); eXosip_lock(); err=eXosip_call_terminate(h->cid,h->did); From 0109d8680d1dd3985d03854ee1a9670b355a7ba3 Mon Sep 17 00:00:00 2001 From: Guillaume Beraudo Date: Fri, 7 Oct 2011 14:40:58 +0200 Subject: [PATCH 6/6] findCallFromUri now returns an object. --- coreapi/linphonecore_jni.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore_jni.cc b/coreapi/linphonecore_jni.cc index 0b68fdd7e..2e2df6d42 100644 --- a/coreapi/linphonecore_jni.cc +++ b/coreapi/linphonecore_jni.cc @@ -1422,11 +1422,12 @@ extern "C" void Java_org_linphone_core_LinphoneCoreImpl_setZrtpSecretsCache(JNIE } } -extern "C" jlong Java_org_linphone_core_LinphoneCoreImpl_findCallFromUri(JNIEnv *env,jobject thiz,jlong pCore, jstring jUri) { +extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_findCallFromUri(JNIEnv *env,jobject thiz,jlong pCore, jstring jUri) { const char* cUri=env->GetStringUTFChars(jUri, NULL); - const LinphoneCall *call=linphone_core_find_call_from_uri((LinphoneCore *) pCore,cUri); + LinphoneCall *call= (LinphoneCall *) linphone_core_find_call_from_uri((LinphoneCore *) pCore,cUri); env->ReleaseStringUTFChars(jUri, cUri); - return (jlong) call; + LinphoneCoreData *lcdata=(LinphoneCoreData*)linphone_core_get_user_data((LinphoneCore*)pCore); + return (jobject) lcdata->getCall(env,call); }