From 570266ea36b85179b17dd080238447ab035bd870 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 15 Jan 2016 16:39:27 +0100 Subject: [PATCH 01/56] First changes to have the LinphoneCore instance own the factory object instead of sharing it through a static variable. --- coreapi/conference.cc | 4 +++- coreapi/linphonecall.c | 3 ++- coreapi/linphonecore.c | 27 +++++++++++++++++++++------ coreapi/misc.c | 5 +++-- coreapi/private.h | 1 + tester/call_tester.c | 23 ++++++++++++----------- tester/dtmf_tester.c | 4 +++- 7 files changed, 45 insertions(+), 22 deletions(-) diff --git a/coreapi/conference.cc b/coreapi/conference.cc index 121114a64..65c4c639a 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -285,9 +285,11 @@ LocalConference::LocalConference(LinphoneCore *core, const Conference::Params *p m_recordEndpoint(NULL), m_localDummyProfile(NULL), m_terminated(FALSE) { + MSAudioConferenceParams ms_conf_params; ms_conf_params.samplerate = lp_config_get_int(m_core->config, "sound","conference_rate",16000); - m_conf=ms_audio_conference_new(&ms_conf_params); + m_conf=ms_audio_conference_new(&ms_conf_params, core->factory); + } LocalConference::~LocalConference() { diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 5718782ed..b29ebe941 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2349,7 +2349,8 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ setup_dtls_params(call, &audiostream->ms); media_stream_reclaim_sessions(&audiostream->ms, &call->sessions[call->main_audio_stream_index]); }else{ - call->audiostream=audio_stream_new_with_sessions(&call->sessions[call->main_audio_stream_index]); + call->audiostream=audio_stream_new_with_sessions(&call->sessions[call->main_audio_stream_index], lc->factory); + } audiostream=call->audiostream; if (call->media_ports[call->main_audio_stream_index].rtp_port==-1){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 27965a84e..a99aa7ef1 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -33,6 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include "mediastreamer2/mediastream.h" +#include "mediastreamer2/msfactory.h" #include "mediastreamer2/mseventqueue.h" #include "mediastreamer2/msvolume.h" #include "mediastreamer2/msequalizer.h" @@ -1185,7 +1186,8 @@ static bool_t linphone_core_codec_supported(LinphoneCore *lc, SalStreamType type } else if (type == SalText) { return TRUE; } - return ms_filter_codec_supported(mime); + //ms_filter_codec_supported(mime) + return ms_factory_codec_supported (lc->factory, mime ); } @@ -1613,7 +1615,8 @@ static void linphone_core_register_default_codecs(LinphoneCore *lc){ /*default enabled audio codecs, in order of preference*/ #if defined(__arm__) || defined(_M_ARM) /*hack for opus, that needs to be disabed by default on ARM single processor, otherwise there is no cpu left for video processing*/ - if (ms_get_cpu_count()==1) opus_enabled=FALSE; + //if (ms_get_cpu_count()==1) opus_enabled=FALSE; + if (ms_factory_get_cpu_count(lc->factory)==1) opus_enabled=FALSE; #endif linphone_core_register_payload_type(lc,&payload_type_opus,"useinbandfec=1",opus_enabled); linphone_core_register_payload_type(lc,&payload_type_silk_wb,NULL,TRUE); @@ -1703,15 +1706,22 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up"); ortp_init(); linphone_core_activate_log_serialization_if_needed(); + + if (lc->factory == NULL){ + lc->factory = ms_factory_new(); + ms_factory_init_voip(lc->factory); + ms_factory_init_plugins(lc->factory); - ms_init(); + } + //ms_init(); linphone_core_register_default_codecs(lc); linphone_core_register_offer_answer_providers(lc); /* Get the mediastreamer2 event queue */ /* This allows to run event's callback in linphone_core_iterate() */ - lc->msevq=ms_factory_create_event_queue(ms_factory_get_fallback()); - + //lc->msevq=ms_factory_create_event_queue(ms_factory_get_fallback()); + lc->msevq=ms_factory_create_event_queue(lc->factory); + lc->sal=sal_init(); sal_set_http_proxy_host(lc->sal, linphone_core_get_http_proxy_host(lc)); sal_set_http_proxy_port(lc->sal, linphone_core_get_http_proxy_port(lc)); @@ -6455,7 +6465,12 @@ static void linphone_core_uninit(LinphoneCore *lc) if (lc->supported_formats) ms_free(lc->supported_formats); linphone_core_message_storage_close(lc); linphone_core_call_log_storage_close(lc); - ms_exit(); + //ms_exit(); + ms_factory_uninit_voip(lc->factory); + ms_factory_uninit_plugins(lc->factory); + ms_factory_destroy(lc->factory); +// TODO : set to null + linphone_core_set_state(lc,LinphoneGlobalOff,"Off"); linphone_core_deactivate_log_serialization_if_needed(); ms_list_free_with_data(lc->vtable_refs,(void (*)(void *))v_table_reference_destroy); diff --git a/coreapi/misc.c b/coreapi/misc.c index 297371680..2537394ce 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -94,8 +94,9 @@ void linphone_core_set_payload_type_number(LinphoneCore *lc, PayloadType *pt, in } const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt){ - if (ms_filter_codec_supported(pt->mime_type)){ - MSFilterDesc *desc=ms_filter_get_encoder(pt->mime_type); + //if (ms_filter_codec_supported(pt->mime_type)){ + if (ms_factory_codec_supported(lc->factory, pt->mime_type)){ + MSFilterDesc *desc=ms_factory_get_encoder(lc->factory, pt->mime_type); #ifdef ENABLE_NLS return dgettext("mediastreamer",desc->text); #else diff --git a/coreapi/private.h b/coreapi/private.h index 3ed87ca78..d3e3b9a7a 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -860,6 +860,7 @@ void linphone_task_list_free(LinphoneTaskList *t); struct _LinphoneCore { + MSFactory* factory; MSList* vtable_refs; Sal *sal; LinphoneGlobalState state; diff --git a/tester/call_tester.c b/tester/call_tester.c index 996a0e974..f87481486 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -2344,20 +2344,20 @@ static void video_call_using_policy_AVPF_implicit_caller_and_callee(void) { linphone_core_manager_destroy(callee); linphone_core_manager_destroy(caller); } -static void video_call_base_avpf(LinphoneCoreManager* pauline,LinphoneCoreManager* marie, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) { - linphone_core_set_avpf_mode(pauline->lc,LinphoneAVPFEnabled); - linphone_core_set_avpf_mode(marie->lc,LinphoneAVPFEnabled); - video_call_base_3(pauline,marie,using_policy,mode,callee_video_enabled,caller_video_enabled); - end_call(pauline, marie); +static void video_call_base_avpf(LinphoneCoreManager* caller,LinphoneCoreManager* callee, bool_t using_policy,LinphoneMediaEncryption mode, bool_t callee_video_enabled, bool_t caller_video_enabled) { + linphone_core_set_avpf_mode(caller->lc,LinphoneAVPFEnabled); + linphone_core_set_avpf_mode(callee->lc,LinphoneAVPFEnabled); + video_call_base_3(caller,callee,using_policy,mode,callee_video_enabled,caller_video_enabled); + end_call(caller, callee); } static void video_call_avpf(void) { - LinphoneCoreManager* pauline = linphone_core_manager_new("pauline_rc"); - LinphoneCoreManager* marie = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "marie_rc" : "marie_tcp_rc"); + LinphoneCoreManager* callee = linphone_core_manager_new("marie_rc"); + LinphoneCoreManager* caller = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); - video_call_base_avpf(pauline,marie,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE); - linphone_core_manager_destroy(pauline); - linphone_core_manager_destroy(marie); + video_call_base_avpf(caller,callee,FALSE,LinphoneMediaEncryptionNone,TRUE,TRUE); + linphone_core_manager_destroy(callee); + linphone_core_manager_destroy(caller); } @@ -2985,7 +2985,8 @@ static void call_with_mkv_file_player(void) { BC_ASSERT_PTR_NOT_NULL(player); if (player){ int res = linphone_player_open(player,hellomkv,on_eof,marie); - if(!ms_filter_codec_supported("opus")) { + //if(!ms_filter_codec_supported("opus")) { + if(!ms_factory_codec_supported(marie->lc->factory, "opus") && !ms_factory_codec_supported(pauline->lc->factory, "opus")){ BC_ASSERT_EQUAL(res, -1, int, "%d"); end_call(marie, pauline); goto end; diff --git a/tester/dtmf_tester.c b/tester/dtmf_tester.c index e31102304..5e3ecc288 100644 --- a/tester/dtmf_tester.c +++ b/tester/dtmf_tester.c @@ -36,7 +36,9 @@ void send_dtmf_base(LinphoneCoreManager **pmarie, LinphoneCoreManager **ppauline LinphoneCall *marie_call = NULL; if (use_opus) { - if (!ms_filter_codec_supported("opus")) { + //if (!ms_filter_codec_supported("opus")) { + if(!ms_factory_codec_supported(marie->lc->factory, "opus") && !ms_factory_codec_supported(pauline->lc->factory, "opus")){ + ms_warning("Opus not supported, skipping test."); return; } From 16bf6b156374c8e36c568fc7ebc131b4c7ec94ba Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 15 Jan 2016 16:45:25 +0100 Subject: [PATCH 02/56] Updating linphone with mediastreamer2. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 005c28b9f..c50b270e9 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 005c28b9fc0321957a8b339000272b4cb5de8cc0 +Subproject commit c50b270e9a7459dee00b7ac87cc1b96df99771e9 From 1afed9cd174849e2abeee76676bc7caad815b900 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 19 Jan 2016 10:50:01 +0100 Subject: [PATCH 03/56] Propagating changes from conference and webcam in mediastreamer. Updating conference as well in linphone. --- coreapi/conference.cc | 4 ++-- mediastreamer2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/conference.cc b/coreapi/conference.cc index 65c4c639a..3e62716ed 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -307,7 +307,7 @@ RtpProfile *LocalConference::sMakeDummyProfile(int samplerate){ void LocalConference::addLocalEndpoint() { /*create a dummy audiostream in order to extract the local part of it */ /* network address and ports have no meaning and are not used here. */ - AudioStream *st=audio_stream_new(65000,65001,FALSE); + AudioStream *st=audio_stream_new(65000,65001,FALSE,m_core->factory); MSSndCard *playcard=m_core->sound_conf.lsd_card ? m_core->sound_conf.lsd_card : m_core->sound_conf.play_sndcard; MSSndCard *captcard=m_core->sound_conf.capt_sndcard; @@ -516,7 +516,7 @@ int LocalConference::startRecording(const char *path) { return -1; } if (m_recordEndpoint==NULL){ - m_recordEndpoint=ms_audio_endpoint_new_recorder(); + m_recordEndpoint=ms_audio_endpoint_new_recorder(m_core->factory); ms_audio_conference_add_member(m_conf,m_recordEndpoint); } ms_audio_recorder_endpoint_start(m_recordEndpoint,path); diff --git a/mediastreamer2 b/mediastreamer2 index 9f7e7fe39..081c581af 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 9f7e7fe39f8f6d0a62c5264d2de6bc6c3b2441df +Subproject commit 081c581afc080352651dfbd6c4aefd24b7e2e400 From 56a452a8f3277b36df98d6b240df96237146e453 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 19 Jan 2016 10:54:09 +0100 Subject: [PATCH 04/56] Update mediastreamer and player. --- coreapi/localplayer.c | 6 +++--- coreapi/private.h | 2 +- gtk/audio_assistant.c | 6 +++--- mediastreamer2 | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/coreapi/localplayer.c b/coreapi/localplayer.c index eb53eb640..91ce833a9 100644 --- a/coreapi/localplayer.c +++ b/coreapi/localplayer.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -static int _local_player_open(LinphonePlayer *obj, const char *filename); +static int _local_player_open(LinphonePlayer *obj, const char *filename, MSFactory *factory); static int _local_player_start(LinphonePlayer *obj); static int _local_player_pause(LinphonePlayer *obj); static int _local_player_seek(LinphonePlayer *obj, int time_ms); @@ -54,8 +54,8 @@ bool_t linphone_local_player_matroska_supported(void) { return ms_media_player_matroska_supported(); } -static int _local_player_open(LinphonePlayer *obj, const char *filename) { - return ms_media_player_open((MSMediaPlayer *)obj->impl, filename) ? 0 : -1; +static int _local_player_open(LinphonePlayer *obj, const char *filename,MSFactory* factory) { + return ms_media_player_open((MSMediaPlayer *)obj->impl, filename, factory) ? 0 : -1; } static int _local_player_start(LinphonePlayer *obj) { diff --git a/coreapi/private.h b/coreapi/private.h index f866f7477..db25d19d3 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1227,7 +1227,7 @@ LINPHONE_PUBLIC int linphone_remote_provisioning_load_file( LinphoneCore* lc, co ****************************************************************************/ struct _LinphonePlayer{ - int (*open)(struct _LinphonePlayer* player, const char *filename); + int (*open)(struct _LinphonePlayer* player, const char *filename, MSFactory *factory); int (*start)(struct _LinphonePlayer* player); int (*pause)(struct _LinphonePlayer* player); int (*seek)(struct _LinphonePlayer* player, int time_ms); diff --git a/gtk/audio_assistant.c b/gtk/audio_assistant.c index b10a2c93a..56dcc2ad9 100644 --- a/gtk/audio_assistant.c +++ b/gtk/audio_assistant.c @@ -218,7 +218,7 @@ void linphone_gtk_start_record_sound(GtkWidget *w, gpointer data){ if(active){ gchar *path = get_record_file(); - stream=audio_stream_new(8888, 8889, FALSE); + stream=audio_stream_new(8888, 8889, FALSE, lc->factory); if(stream != NULL){ audio_stream_start_full(stream,&av_profile,"127.0.0.1",8888,"127.0.0.1",8889,0,0,NULL, path,NULL,ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE); @@ -261,7 +261,7 @@ void linphone_gtk_start_play_record_sound(GtkWidget *w,gpointer data){ if(active){ gchar *path = g_object_get_data(G_OBJECT(audio_assistant),"path"); - stream=audio_stream_new(8888, 8889, FALSE); + stream=audio_stream_new(8888, 8889, FALSE, lc->factory); if(path != NULL){ audio_stream_start_full(stream,&av_profile,"127.0.0.1",8888,"127.0.0.1",8889,0,0,path, NULL,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),NULL,FALSE); @@ -453,7 +453,7 @@ static void prepare(GtkAssistant *w){ //Speaker page if(page == 1){ MSSndCardManager *manager = ms_snd_card_manager_get(); - audio_stream = audio_stream_start_with_sndcards(&av_profile,9898,"127.0.0.1",19898,0,0,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE); + audio_stream = audio_stream_start_with_sndcards(&av_profile,9898,"127.0.0.1",19898,0,0,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE, lc->factory); if (mic_audiolevel != NULL && audio_stream != NULL){ g_object_set_data(G_OBJECT(audio_assistant),"stream",audio_stream); linphone_gtk_init_audio_meter(mic_audiolevel,(get_volume_t)audio_stream_get_record_volume,audio_stream); diff --git a/mediastreamer2 b/mediastreamer2 index 081c581af..8fc4323f8 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 081c581afc080352651dfbd6c4aefd24b7e2e400 +Subproject commit 8fc4323f8166b7432bdbf409fdeb426e08cdff32 From 48b10c17240cae7dd5adbd444a080e40fe192e04 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 19 Jan 2016 13:58:21 +0100 Subject: [PATCH 05/56] Update media streamer2 : text stream, ring stream, audio stream. Adding declaration of void ms_factory_set_mtu in factory.h. Adding a getter linphone_core_get_factory(void *lc) in linphonecore.h. --- coreapi/callbacks.c | 2 +- coreapi/linphonecore.c | 12 ++++++++---- coreapi/linphonecore.h | 1 + coreapi/ringtoneplayer.c | 2 +- mediastreamer2 | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index af1cfb919..1694c7e4f 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -405,7 +405,7 @@ static void start_remote_ring(LinphoneCore *lc, LinphoneCall *call) { if (call->audiostream) audio_stream_unprepare_sound(call->audiostream); if( lc->sound_conf.remote_ring ){ - lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard); + lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard,lc->factory); } } } diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 02ea2c21b..0e48a2c4c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -4788,6 +4788,9 @@ int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCb return err; } +MSFactory *linphone_core_get_factory(void *lc){ + return ((LinphoneCore*)lc)->factory; +} /** * Sets the path to a wav file used for ringing back. * @@ -5231,6 +5234,7 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){ video_preview_set_native_window_id(lc->previewstream,lc->preview_window_id); video_preview_set_fps(lc->previewstream,linphone_core_get_preferred_framerate(lc)); video_preview_start(lc->previewstream,lc->video_conf.device); + lc->previewstream->ms.factory = lc->factory; } }else{ if (lc->previewstream!=NULL){ @@ -5917,7 +5921,7 @@ static MSFilter *get_audio_resource(LinphoneCore *lc, LinphoneAudioResourceType if (ringcard == NULL) return NULL; - ringstream=lc->ringstream=ring_start(NULL,0,ringcard); + ringstream=lc->ringstream=ring_start(NULL,0,ringcard, lc->factory); ms_filter_call_method(lc->ringstream->gendtmf,MS_DTMF_GEN_SET_DEFAULT_AMPLITUDE,&); lc->dmfs_playing_start_time = ms_get_cur_time_ms()/1000; }else{ @@ -6081,9 +6085,9 @@ void linphone_core_set_mtu(LinphoneCore *lc, int mtu){ ms_error("MTU too small !"); mtu=500; } - ms_set_mtu(mtu); - ms_message("MTU is supposed to be %i, rtp payload max size will be %i",mtu, ms_get_payload_max_size()); - }else ms_set_mtu(0);//use mediastreamer2 default value + ms_factory_set_mtu(lc->factory, mtu); + ms_message("MTU is supposed to be %i, rtp payload max size will be %i",mtu, ms_factory_get_payload_max_size(lc->factory)); + }else ms_factory_set_mtu(lc->factory, 0);//use mediastreamer2 default value } void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneCoreWaitingCallback cb, void *user_context){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 0fb78538e..36da70623 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -3241,6 +3241,7 @@ LINPHONE_PUBLIC void linphone_core_set_ring_during_incoming_early_media(Linphone LINPHONE_PUBLIC bool_t linphone_core_get_ring_during_incoming_early_media(const LinphoneCore *lc); LINPHONE_PUBLIC int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata); +LINPHONE_PUBLIC MSFactory* linphone_core_get_factory(void* lc); LINPHONE_PUBLIC int linphone_core_play_local(LinphoneCore *lc, const char *audiofile); LINPHONE_PUBLIC void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val); LINPHONE_PUBLIC bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc); diff --git a/coreapi/ringtoneplayer.c b/coreapi/ringtoneplayer.c index 1955da18d..fe63c451e 100644 --- a/coreapi/ringtoneplayer.c +++ b/coreapi/ringtoneplayer.c @@ -85,7 +85,7 @@ int linphone_ringtoneplayer_start_with_cb(LinphoneRingtonePlayer* rp, MSSndCard* ms_message("Starting local ringtone..."); rp->end_of_ringtone = end_of_ringtone; rp->end_of_ringtone_ud = user_data; - rp->ringstream=ring_start_with_cb(ringtone,loop_pause_ms,card,notify_end_of_ringtone,rp); + rp->ringstream=ring_start_with_cb(ringtone,loop_pause_ms,card,notify_end_of_ringtone,rp,linphone_core_get_factory(user_data)); return rp->ringstream != NULL ? 0 : 1; } return 3; diff --git a/mediastreamer2 b/mediastreamer2 index 8fc4323f8..68ec6e611 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 8fc4323f8166b7432bdbf409fdeb426e08cdff32 +Subproject commit 68ec6e6113d0bdada57fdfac462e0dd8ebc6a53e From a8d978c832b492fa390a16126b092650720c1d95 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 19 Jan 2016 15:51:02 +0100 Subject: [PATCH 06/56] Small fixes for factory integration in linphonecall.c , misc.c and offeranswer.c . --- coreapi/linphonecall.c | 49 +++++++++++------------------------------- coreapi/misc.c | 4 ++-- coreapi/offeranswer.c | 2 +- 3 files changed, 15 insertions(+), 40 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 312388f50..d1025888e 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -979,9 +979,9 @@ static void discover_mtu(LinphoneCore *lc, const char *remote){ /*attempt to discover mtu*/ mtu=ms_discover_mtu(remote); if (mtu>0){ - ms_set_mtu(mtu); + ms_factory_set_mtu(lc->factory, mtu); ms_message("Discovered mtu is %i, RTP payload max size is %i", - mtu, ms_get_payload_max_size()); + mtu, ms_factory_get_payload_max_size(lc->factory)); } } } @@ -2341,7 +2341,8 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ call->audiostream=audiostream=audio_stream_new2(linphone_call_get_bind_ip_for_stream(call,call->main_audio_stream_index), multicast_role == SalMulticastReceiver ? stream_desc->rtp_port : call->media_ports[call->main_audio_stream_index].rtp_port, - multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_audio_stream_index].rtcp_port); + multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_audio_stream_index].rtcp_port, + call->core->factory); if (multicast_role == SalMulticastReceiver) linphone_call_join_multicast_group(call, call->main_audio_stream_index, &audiostream->ms); rtp_session_enable_network_simulation(call->audiostream->ms.sessions.rtp_session, &lc->net_conf.netsim_params); @@ -2509,7 +2510,8 @@ void linphone_call_init_text_stream(LinphoneCall *call){ call->textstream = textstream = text_stream_new2(linphone_call_get_bind_ip_for_stream(call,call->main_text_stream_index), multicast_role == SalMulticastReceiver ? stream_desc->rtp_port : call->media_ports[call->main_text_stream_index].rtp_port, - multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_text_stream_index].rtcp_port); + multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_text_stream_index].rtcp_port, + call->core->factory); if (multicast_role == SalMulticastReceiver) linphone_call_join_multicast_group(call, call->main_text_stream_index, &textstream->ms); rtp_session_enable_network_simulation(call->textstream->ms.sessions.rtp_session, &lc->net_conf.netsim_params); @@ -2519,7 +2521,7 @@ void linphone_call_init_text_stream(LinphoneCall *call){ setup_dtls_params(call, &textstream->ms); media_stream_reclaim_sessions(&textstream->ms, &call->sessions[call->main_text_stream_index]); } else { - call->textstream = text_stream_new_with_sessions(&call->sessions[call->main_text_stream_index]); + call->textstream = text_stream_new_with_sessions(&call->sessions[call->main_text_stream_index],call->core->factory); } textstream = call->textstream; if (call->media_ports[call->main_text_stream_index].rtp_port == -1) { @@ -3343,7 +3345,7 @@ static void linphone_call_start_text_stream(LinphoneCall *call) { if (is_multicast) rtp_session_set_multicast_ttl(call->textstream->ms.sessions.rtp_session,tstream->ttl); - text_stream_start(call->textstream, call->text_profile, rtp_addr, tstream->rtp_port, rtcp_addr, (linphone_core_rtcp_enabled(lc) && !is_multicast) ? (tstream->rtcp_port ? tstream->rtcp_port : tstream->rtp_port + 1) : 0, used_pt); + text_stream_start(call->textstream, call->text_profile, rtp_addr, tstream->rtp_port, rtcp_addr, (linphone_core_rtcp_enabled(lc) && !is_multicast) ? (tstream->rtcp_port ? tstream->rtcp_port : tstream->rtp_port + 1) : 0, used_pt, call->core->factory); ms_filter_add_notify_callback(call->textstream->rttsink, real_time_text_character_received, call, FALSE); ms_media_stream_sessions_set_encryption_mandatory(&call->textstream->ms.sessions,call->current_params->encryption_mandatory); @@ -4227,25 +4229,6 @@ static void linphone_call_lost(LinphoneCall *call, LinphoneReason reason){ ms_free(temp); } -static void change_ice_media_destinations(LinphoneCall *call) { - const char *rtp_addr; - const char *rtcp_addr; - int rtp_port; - int rtcp_port; - bool_t result; - int i; - IceCheckList *cl; - - for (i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; ++i){ - if ((cl = ice_session_check_list(call->ice_session, i)) != NULL){ - result = ice_check_list_selected_valid_remote_candidate(cl, &rtp_addr, &rtp_port, &rtcp_addr, &rtcp_port); - if (result == TRUE) { - ms_message("Change stream index %i destination: RTP=%s:%d RTCP=%s:%d", i, rtp_addr, rtp_port, rtcp_addr, rtcp_port); - rtp_session_set_remote_addr_full(call->sessions[i].rtp_session, rtp_addr, rtp_port, rtcp_addr, rtcp_port); - } - } - } -} static void linphone_call_on_ice_gathering_finished(LinphoneCall *call){ int ping_time; @@ -4282,28 +4265,20 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ switch (ice_session_state(call->ice_session)) { case IS_Completed: - ice_session_select_candidates(call->ice_session); - if (ice_session_role(call->ice_session) == IR_Controlling - && params->update_call_when_ice_completed) { - params->internal_call_update = TRUE; - linphone_core_update_call(call->core, call, params); - } - change_ice_media_destinations(call); - start_dtls_on_all_streams(call); - break; case IS_Failed: + /* At least one ICE session has succeeded, so perform a call update. */ if (ice_session_has_completed_check_list(call->ice_session) == TRUE) { - ice_session_select_candidates(call->ice_session); - if (ice_session_role(call->ice_session) == IR_Controlling) { - /* At least one ICE session has succeeded, so perform a call update. */ + if (ice_session_role(call->ice_session) == IR_Controlling && params->update_call_when_ice_completed ) { params->internal_call_update = TRUE; linphone_core_update_call(call->core, call, params); } + start_dtls_on_all_streams(call); } break; default: break; } + linphone_core_update_ice_state_in_call_stats(call); linphone_call_params_unref(params); } else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) { diff --git a/coreapi/misc.c b/coreapi/misc.c index b80a437b9..4f4e7fd82 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -261,7 +261,7 @@ bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, const Payloa && linphone_core_echo_cancellation_enabled(lc) && (pt->clock_rate!=16000 && pt->clock_rate!=8000) && strcasecmp(pt->mime_type,"opus")!=0 - && ms_filter_lookup_by_name("MSWebRTCAEC")!=NULL){ + && ms_factory_lookup_filter_by_name(lc->factory, "MSWebRTCAEC")!=NULL){ ms_warning("Payload type %s/%i cannot be used because software echo cancellation is required but is unable to operate at this rate.", pt->mime_type,pt->clock_rate); ret=FALSE; @@ -1833,7 +1833,7 @@ const char ** linphone_core_get_supported_file_formats(LinphoneCore *core){ if (core->supported_formats==NULL){ core->supported_formats=ms_malloc0(3*sizeof(char*)); core->supported_formats[0]=wav; - if (ms_factory_lookup_filter_by_id(ms_factory_get_fallback(),MS_MKV_RECORDER_ID)){ + if (ms_factory_lookup_filter_by_id(core->factory,MS_MKV_RECORDER_ID)){ core->supported_formats[1]=mkv; } } diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index bc115001a..443e6cb48 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -145,7 +145,7 @@ static PayloadType * generic_match(const MSList *local_payloads, const PayloadTy void linphone_core_register_offer_answer_providers(LinphoneCore *lc){ - MSFactory *factory = ms_factory_get_fallback(); + MSFactory *factory = lc->factory; ms_factory_register_offer_answer_provider(factory, &red_offer_answer_provider); ms_factory_register_offer_answer_provider(factory, &g729a_offer_answer_provider); ms_factory_register_offer_answer_provider(factory, &opus_offer_answer_provider); From 1f624ada80100645944c88aea5860b19f94c5f0c Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 20 Jan 2016 15:12:12 +0100 Subject: [PATCH 07/56] Updating echo cancellation and adding MSFactory into Sal structure. --- coreapi/bellesip_sal/sal_impl.c | 4 ++-- coreapi/bellesip_sal/sal_impl.h | 1 + coreapi/bellesip_sal/sal_op_call.c | 4 ++-- coreapi/ec-calibrator.c | 19 ++++++++++--------- coreapi/linphonecall.c | 5 +++-- coreapi/linphonecore.c | 10 ++++------ coreapi/offeranswer.c | 24 ++++++++++++------------ coreapi/offeranswer.h | 4 ++-- coreapi/private.h | 1 + include/sal/sal.h | 2 +- tester/tester.c | 2 +- 11 files changed, 39 insertions(+), 37 deletions(-) diff --git a/coreapi/bellesip_sal/sal_impl.c b/coreapi/bellesip_sal/sal_impl.c index 123aadb3a..2771b1fec 100644 --- a/coreapi/bellesip_sal/sal_impl.c +++ b/coreapi/bellesip_sal/sal_impl.c @@ -464,13 +464,13 @@ static void process_auth_requested(void *sal, belle_sip_auth_event_t *event) { sal_auth_info_delete(auth_info); } -Sal * sal_init(){ +Sal * sal_init(MSFactory *factory){ belle_sip_listener_callbacks_t listener_callbacks; Sal * sal=ms_new0(Sal,1); /*belle_sip_object_enable_marshal_check(TRUE);*/ sal->auto_contacts=TRUE; - + sal->factory = factory; /*first create the stack, which initializes the belle-sip object's pool for this thread*/ belle_sip_set_log_handler(_belle_sip_log); sal->stack = belle_sip_stack_new(NULL); diff --git a/coreapi/bellesip_sal/sal_impl.h b/coreapi/bellesip_sal/sal_impl.h index 9837e8078..d492d91e5 100644 --- a/coreapi/bellesip_sal/sal_impl.h +++ b/coreapi/bellesip_sal/sal_impl.h @@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "belle-sip/belle-sdp.h" struct Sal{ + MSFactory *factory; SalCallbacks callbacks; MSList *pending_auths;/*MSList of SalOp */ belle_sip_stack_t* stack; diff --git a/coreapi/bellesip_sal/sal_op_call.c b/coreapi/bellesip_sal/sal_op_call.c index 482413d6d..7ff099f72 100644 --- a/coreapi/bellesip_sal/sal_op_call.c +++ b/coreapi/bellesip_sal/sal_op_call.c @@ -57,13 +57,13 @@ static void sdp_process(SalOp *h){ h->result=sal_media_description_new(); if (h->sdp_offering){ - offer_answer_initiate_outgoing(h->base.local_media,h->base.remote_media,h->result); + offer_answer_initiate_outgoing(h->base.root->factory, h->base.local_media,h->base.remote_media,h->result); }else{ int i; if (h->sdp_answer){ belle_sip_object_unref(h->sdp_answer); } - offer_answer_initiate_incoming(h->base.local_media,h->base.remote_media,h->result,h->base.root->one_matching_codec); + offer_answer_initiate_incoming(h->base.root->factory, h->base.local_media,h->base.remote_media,h->result,h->base.root->one_matching_codec); /*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); diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index bdf3a9180..14276ae8c 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -41,26 +41,26 @@ static void ecc_init_filters(EcCalibrator *ecc){ ms_filter_call_method(ecc->sndread,MS_FILTER_GET_SAMPLE_RATE,&rate); ms_filter_call_method(ecc->sndread,MS_FILTER_SET_NCHANNELS,&ecc_channels); ms_filter_call_method(ecc->sndread,MS_FILTER_GET_NCHANNELS,&channels); - ecc->read_resampler=ms_filter_new(MS_RESAMPLE_ID); + ecc->read_resampler=ms_factory_create_filter(ecc->factory, MS_RESAMPLE_ID); ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_SAMPLE_RATE,&rate); ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_OUTPUT_SAMPLE_RATE,&ecc->rate); ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_NCHANNELS,&ecc_channels); ms_filter_call_method(ecc->read_resampler,MS_FILTER_SET_OUTPUT_NCHANNELS,&channels); - ecc->det=ms_filter_new(MS_TONE_DETECTOR_ID); + ecc->det=ms_factory_create_filter(ecc->factory, MS_TONE_DETECTOR_ID); ms_filter_call_method(ecc->det,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); - ecc->rec=ms_filter_new(MS_VOID_SINK_ID); + ecc->rec=ms_factory_create_filter(ecc->factory, MS_VOID_SINK_ID); ms_filter_link(ecc->sndread,0,ecc->read_resampler,0); ms_filter_link(ecc->read_resampler,0,ecc->det,0); ms_filter_link(ecc->det,0,ecc->rec,0); - ecc->play=ms_filter_new(MS_VOID_SOURCE_ID); - ecc->gen=ms_filter_new(MS_DTMF_GEN_ID); + ecc->play=ms_factory_create_filter(ecc->factory, MS_VOID_SOURCE_ID); + ecc->gen=ms_factory_create_filter(ecc->factory, MS_DTMF_GEN_ID); ms_filter_call_method(ecc->gen,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); - ecc->write_resampler=ms_filter_new(MS_RESAMPLE_ID); - ecc->sndwrite=ms_snd_card_create_writer(ecc->play_card); + ecc->write_resampler=ms_factory_create_filter(ecc->factory, MS_RESAMPLE_ID); + ecc->sndwrite=ms_snd_card_create_writer((void*)ecc->factory, ecc->play_card); ms_filter_call_method(ecc->sndwrite,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ms_filter_call_method(ecc->sndwrite,MS_FILTER_GET_SAMPLE_RATE,&rate); @@ -281,7 +281,7 @@ static void * ecc_thread(void *p){ return NULL; } -EcCalibrator * ec_calibrator_new(MSSndCard *play_card, MSSndCard *capt_card, unsigned int rate, LinphoneEcCalibrationCallback cb, +EcCalibrator * ec_calibrator_new(MSFactory *factory, MSSndCard *play_card, MSSndCard *capt_card, unsigned int rate, LinphoneEcCalibrationCallback cb, LinphoneEcCalibrationAudioInit audio_init_cb, LinphoneEcCalibrationAudioUninit audio_uninit_cb, void *cb_data){ EcCalibrator *ecc=ms_new0(EcCalibrator,1); @@ -292,6 +292,7 @@ EcCalibrator * ec_calibrator_new(MSSndCard *play_card, MSSndCard *capt_card, uns ecc->audio_uninit_cb=audio_uninit_cb; ecc->capt_card=capt_card; ecc->play_card=play_card; + ecc->factory=factory; return ecc; } @@ -317,7 +318,7 @@ int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibration return -1; } rate = lp_config_get_int(lc->config,"sound","echo_cancellation_rate",8000); - lc->ecc=ec_calibrator_new(lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard,rate,cb,audio_init_cb,audio_uninit_cb,cb_data); + lc->ecc=ec_calibrator_new(lc->factory, lc->sound_conf.play_sndcard,lc->sound_conf.capt_sndcard,rate,cb,audio_init_cb,audio_uninit_cb,cb_data); lc->ecc->play_cool_tones = lp_config_get_int(lc->config, "sound", "ec_calibrator_cool_tones", 0); ec_calibrator_start(lc->ecc); return 0; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index cb88c019c..fb86e3a3d 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -2437,7 +2437,8 @@ void linphone_call_init_video_stream(LinphoneCall *call){ call->videostream=video_stream_new2(linphone_call_get_bind_ip_for_stream(call,call->main_video_stream_index), multicast_role == SalMulticastReceiver ? stream_desc->rtp_port : call->media_ports[call->main_video_stream_index].rtp_port, - multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_video_stream_index].rtcp_port); + multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_video_stream_index].rtcp_port, + lc->factory); if (multicast_role == SalMulticastReceiver) linphone_call_join_multicast_group(call, call->main_video_stream_index, &call->videostream->ms); rtp_session_enable_network_simulation(call->videostream->ms.sessions.rtp_session, &lc->net_conf.netsim_params); @@ -2448,7 +2449,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){ setup_dtls_params(call, &call->videostream->ms); media_stream_reclaim_sessions(&call->videostream->ms, &call->sessions[call->main_video_stream_index]); }else{ - call->videostream=video_stream_new_with_sessions(&call->sessions[call->main_video_stream_index]); + call->videostream=video_stream_new_with_sessions(&call->sessions[call->main_video_stream_index], lc->factory); } if (call->media_ports[call->main_video_stream_index].rtp_port==-1){ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 093ef6733..e2183e45a 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1679,20 +1679,18 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab if (lc->factory == NULL){ lc->factory = ms_factory_new(); - ms_factory_init_voip(lc->factory); - ms_factory_init_plugins(lc->factory); - } - //ms_init(); + ms_factory_init_voip(lc->factory); + ms_factory_init_plugins(lc->factory); + linphone_core_register_default_codecs(lc); linphone_core_register_offer_answer_providers(lc); /* Get the mediastreamer2 event queue */ /* This allows to run event's callback in linphone_core_iterate() */ - //lc->msevq=ms_factory_create_event_queue(ms_factory_get_fallback()); lc->msevq=ms_factory_create_event_queue(lc->factory); - lc->sal=sal_init(); + lc->sal=sal_init(lc->factory); sal_set_http_proxy_host(lc->sal, linphone_core_get_http_proxy_host(lc)); sal_set_http_proxy_port(lc->sal, linphone_core_get_http_proxy_port(lc)); diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 443e6cb48..7bed10b92 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -154,10 +154,10 @@ void linphone_core_register_offer_answer_providers(LinphoneCore *lc){ /* * Returns a PayloadType from the local list that matches a PayloadType offered or answered in the remote list */ -static PayloadType * find_payload_type_best_match(const MSList *local_payloads, const PayloadType *refpt, +static PayloadType * find_payload_type_best_match(MSFactory *factory, const MSList *local_payloads, const PayloadType *refpt, const MSList *remote_payloads, bool_t reading_response){ PayloadType *ret = NULL; - MSOfferAnswerContext *ctx = ms_factory_create_offer_answer_context(ms_factory_get_fallback(), refpt->mime_type); + MSOfferAnswerContext *ctx = ms_factory_create_offer_answer_context(factory, refpt->mime_type); if (ctx){ ms_message("Doing offer/answer processing with specific provider for codec [%s]", refpt->mime_type); ret = ms_offer_answer_context_match_payload(ctx, local_payloads, refpt, remote_payloads, reading_response); @@ -168,7 +168,7 @@ static PayloadType * find_payload_type_best_match(const MSList *local_payloads, } -static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t reading_response, bool_t one_matching_codec){ +static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSList *remote, bool_t reading_response, bool_t one_matching_codec){ const MSList *e2,*e1; MSList *res=NULL; PayloadType *matched; @@ -176,7 +176,7 @@ static MSList *match_payloads(const MSList *local, const MSList *remote, bool_t for(e2=remote;e2!=NULL;e2=e2->next){ PayloadType *p2=(PayloadType*)e2->data; - matched=find_payload_type_best_match(local, p2, remote, reading_response); + matched=find_payload_type_best_match(factory, local, p2, remote, reading_response); if (matched){ int local_number=payload_type_get_number(matched); int remote_number=payload_type_get_number(p2); @@ -321,11 +321,11 @@ static SalStreamDir compute_dir_incoming(SalStreamDir local, SalStreamDir offere return res; } -static void initiate_outgoing(const SalStreamDescription *local_offer, +static void initiate_outgoing(MSFactory* factory, const SalStreamDescription *local_offer, const SalStreamDescription *remote_answer, SalStreamDescription *result){ if (remote_answer->rtp_port!=0) - result->payloads=match_payloads(local_offer->payloads,remote_answer->payloads,TRUE,FALSE); + result->payloads=match_payloads(factory, local_offer->payloads,remote_answer->payloads,TRUE,FALSE); else { ms_message("Local stream description [%p] rejected by peer",local_offer); result->rtp_port=0; @@ -438,10 +438,10 @@ static void initiate_outgoing(const SalStreamDescription *local_offer, } -static void initiate_incoming(const SalStreamDescription *local_cap, +static void initiate_incoming(MSFactory *factory, const SalStreamDescription *local_cap, const SalStreamDescription *remote_offer, SalStreamDescription *result, bool_t one_matching_codec){ - result->payloads=match_payloads(local_cap->payloads,remote_offer->payloads, FALSE, one_matching_codec); + result->payloads=match_payloads(factory, local_cap->payloads,remote_offer->payloads, FALSE, one_matching_codec); result->proto=remote_offer->proto; result->type=local_cap->type; result->dir=compute_dir_incoming(local_cap->dir,remote_offer->dir); @@ -513,7 +513,7 @@ static void initiate_incoming(const SalStreamDescription *local_cap, * Returns a media description to run the streams with, based on a local offer * and the returned response (remote). **/ -int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer, +int offer_answer_initiate_outgoing(MSFactory *factory, const SalMediaDescription *local_offer, const SalMediaDescription *remote_answer, SalMediaDescription *result){ int i; @@ -524,7 +524,7 @@ int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer, ls=&local_offer->streams[i]; rs=&remote_answer->streams[i]; if (rs && ls->proto == rs->proto && rs->type == ls->type) { - initiate_outgoing(ls,rs,&result->streams[i]); + initiate_outgoing(factory, ls,rs,&result->streams[i]); memcpy(&result->streams[i].rtcp_xr, &ls->rtcp_xr, sizeof(result->streams[i].rtcp_xr)); if ((ls->rtcp_xr.enabled == TRUE) && (rs->rtcp_xr.enabled == FALSE)) { result->streams[i].rtcp_xr.enabled = FALSE; @@ -552,7 +552,7 @@ int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer, * and the received offer. * The returned media description is an answer and should be sent to the offerer. **/ -int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities, +int offer_answer_initiate_incoming(MSFactory *factory, const SalMediaDescription *local_capabilities, const SalMediaDescription *remote_offer, SalMediaDescription *result, bool_t one_matching_codec){ int i; @@ -562,7 +562,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities rs = &remote_offer->streams[i]; ls = &local_capabilities->streams[i]; if (ls && rs->type == ls->type && rs->proto == ls->proto){ - initiate_incoming(ls,rs,&result->streams[i],one_matching_codec); + initiate_incoming(factory, ls,rs,&result->streams[i],one_matching_codec); // Handle global RTCP FB attributes result->streams[i].rtcp_fb.generic_nack_enabled = rs->rtcp_fb.generic_nack_enabled; result->streams[i].rtcp_fb.tmmbr_enabled = rs->rtcp_fb.tmmbr_enabled; diff --git a/coreapi/offeranswer.h b/coreapi/offeranswer.h index 0c8ebd7b1..009e82fcb 100644 --- a/coreapi/offeranswer.h +++ b/coreapi/offeranswer.h @@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * Returns a media description to run the streams with, based on a local offer * and the returned response (remote). **/ -int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer, +int offer_answer_initiate_outgoing(MSFactory *factory, const SalMediaDescription *local_offer, const SalMediaDescription *remote_answer, SalMediaDescription *result); @@ -39,7 +39,7 @@ int offer_answer_initiate_outgoing(const SalMediaDescription *local_offer, * and the received offer. * The returned media description is an answer and should be sent to the offerer. **/ -int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities, +int offer_answer_initiate_incoming(MSFactory* factory, const SalMediaDescription *local_capabilities, const SalMediaDescription *remote_offer, SalMediaDescription *result, bool_t one_matching_codec); diff --git a/coreapi/private.h b/coreapi/private.h index db25d19d3..f6e8829cb 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1011,6 +1011,7 @@ bool_t linphone_core_is_payload_type_usable_for_bandwidth(LinphoneCore *lc, cons void _linphone_core_configure_resolver(void); struct _EcCalibrator{ + MSFactory *factory; ms_thread_t thread; MSSndCard *play_card,*capt_card; MSFilter *sndread,*det,*rec; diff --git a/include/sal/sal.h b/include/sal/sal.h index 58c63f0c5..b4078964d 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -132,7 +132,7 @@ void sal_address_set_password(SalAddress *addr, const char *passwd); const char *sal_address_get_password(const SalAddress *addr); void sal_address_set_header(SalAddress *addr, const char *header_name, const char *header_value); -LINPHONE_PUBLIC Sal * sal_init(void); +LINPHONE_PUBLIC Sal * sal_init(MSFactory *factory); LINPHONE_PUBLIC void sal_uninit(Sal* sal); void sal_set_user_pointer(Sal *sal, void *user_data); void *sal_get_user_pointer(const Sal *sal); diff --git a/tester/tester.c b/tester/tester.c index 40f1461e2..6bfd4972e 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -248,7 +248,7 @@ LinphoneCoreManager *get_manager(LinphoneCore *lc){ } bool_t transport_supported(LinphoneTransportType transport) { - Sal *sal = sal_init(); + Sal *sal = sal_init(NULL); bool_t supported = sal_transport_available(sal,(SalTransport)transport); if (!supported) ms_message("TLS transport not supported, falling back to TCP if possible otherwise skipping test."); sal_uninit(sal); From 3cf64721ddfc6780b546517b8f171dfdc8ce5960 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 20 Jan 2016 15:17:36 +0100 Subject: [PATCH 08/56] Propagating modifications in mediastreamer. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 8680e3a03..87f137fdc 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 8680e3a0368bce945c68ebd7664fdafb02c3a2f0 +Subproject commit 87f137fdc953f00f8e9043a63782debeb6715aa3 From 6fd92fdcf9c2c3c645f0cf43dc4bca0153751c67 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 21 Jan 2016 09:28:19 +0100 Subject: [PATCH 09/56] Fixes in gtk audio_assistant and property box. --- coreapi/ec-calibrator.c | 2 +- gtk/audio_assistant.c | 15 +++++++++------ gtk/propertybox.c | 3 ++- tester/player_tester.c | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index 14276ae8c..8ff0cbc8a 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -60,7 +60,7 @@ static void ecc_init_filters(EcCalibrator *ecc){ ecc->gen=ms_factory_create_filter(ecc->factory, MS_DTMF_GEN_ID); ms_filter_call_method(ecc->gen,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ecc->write_resampler=ms_factory_create_filter(ecc->factory, MS_RESAMPLE_ID); - ecc->sndwrite=ms_snd_card_create_writer((void*)ecc->factory, ecc->play_card); + ecc->sndwrite=ms_snd_card_create_writer(ecc->play_card); ms_filter_call_method(ecc->sndwrite,MS_FILTER_SET_SAMPLE_RATE,&ecc->rate); ms_filter_call_method(ecc->sndwrite,MS_FILTER_GET_SAMPLE_RATE,&rate); diff --git a/gtk/audio_assistant.c b/gtk/audio_assistant.c index 56dcc2ad9..e8599f286 100644 --- a/gtk/audio_assistant.c +++ b/gtk/audio_assistant.c @@ -211,14 +211,15 @@ static gboolean linphone_gtk_stop_record(gpointer data){ void linphone_gtk_start_record_sound(GtkWidget *w, gpointer data){ LinphoneCore *lc = linphone_gtk_get_core(); + MSFactory *factory = linphone_core_get_factory((void*)lc); AudioStream *stream = NULL; - MSSndCardManager *manager = ms_snd_card_manager_get(); + MSSndCardManager *manager = ms_snd_card_manager_get(factory); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); gint timeout_id; if(active){ gchar *path = get_record_file(); - stream=audio_stream_new(8888, 8889, FALSE, lc->factory); + stream=audio_stream_new(8888, 8889, FALSE, factory); if(stream != NULL){ audio_stream_start_full(stream,&av_profile,"127.0.0.1",8888,"127.0.0.1",8889,0,0,NULL, path,NULL,ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE); @@ -255,13 +256,14 @@ static void endoffile_cb(void *ud, MSFilter *f, unsigned int ev,void * arg){ void linphone_gtk_start_play_record_sound(GtkWidget *w,gpointer data){ LinphoneCore *lc = linphone_gtk_get_core(); + MSFactory *factory = linphone_core_get_factory((void*)lc); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); AudioStream *stream = NULL; - MSSndCardManager *manager = ms_snd_card_manager_get(); + MSSndCardManager *manager = ms_snd_card_manager_get(factory); if(active){ gchar *path = g_object_get_data(G_OBJECT(audio_assistant),"path"); - stream=audio_stream_new(8888, 8889, FALSE, lc->factory); + stream=audio_stream_new(8888, 8889, FALSE, factory); if(path != NULL){ audio_stream_start_full(stream,&av_profile,"127.0.0.1",8888,"127.0.0.1",8889,0,0,path, NULL,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),NULL,FALSE); @@ -446,14 +448,15 @@ static GtkWidget *create_end_page(void){ static void prepare(GtkAssistant *w){ AudioStream *audio_stream = NULL; LinphoneCore *lc=linphone_gtk_get_core(); + MSFactory *factory = linphone_core_get_factory((void*)lc); int page = gtk_assistant_get_current_page(w); GtkWidget *mic_audiolevel = get_widget_from_assistant("mic_audiolevel"); GtkWidget *label_audiolevel = get_widget_from_assistant("label_audiolevel"); //Speaker page if(page == 1){ - MSSndCardManager *manager = ms_snd_card_manager_get(); - audio_stream = audio_stream_start_with_sndcards(&av_profile,9898,"127.0.0.1",19898,0,0,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE, lc->factory); + MSSndCardManager *manager = ms_snd_card_manager_get(factory); + audio_stream = audio_stream_start_with_sndcards(&av_profile,9898,"127.0.0.1",19898,0,0,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE, factory); if (mic_audiolevel != NULL && audio_stream != NULL){ g_object_set_data(G_OBJECT(audio_assistant),"stream",audio_stream); linphone_gtk_init_audio_meter(mic_audiolevel,(get_volume_t)audio_stream_get_record_volume,audio_stream); diff --git a/gtk/propertybox.c b/gtk/propertybox.c index 974542075..fa2898e3d 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1417,8 +1417,9 @@ void linphone_gtk_fill_webcams(GtkWidget *pb){ void linphone_gtk_fill_video_renderers(GtkWidget *pb){ #ifdef VIDEO_ENABLED /* video_stream_get_default_video_renderer requires video enabled */ LinphoneCore *lc=linphone_gtk_get_core(); + MSFactory *factory = linphone_core_get_factory((void*)lc); GtkWidget *combo=linphone_gtk_get_widget(pb,"renderers"); - MSList *l=ms_filter_lookup_by_interface(MSFilterVideoDisplayInterface); + MSList *l=ms_factory_lookup_filter_by_interface(factory, MSFilterVideoDisplayInterface); MSList *elem; int i; int active=-1; diff --git a/tester/player_tester.c b/tester/player_tester.c index f5c0c3cb9..c14a62d44 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -44,8 +44,8 @@ static void play_file(const char *filename, bool_t supported_format, const char BC_ASSERT_PTR_NOT_NULL(lc_manager); if(lc_manager == NULL) return; - audio_codec_supported = (audio_mime && ms_factory_get_decoder(ms_factory_get_fallback(), audio_mime)); - video_codec_supported = (video_mime && ms_factory_get_decoder(ms_factory_get_fallback(), video_mime)); + audio_codec_supported = (audio_mime && ms_factory_get_decoder(linphone_core_get_factory((void *)lc_manager->lc), audio_mime)); + video_codec_supported = (video_mime && ms_factory_get_decoder(linphone_core_get_factory((void *)lc_manager->lc), video_mime)); player = linphone_core_create_local_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), video_stream_get_default_video_renderer(), 0); BC_ASSERT_PTR_NOT_NULL(player); From b8468a56a1a9d73c8556f0f020380898d40ba9fd Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 21 Jan 2016 13:20:19 +0100 Subject: [PATCH 10/56] Attempt on fixing ring stream. --- coreapi/linphonecore.c | 4 ++-- coreapi/player.c | 4 ++-- coreapi/ringtoneplayer.c | 9 +++++---- coreapi/ringtoneplayer.h | 5 +++-- mediastreamer2 | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e2183e45a..6d2922d37 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3277,7 +3277,7 @@ void linphone_core_notify_incoming_call(LinphoneCore *lc, LinphoneCall *call){ if (lc->ringstream && lc->dmfs_playing_start_time!=0){ linphone_core_stop_dtmf_stream(lc); } - linphone_ringtoneplayer_start(lc->ringtoneplayer, ringcard, lc->sound_conf.local_ring, 2000); + linphone_ringtoneplayer_start(lc->factory, lc->ringtoneplayer, ringcard, lc->sound_conf.local_ring, 2000); }else{ /* else play a tone within the context of the current call */ call->ringing_beep=TRUE; @@ -4779,7 +4779,7 @@ int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCb } lc_callback_obj_init(&lc->preview_finished_cb,end_of_ringtone,userdata); lc->preview_finished=0; - err = linphone_ringtoneplayer_start_with_cb(lc->ringtoneplayer, ringcard, ring, -1, notify_end_of_ringtone,(void *)lc); + err = linphone_ringtoneplayer_start_with_cb(lc->factory, lc->ringtoneplayer, ringcard, ring, -1, notify_end_of_ringtone,(void *)lc); if (err) { lc->preview_finished=1; } diff --git a/coreapi/player.c b/coreapi/player.c index 668b91c01..c0506dfa1 100644 --- a/coreapi/player.c +++ b/coreapi/player.c @@ -31,7 +31,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback cb, void *user_data){ obj->user_data=user_data; obj->cb=cb; - return obj->open(obj,filename); + return obj->open(obj,filename, NULL); } /** @@ -137,7 +137,7 @@ static void on_eof(void *user_data, MSFilter *f, unsigned int event_id, void *ar if (player->cb) player->cb(player,player->user_data); } -static int call_player_open(LinphonePlayer* player, const char *filename){ +static int call_player_open(LinphonePlayer* player, const char *filename, MSFactory *factory){ LinphoneCall *call=(LinphoneCall*)player->impl; MSFilter *filter; if (!call_player_check_state(player,FALSE)) return -1; diff --git a/coreapi/ringtoneplayer.c b/coreapi/ringtoneplayer.c index fe63c451e..d628c45fd 100644 --- a/coreapi/ringtoneplayer.c +++ b/coreapi/ringtoneplayer.c @@ -19,9 +19,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "private.h" +#include -int linphone_ringtoneplayer_start(LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms) { - return linphone_ringtoneplayer_start_with_cb(rp, card, ringtone, loop_pause_ms, NULL, NULL); +int linphone_ringtoneplayer_start(MSFactory *factory, LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms) { + return linphone_ringtoneplayer_start_with_cb(factory, rp, card, ringtone, loop_pause_ms, NULL, NULL); } #ifdef __ios @@ -76,7 +77,7 @@ static void notify_end_of_ringtone(void *ud, MSFilter *f, unsigned int event, vo } } -int linphone_ringtoneplayer_start_with_cb(LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms, LinphoneRingtonePlayerFunc end_of_ringtone, void * user_data) { +int linphone_ringtoneplayer_start_with_cb(MSFactory *factory, LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms, LinphoneRingtonePlayerFunc end_of_ringtone, void * user_data) { if (linphone_ringtoneplayer_is_started(rp)) { ms_message("the local ringtone is already started"); return 2; @@ -85,7 +86,7 @@ int linphone_ringtoneplayer_start_with_cb(LinphoneRingtonePlayer* rp, MSSndCard* ms_message("Starting local ringtone..."); rp->end_of_ringtone = end_of_ringtone; rp->end_of_ringtone_ud = user_data; - rp->ringstream=ring_start_with_cb(ringtone,loop_pause_ms,card,notify_end_of_ringtone,rp,linphone_core_get_factory(user_data)); + rp->ringstream=ring_start_with_cb(factory, ringtone,loop_pause_ms,card,notify_end_of_ringtone,rp); return rp->ringstream != NULL ? 0 : 1; } return 3; diff --git a/coreapi/ringtoneplayer.h b/coreapi/ringtoneplayer.h index 21afc7109..b632b1f55 100644 --- a/coreapi/ringtoneplayer.h +++ b/coreapi/ringtoneplayer.h @@ -24,7 +24,7 @@ typedef void (*LinphoneRingtonePlayerFunc)(LinphoneRingtonePlayer* rp, void* use LINPHONE_PUBLIC LinphoneRingtonePlayer* linphone_ringtoneplayer_new(void); LINPHONE_PUBLIC void linphone_ringtoneplayer_destroy(LinphoneRingtonePlayer* rp); -LINPHONE_PUBLIC int linphone_ringtoneplayer_start(LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms); +LINPHONE_PUBLIC int linphone_ringtoneplayer_start(MSFactory *factory, LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms); /** * Start a ringtone player * @param rp LinphoneRingtonePlayer object @@ -33,7 +33,8 @@ LINPHONE_PUBLIC int linphone_ringtoneplayer_start(LinphoneRingtonePlayer* rp, MS * @param loop_pause_ms pause interval in milliseconds to be observed between end of play and resuming at start. A value of -1 disables loop mode * @return 0 if the player successfully started, positive error code otherwise */ -LINPHONE_PUBLIC int linphone_ringtoneplayer_start_with_cb(LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms, LinphoneRingtonePlayerFunc end_of_ringtone, void * user_data); +LINPHONE_PUBLIC int linphone_ringtoneplayer_start_with_cb(MSFactory *factory, LinphoneRingtonePlayer* rp, MSSndCard* card, + const char* ringtone, int loop_pause_ms, LinphoneRingtonePlayerFunc end_of_ringtone, void * user_data); LINPHONE_PUBLIC bool_t linphone_ringtoneplayer_is_started(LinphoneRingtonePlayer* rp); LINPHONE_PUBLIC int linphone_ringtoneplayer_stop(LinphoneRingtonePlayer* rp); diff --git a/mediastreamer2 b/mediastreamer2 index 22bc24eaf..a93ad5074 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 22bc24eaf3d6ac3617c37cd1948aae20fa0050d4 +Subproject commit a93ad507480abdc363f4c3a9d4c2dacf90ce8028 From d961cb08c5888610cefd8a5f178e72a7e832b451 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 21 Jan 2016 14:55:37 +0100 Subject: [PATCH 11/56] Fixing bug in ms_factory_voip_init. --- coreapi/linphonecore.c | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 6d2922d37..b0eca26a8 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -6437,7 +6437,7 @@ static void linphone_core_uninit(LinphoneCore *lc) if (lc->supported_formats) ms_free(lc->supported_formats); linphone_core_message_storage_close(lc); linphone_core_call_log_storage_close(lc); - //ms_exit(); + ms_factory_uninit_voip(lc->factory); ms_factory_uninit_plugins(lc->factory); ms_factory_destroy(lc->factory); diff --git a/mediastreamer2 b/mediastreamer2 index a93ad5074..816450630 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a93ad507480abdc363f4c3a9d4c2dacf90ce8028 +Subproject commit 816450630d8c9fdc7e2591f43d47c6807d3fff16 From db7eb9704427a35f55326ea23c0b19aef69fe0a0 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 21 Jan 2016 16:49:00 +0100 Subject: [PATCH 12/56] Updating mediastreamer2. Fixing too many parameters error in audio_assistant. Now linphone-gtk is launching and lilblinphone-tester Single call suite is ok. --- gtk/audio_assistant.c | 6 +++--- mediastreamer2 | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gtk/audio_assistant.c b/gtk/audio_assistant.c index e8599f286..b972a08ec 100644 --- a/gtk/audio_assistant.c +++ b/gtk/audio_assistant.c @@ -213,7 +213,7 @@ void linphone_gtk_start_record_sound(GtkWidget *w, gpointer data){ LinphoneCore *lc = linphone_gtk_get_core(); MSFactory *factory = linphone_core_get_factory((void*)lc); AudioStream *stream = NULL; - MSSndCardManager *manager = ms_snd_card_manager_get(factory); + MSSndCardManager *manager = ms_snd_card_manager_get(); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); gint timeout_id; @@ -259,7 +259,7 @@ void linphone_gtk_start_play_record_sound(GtkWidget *w,gpointer data){ MSFactory *factory = linphone_core_get_factory((void*)lc); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); AudioStream *stream = NULL; - MSSndCardManager *manager = ms_snd_card_manager_get(factory); + MSSndCardManager *manager = ms_snd_card_manager_get(); if(active){ gchar *path = g_object_get_data(G_OBJECT(audio_assistant),"path"); @@ -455,7 +455,7 @@ static void prepare(GtkAssistant *w){ //Speaker page if(page == 1){ - MSSndCardManager *manager = ms_snd_card_manager_get(factory); + MSSndCardManager *manager = ms_snd_card_manager_get(); audio_stream = audio_stream_start_with_sndcards(&av_profile,9898,"127.0.0.1",19898,0,0,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE, factory); if (mic_audiolevel != NULL && audio_stream != NULL){ g_object_set_data(G_OBJECT(audio_assistant),"stream",audio_stream); diff --git a/mediastreamer2 b/mediastreamer2 index 816450630..2acfebd90 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 816450630d8c9fdc7e2591f43d47c6807d3fff16 +Subproject commit 2acfebd906a410425f73c38874ebc8fc718668d0 From 29f51d8d279a44b0e484c9d2f8d89f5771c88df5 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 22 Jan 2016 14:14:39 +0100 Subject: [PATCH 13/56] linphone_player_open prototype change: adding MSFactory * as parameter. --- coreapi/linphonecore.h | 2 +- coreapi/player.c | 4 ++-- gtk/videowindow.c | 2 +- tester/call_tester.c | 8 ++++---- tester/player_tester.c | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 36da70623..592ef536e 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -627,7 +627,7 @@ typedef struct _LinphonePlayer LinphonePlayer; **/ typedef void (*LinphonePlayerEofCallback)(struct _LinphonePlayer *obj, void *user_data); -LINPHONE_PUBLIC int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data); +LINPHONE_PUBLIC int linphone_player_open(MSFactory* f, LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data); LINPHONE_PUBLIC int linphone_player_start(LinphonePlayer *obj); LINPHONE_PUBLIC int linphone_player_pause(LinphonePlayer *obj); LINPHONE_PUBLIC int linphone_player_seek(LinphonePlayer *obj, int time_ms); diff --git a/coreapi/player.c b/coreapi/player.c index c0506dfa1..8c9913ab6 100644 --- a/coreapi/player.c +++ b/coreapi/player.c @@ -28,10 +28,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * @param user_data a user-data provided in the callback to help the application to retrieve its context. * @return 0 if successful, -1 otherwise **/ -int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback cb, void *user_data){ +int linphone_player_open(MSFactory *f, LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback cb, void *user_data){ obj->user_data=user_data; obj->cb=cb; - return obj->open(obj,filename, NULL); + return obj->open(obj,filename, f); } /** diff --git a/gtk/videowindow.c b/gtk/videowindow.c index c4a10d970..46375f9bc 100644 --- a/gtk/videowindow.c +++ b/gtk/videowindow.c @@ -58,7 +58,7 @@ static void drag_data_received(GtkWidget *widget, GdkDragContext *context, gint const char *path=(const char*)data; if (player){ if (strstr(path,"file://")==path) path+=strlen("file://"); - if (linphone_player_open(player,path,on_end_of_play,NULL)==0){ + if (linphone_player_open(linphone_core_get_factory((void*)linphone_call_get_core(call)),player,path,on_end_of_play,NULL)==0){ linphone_player_start(player); }else{ GtkWidget *warn=gtk_message_dialog_new(GTK_WINDOW(widget),GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, diff --git a/tester/call_tester.c b/tester/call_tester.c index 2b3d7a974..4bc136606 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -2918,7 +2918,7 @@ static void call_with_file_player(void) { player=linphone_call_get_player(linphone_core_get_current_call(marie->lc)); BC_ASSERT_PTR_NOT_NULL(player); if (player){ - BC_ASSERT_EQUAL(linphone_player_open(player,hellopath,on_eof,marie),0, int, "%d"); + BC_ASSERT_EQUAL(linphone_player_open(marie->lc->factory, player,hellopath,on_eof,marie),0, int, "%d"); BC_ASSERT_EQUAL(linphone_player_start(player),0, int, "%d"); } /* This assert should be modified to be at least as long as the WAV file */ @@ -2984,7 +2984,7 @@ static void call_with_mkv_file_player(void) { player=linphone_call_get_player(linphone_core_get_current_call(marie->lc)); BC_ASSERT_PTR_NOT_NULL(player); if (player){ - int res = linphone_player_open(player,hellomkv,on_eof,marie); + int res = linphone_player_open(marie->lc->factory, player,hellomkv,on_eof,marie); //if(!ms_filter_codec_supported("opus")) { if(!ms_factory_codec_supported(marie->lc->factory, "opus") && !ms_factory_codec_supported(pauline->lc->factory, "opus")){ BC_ASSERT_EQUAL(res, -1, int, "%d"); @@ -5048,7 +5048,7 @@ static void call_with_rtp_io_mode(void) { player = linphone_call_get_player(linphone_core_get_current_call(marie->lc)); BC_ASSERT_PTR_NOT_NULL(player); if (player) { - BC_ASSERT_EQUAL(linphone_player_open(player, hellopath, on_eof, marie) , 0, int, "%d"); + BC_ASSERT_EQUAL(linphone_player_open(marie->lc->factory, player, hellopath, on_eof, marie) , 0, int, "%d"); BC_ASSERT_EQUAL(linphone_player_start(player) , 0, int, "%d"); } @@ -5340,7 +5340,7 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) { BC_ASSERT_PTR_NOT_NULL(player); if (player) { // This will ask pauline to play the file - BC_ASSERT_EQUAL(linphone_player_open(player, hellopath, on_eof, pauline),0, int, "%d"); + BC_ASSERT_EQUAL(linphone_player_open(marie->lc->factory,player, hellopath, on_eof, pauline),0, int, "%d"); BC_ASSERT_EQUAL(linphone_player_start(player), 0, int, "%d"); } /* This assert should be modified to be at least as long as the WAV file */ diff --git a/tester/player_tester.c b/tester/player_tester.c index c14a62d44..cd66d3ab4 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -51,7 +51,7 @@ static void play_file(const char *filename, bool_t supported_format, const char BC_ASSERT_PTR_NOT_NULL(player); if(player == NULL) goto fail; - res = linphone_player_open(player, filename, eof_callback, &eof); + res = linphone_player_open(linphone_core_get_factory((void*)lc_manager->lc), player, filename, eof_callback, &eof); if(supported_format && (audio_codec_supported || video_codec_supported)) { BC_ASSERT_EQUAL(res, 0, int, "%d"); } else { From 6ec93e6de1aa252e9d98bf446acf097b35b95e3b Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 22 Jan 2016 16:15:30 +0100 Subject: [PATCH 14/56] Updating mediastreamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1cacae1df..90c2aed31 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1cacae1df5e9c7788a21c7158aa40337c10753ee +Subproject commit 90c2aed3156833e449bc87a813a863b2a5df4ff1 From 8cbdee4db045d170baaa4aa4721a97d3a80510eb Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 25 Jan 2016 16:41:57 +0100 Subject: [PATCH 15/56] Updating mediastreamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 90c2aed31..006d694fa 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 90c2aed3156833e449bc87a813a863b2a5df4ff1 +Subproject commit 006d694facbd7b938b5fcb78575d1813d430a0cf From e5a09abcba43f830b7d0fa1c962d562d368ffc8a Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 26 Jan 2016 12:06:56 +0100 Subject: [PATCH 16/56] Updating mediastreamer2 and oRTP. Removing ms_factory_uninit_plugins which is already called in ms_factory_destroy. --- coreapi/linphonecore.c | 1 - mediastreamer2 | 2 +- oRTP | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 18ad80603..2168940cb 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -6441,7 +6441,6 @@ static void linphone_core_uninit(LinphoneCore *lc) linphone_core_call_log_storage_close(lc); ms_factory_uninit_voip(lc->factory); - ms_factory_uninit_plugins(lc->factory); ms_factory_destroy(lc->factory); // TODO : set to null diff --git a/mediastreamer2 b/mediastreamer2 index 006d694fa..2bbda9629 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 006d694facbd7b938b5fcb78575d1813d430a0cf +Subproject commit 2bbda96299bf3263cb59c7c423ddc1e763135670 diff --git a/oRTP b/oRTP index 02ce979cf..83bf0a09c 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 02ce979cfdf80b68f1d13e1d0185bf2b827f4b7e +Subproject commit 83bf0a09cc2127086e15817d16793320c9fb9af0 From 2dc9e19ccb9b008f0ff60914ab77d17b2e71b777 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 27 Jan 2016 10:20:33 +0100 Subject: [PATCH 17/56] Updating media streamer and linphonecore.c to be consistent with the changes made in media streamer. --- coreapi/linphonecore.c | 26 +++++++++++++------------- mediastreamer2 | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 2168940cb..55361ead9 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -779,7 +779,7 @@ static void build_sound_devices_table(LinphoneCore *lc){ const char **old; int ndev; int i; - const MSList *elem=ms_snd_card_manager_get_list(ms_snd_card_manager_get()); + const MSList *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_manager(lc->factory)); ndev=ms_list_size(elem); devices=ms_malloc((ndev+1)*sizeof(const char *)); for (i=0;elem!=NULL;elem=elem->next,i++){ @@ -4454,10 +4454,10 @@ void linphone_core_set_rec_level(LinphoneCore *lc, int level) if (sndcard) ms_snd_card_set_level(sndcard,MS_SND_CARD_CAPTURE,level); } -static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap){ +static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap, MSFactory *f){ MSSndCard *sndcard=NULL; if (devid!=NULL){ - sndcard=ms_snd_card_manager_get_card(ms_snd_card_manager_get(),devid); + sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_manager(f),devid); if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & cap)==0 ){ ms_warning("%s card does not have the %s capability, ignoring.", @@ -4468,15 +4468,15 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap){ } if (sndcard==NULL) { if ((cap & MS_SND_CARD_CAP_CAPTURE) && (cap & MS_SND_CARD_CAP_PLAYBACK)){ - sndcard=ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()); + sndcard=ms_snd_card_manager_get_default_card(ms_factory_get_snd_manager(f)); }else if (cap & MS_SND_CARD_CAP_CAPTURE){ - sndcard=ms_snd_card_manager_get_default_capture_card(ms_snd_card_manager_get()); + sndcard=ms_snd_card_manager_get_default_capture_card(ms_factory_get_snd_manager(f)); } else if (cap & MS_SND_CARD_CAP_PLAYBACK){ - sndcard=ms_snd_card_manager_get_default_playback_card(ms_snd_card_manager_get()); + sndcard=ms_snd_card_manager_get_default_playback_card(ms_factory_get_snd_manager(f)); } if (sndcard==NULL){/*looks like a bug! take the first one !*/ - const MSList *elem=ms_snd_card_manager_get_list(ms_snd_card_manager_get()); + const MSList *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_manager(f)); if (elem) sndcard=(MSSndCard*)elem->data; } } @@ -4493,7 +4493,7 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap){ **/ bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *devid){ MSSndCard *sndcard; - sndcard=ms_snd_card_manager_get_card(ms_snd_card_manager_get(),devid); + sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_manager(lc->factory),devid); if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_CAPTURE)) return TRUE; return FALSE; } @@ -4507,7 +4507,7 @@ bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *devi **/ bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *devid){ MSSndCard *sndcard; - sndcard=ms_snd_card_manager_get_card(ms_snd_card_manager_get(),devid); + sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_manager(lc->factory),devid); if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_PLAYBACK)) return TRUE; return FALSE; } @@ -4520,7 +4520,7 @@ bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *dev * @param devid the device name as returned by linphone_core_get_sound_devices() **/ int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid){ - MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK); + MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK, lc->factory); lc->sound_conf.ring_sndcard=card; if (card && linphone_core_ready(lc)) lp_config_set_string(lc->config,"sound","ringer_dev_id",ms_snd_card_get_string_id(card)); @@ -4535,7 +4535,7 @@ int linphone_core_set_ringer_device(LinphoneCore *lc, const char * devid){ * @param devid the device name as returned by linphone_core_get_sound_devices() **/ int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid){ - MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK); + MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_PLAYBACK, lc->factory); lc->sound_conf.play_sndcard=card; if (card && linphone_core_ready(lc)) lp_config_set_string(lc->config,"sound","playback_dev_id",ms_snd_card_get_string_id(card)); @@ -4550,7 +4550,7 @@ int linphone_core_set_playback_device(LinphoneCore *lc, const char * devid){ * @param devid the device name as returned by linphone_core_get_sound_devices() **/ int linphone_core_set_capture_device(LinphoneCore *lc, const char * devid){ - MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_CAPTURE); + MSSndCard *card=get_card_from_string_id(devid,MS_SND_CARD_CAP_CAPTURE, lc->factory); lc->sound_conf.capt_sndcard=card; if (card && linphone_core_ready(lc)) lp_config_set_string(lc->config,"sound","capture_dev_id",ms_snd_card_get_string_id(card)); @@ -4633,7 +4633,7 @@ void linphone_core_reload_sound_devices(LinphoneCore *lc){ if (capture != NULL) { capture_copy = ms_strdup(capture); } - ms_snd_card_manager_reload(ms_snd_card_manager_get()); + ms_snd_card_manager_reload(ms_factory_get_snd_manager(lc->factory)); build_sound_devices_table(lc); if (ringer_copy != NULL) { linphone_core_set_ringer_device(lc, ringer_copy); diff --git a/mediastreamer2 b/mediastreamer2 index 2bbda9629..4f39d6a45 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2bbda96299bf3263cb59c7c423ddc1e763135670 +Subproject commit 4f39d6a4536fdfe678fe043e68a4921cf186e20f From 9b806bc2c3c789869dd986b6cadd4351111a3f1c Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 27 Jan 2016 11:15:24 +0100 Subject: [PATCH 18/56] Update lddc.c (first steps on replacing ms_filter_new ). Updating mediastreamer2 : use of ms_factory_exit to destroy the factory and set it to NULL, in linphonecore.c as well. --- coreapi/linphonecall.c | 70 ++++++++++++------------------------------ coreapi/linphonecore.c | 7 ++--- coreapi/lsd.c | 6 ++-- mediastreamer2 | 2 +- 4 files changed, 28 insertions(+), 57 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index a8a9e5bdf..94cf6d473 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -932,7 +932,6 @@ static void port_config_set(LinphoneCall *call, int stream_index, int min_port, static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){ int min_port, max_port; ms_message("New LinphoneCall [%p] initialized (LinphoneCore version: %s)",call,linphone_core_get_version()); - call->core->send_call_stats_periodical_updates = lp_config_get_int(call->core->config, "misc", "send_call_stats_periodical_updates", 0); call->main_audio_stream_index = LINPHONE_CALL_STATS_AUDIO; call->main_video_stream_index = LINPHONE_CALL_STATS_VIDEO; call->main_text_stream_index = LINPHONE_CALL_STATS_TEXT; @@ -2237,7 +2236,7 @@ int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer){ if (call->params->realtimetext_enabled) _linphone_call_prepare_ice_for_stream(call,call->main_text_stream_index,TRUE); /*start ICE gathering*/ if (incoming_offer) - linphone_call_update_ice_from_remote_media_description(call, remote, TRUE); /*this may delete the ice session*/ + linphone_call_update_ice_from_remote_media_description(call,remote); /*this may delete the ice session*/ if (call->ice_session && !ice_session_candidates_gathered(call->ice_session)){ if (call->audiostream->ms.state==MSStreamInitialized) audio_stream_prepare_sound(call->audiostream, NULL, NULL); @@ -4170,22 +4169,20 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_download_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_down_bw(ts)*1e-3) : 0.f; call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_upload_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_up_bw(ts)*1e-3) : 0.f; - if (call->core->send_call_stats_periodical_updates){ - call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; - if (as_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); + call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; + if (as) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); - call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; - if (vs_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); + call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; + if (vs) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); - call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); - call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; - if (ts_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); - } + call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); + call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; + if (ts) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); ms_message( "Bandwidth usage for call [%p]:\n" @@ -4316,7 +4313,8 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_update_ice_state_in_call_stats(call); } } else if (evt == ORTP_EVENT_ICE_RESTART_NEEDED) { - ice_session_restart(call->ice_session, IR_Controlling); + ice_session_restart(call->ice_session, IR_Controlling); + ice_session_set_role(call->ice_session, IR_Controlling); linphone_core_update_call(call->core, call, call->current_params); } } @@ -4375,28 +4373,6 @@ void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){ } } -static MediaStream * linphone_call_get_media_stream(LinphoneCall *call, int stream_index){ - if (stream_index == call->main_audio_stream_index) - return (MediaStream*)call->audiostream; - if (stream_index == call->main_video_stream_index) - return (MediaStream*)call->videostream; - if (stream_index == call->main_text_stream_index) - return (MediaStream*)call->textstream; - ms_error("linphone_call_get_media_stream(): no stream index %i", stream_index); - return NULL; -} - -static OrtpEvQueue *linphone_call_get_event_queue(LinphoneCall *call, int stream_index){ - if (stream_index == call->main_audio_stream_index) - return call->audiostream_app_evq; - if (stream_index == call->main_video_stream_index) - return call->videostream_app_evq; - if (stream_index == call->main_text_stream_index) - return call->textstream_app_evq; - ms_error("linphone_call_get_event_queue(): no stream index %i", stream_index); - return NULL; -} - void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){ MediaStream *ms = stream_index == call->main_audio_stream_index ? (MediaStream *)call->audiostream : (stream_index == call->main_video_stream_index ? (MediaStream *)call->videostream : (MediaStream *)call->textstream); OrtpEvQueue *evq; @@ -4425,15 +4401,11 @@ void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){ } } /*yes the event queue has to be taken at each iteration, because ice events may perform operations re-creating the streams*/ - while((evq = linphone_call_get_event_queue(call, stream_index)) != NULL && NULL != (ev=ortp_ev_queue_get(evq))){ + while ((evq = stream_index == call->main_audio_stream_index ? call->audiostream_app_evq : (stream_index == call->main_video_stream_index ? call->videostream_app_evq : call->textstream_app_evq)) && (NULL != (ev=ortp_ev_queue_get(evq)))){ OrtpEventType evt=ortp_event_get_type(ev); OrtpEventData *evd=ortp_event_get_data(ev); + int stats_index = stream_index == call->main_audio_stream_index ? LINPHONE_CALL_STATS_AUDIO : (stream_index == call->main_video_stream_index ? LINPHONE_CALL_STATS_VIDEO : LINPHONE_CALL_STATS_TEXT); - - /*and yes the MediaStream must be taken at each iteration, because it may have changed due to the handling of events - * in this loop*/ - ms = linphone_call_get_media_stream(call, stream_index); - if (ms) linphone_call_stats_fill(&call->stats[stats_index],ms,ev); linphone_call_notify_stats_updated(call,stats_index); @@ -4818,10 +4790,8 @@ MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index) return MSVideo; } else if (stream_index == call->main_text_stream_index) { return MSText; - } else if (stream_index == call->main_audio_stream_index){ - return MSAudio; } - return MSUnknownMedia; + return MSAudio; } RtpTransport* linphone_call_get_meta_rtp_transport(LinphoneCall *call, int stream_index) { @@ -4880,7 +4850,6 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ /*First, make sure that the proxy from which we received this call, or to which we routed this call is registered*/ if (!call->dest_proxy || linphone_proxy_config_get_state(call->dest_proxy) != LinphoneRegistrationOk) return; - if (!call->core->media_network_reachable) return; switch (call->state){ case LinphoneCallStreamsRunning: @@ -4888,7 +4857,8 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ case LinphoneCallPausedByRemote: ms_message("LinphoneCall[%p] is going to be updated (reINVITE) in order to recover from lost connectivity", call); if (call->ice_session){ - ice_session_restart(call->ice_session, IR_Controlling); + ice_session_restart(call->ice_session, IR_Controlling); + ice_session_set_role(call->ice_session, IR_Controlling); } params = linphone_core_create_call_params(call->core, call); linphone_core_update_call(call->core, call, params); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3a76389bb..81acd9311 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -6440,10 +6440,9 @@ static void linphone_core_uninit(LinphoneCore *lc) linphone_core_message_storage_close(lc); linphone_core_call_log_storage_close(lc); - ms_factory_uninit_voip(lc->factory); - ms_factory_destroy(lc->factory); -// TODO : set to null - + lc->factory = ms_factory_exit(lc->factory); + + linphone_core_set_state(lc,LinphoneGlobalOff,"Off"); linphone_core_deactivate_log_serialization_if_needed(); ms_list_free_with_data(lc->vtable_refs,(void (*)(void *))v_table_reference_destroy); diff --git a/coreapi/lsd.c b/coreapi/lsd.c index 6aa803a06..9eb839e23 100644 --- a/coreapi/lsd.c +++ b/coreapi/lsd.c @@ -61,7 +61,8 @@ struct _LinphoneSoundDaemon { static MSFilter *create_writer(MSSndCard *c){ LinphoneSoundDaemon *lsd=(LinphoneSoundDaemon*)c->data; - MSFilter *itcsink=ms_filter_new(MS_ITC_SINK_ID); +// MSFilter *itcsink=ms_filter_new(MS_ITC_SINK_ID); + MSFilter *itcsink=ms_factory_create_filter(ms_snd_card_factory_get(c), MS_ITC_SINK_ID); ms_filter_call_method(itcsink,MS_ITC_SINK_CONNECT,lsd->branches[0].player); return itcsink; } @@ -237,7 +238,8 @@ LinphoneSoundDaemon * linphone_sound_daemon_new(const char *cardname, int rate, lsd=ms_new0(LinphoneSoundDaemon,1); lsd->soundout=ms_snd_card_create_writer(card); - lsd->mixer=ms_filter_new(MS_AUDIO_MIXER_ID); +// lsd->mixer=ms_filter_new(MS_AUDIO_MIXER_ID); + lsd->mixer=ms_factory_create_filter(ms_snd_card_factory_get(card),MS_AUDIO_MIXER_ID); lsd->out_rate=rate; lsd->out_nchans=nchannels; ms_filter_call_method(lsd->soundout,MS_FILTER_SET_SAMPLE_RATE,&lsd->out_rate); diff --git a/mediastreamer2 b/mediastreamer2 index 4f39d6a45..c8a2aec22 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 4f39d6a4536fdfe678fe043e68a4921cf186e20f +Subproject commit c8a2aec22f201d37b0e83d6d4a0cb0f57ef38cdf From bad9aecc65a4dad78926b9bd42ca1b79c4edf167 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 27 Jan 2016 11:58:07 +0100 Subject: [PATCH 19/56] Update of linphone sound daemon to use MSFactory. --- coreapi/linphonecore_utils.h | 2 +- coreapi/lsd.c | 15 +++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/coreapi/linphonecore_utils.h b/coreapi/linphonecore_utils.h index 04069e504..9350a179d 100644 --- a/coreapi/linphonecore_utils.h +++ b/coreapi/linphonecore_utils.h @@ -44,7 +44,7 @@ bool_t lsd_player_loop_enabled(const LsdPlayer *p); void lsd_player_set_gain(LsdPlayer *p, float gain); LinphoneSoundDaemon *lsd_player_get_daemon(const LsdPlayer *p); -LinphoneSoundDaemon * linphone_sound_daemon_new(const char *cardname, int rate, int nchannels); +LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char *cardname, int rate, int nchannels); LsdPlayer * linphone_sound_daemon_get_player(LinphoneSoundDaemon *lsd); void linphone_sound_daemon_release_player(LinphoneSoundDaemon *lsd, LsdPlayer *lsdplayer); void linphone_sound_daemon_stop_all_players(LinphoneSoundDaemon *obj); diff --git a/coreapi/lsd.c b/coreapi/lsd.c index 9eb839e23..66abf89db 100644 --- a/coreapi/lsd.c +++ b/coreapi/lsd.c @@ -115,11 +115,11 @@ int lsd_player_stop(LsdPlayer *p){ return 0; } -static void lsd_player_init(LsdPlayer *p, MSConnectionPoint mixer, MSFilterId playerid, LinphoneSoundDaemon *lsd){ +static void lsd_player_init(MSFactory* factory, LsdPlayer *p, MSConnectionPoint mixer, MSFilterId playerid, LinphoneSoundDaemon *lsd){ MSConnectionHelper h; - p->player=ms_filter_new(playerid); - p->rateconv=ms_filter_new(MS_RESAMPLE_ID); - p->chanadapter=ms_filter_new(MS_CHANNEL_ADAPTER_ID); + p->player=ms_factory_create_filter(factory, playerid); + p->rateconv=ms_factory_create_filter(factory,MS_RESAMPLE_ID); + p->chanadapter=ms_factory_create_filter(factory,MS_CHANNEL_ADAPTER_ID); ms_connection_helper_start(&h); ms_connection_helper_link(&h,p->player,-1,0); @@ -220,16 +220,15 @@ void lsd_player_set_gain(LsdPlayer *p, float gain){ ms_filter_call_method(p->lsd->mixer,MS_AUDIO_MIXER_SET_INPUT_GAIN,&gainctl); } -LinphoneSoundDaemon * linphone_sound_daemon_new(const char *cardname, int rate, int nchannels){ +LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char *cardname, int rate, int nchannels){ int i; MSConnectionPoint mp; LinphoneSoundDaemon *lsd; - MSSndCard *card=ms_snd_card_manager_get_card( - ms_snd_card_manager_get(), + MSSndCard *card=ms_snd_card_manager_get_card(ms_factory_get_snd_manager(factory), cardname); if (card==NULL){ card=ms_snd_card_manager_get_default_playback_card ( - ms_snd_card_manager_get()); + ms_factory_get_snd_manager(factory)); if (card==NULL){ ms_error("linphone_sound_daemon_new(): No playback soundcard available"); return NULL; From 8177fddcd6c46c19a89684b2b322844a59d1eec9 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 27 Jan 2016 14:04:11 +0100 Subject: [PATCH 20/56] Small fixes and media streamer update. --- coreapi/lsd.c | 4 ++-- mediastreamer2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/lsd.c b/coreapi/lsd.c index 66abf89db..f3a324637 100644 --- a/coreapi/lsd.c +++ b/coreapi/lsd.c @@ -249,11 +249,11 @@ LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char * mp.filter=lsd->mixer; mp.pin=0; - lsd_player_init(&lsd->branches[0],mp,MS_ITC_SOURCE_ID,lsd); + lsd_player_init(factory, &lsd->branches[0],mp,MS_ITC_SOURCE_ID,lsd); ms_filter_add_notify_callback(lsd->branches[0].player,(MSFilterNotifyFunc)lsd_player_configure,&lsd->branches[0],FALSE); for(i=1;ibranches[i],mp,MS_FILE_PLAYER_ID,lsd); + lsd_player_init(factory,&lsd->branches[i],mp,MS_FILE_PLAYER_ID,lsd); } ms_filter_link(lsd->mixer,0,lsd->soundout,0); lsd->ticker=ms_ticker_new(); diff --git a/mediastreamer2 b/mediastreamer2 index c8a2aec22..00125cf3f 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c8a2aec22f201d37b0e83d6d4a0cb0f57ef38cdf +Subproject commit 00125cf3f29528da5c542733fcc006797c14d839 From f19cff21129db40fd9b24e304e22e461a3981ceb Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 28 Jan 2016 12:19:28 +0100 Subject: [PATCH 21/56] Updating media streamer and propagating changes. --- coreapi/linphonecore.c | 20 +++++++------------- coreapi/private.h | 2 +- gtk/audio_assistant.c | 6 +++--- mediastreamer2 | 2 +- tester/player_tester.c | 4 +++- tester/tester.c | 4 ++-- tools/auto_answer.c | 2 +- 7 files changed, 18 insertions(+), 22 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 81acd9311..dde230a29 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -824,13 +824,13 @@ static void sound_config_read(LinphoneCore *lc) char s=*i; *i='\0'; card=ms_alsa_card_new_custom(d+l,d+l); - ms_snd_card_manager_add_card(ms_snd_card_manager_get(),card); + ms_snd_card_manager_add_card(ms_factory_get_snd_manager(linphone_core_get_factory((void*)lc))),card); *i=s; l=i-d+1; } if(d[l]!='\0') { card=ms_alsa_card_new_custom(d+l,d+l); - ms_snd_card_manager_add_card(ms_snd_card_manager_get(),card); + ms_snd_card_manager_add_card(ms_factory_get_snd_manager(linphone_core_get_factory((void*)lc))),card); } free(d); } @@ -1295,7 +1295,7 @@ static void build_video_devices_table(LinphoneCore *lc){ if (lc->video_conf.cams) ms_free(lc->video_conf.cams); /* retrieve all video devices */ - elem=ms_web_cam_manager_get_list(ms_web_cam_manager_get()); + elem=ms_web_cam_manager_get_list(ms_factory_get_wbc_manager(lc->factory)); ndev=ms_list_size(elem); devices=ms_malloc((ndev+1)*sizeof(const char *)); for (i=0;elem!=NULL;elem=elem->next,i++){ @@ -1679,13 +1679,7 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab ortp_init(); linphone_core_activate_log_serialization_if_needed(); - if (lc->factory == NULL){ - lc->factory = ms_factory_new(); - } - - ms_factory_init_voip(lc->factory); - ms_factory_init_plugins(lc->factory); - + lc->factory = ms_factory_create(lc->factory); linphone_core_register_default_codecs(lc); linphone_core_register_offer_answer_providers(lc); /* Get the mediastreamer2 event queue */ @@ -4655,7 +4649,7 @@ void linphone_core_reload_video_devices(LinphoneCore *lc){ if (devid != NULL) { devid_copy = ms_strdup(devid); } - ms_web_cam_manager_reload(ms_web_cam_manager_get()); + ms_web_cam_manager_reload(ms_factory_get_wbc_manager(lc->factory)); build_video_devices_table(lc); if (devid_copy != NULL) { linphone_core_set_video_device(lc, devid_copy); @@ -5406,13 +5400,13 @@ int linphone_core_set_video_device(LinphoneCore *lc, const char *id){ MSWebCam *olddev=lc->video_conf.device; const char *vd; if (id!=NULL){ - lc->video_conf.device=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),id); + lc->video_conf.device=ms_web_cam_manager_get_cam(ms_factory_get_wbc_manager(lc->factory),id); if (lc->video_conf.device==NULL){ ms_warning("Could not find video device %s",id); } } if (lc->video_conf.device==NULL) - lc->video_conf.device=ms_web_cam_manager_get_default_cam(ms_web_cam_manager_get()); + lc->video_conf.device=ms_web_cam_manager_get_default_cam(ms_factory_get_wbc_manager(lc->factory)); if (olddev!=NULL && olddev!=lc->video_conf.device){ toggle_video_preview(lc,FALSE);/*restart the video local preview*/ } diff --git a/coreapi/private.h b/coreapi/private.h index 94aa96ac1..56ea85a41 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1429,7 +1429,7 @@ void _linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable, b #ifdef VIDEO_ENABLED LINPHONE_PUBLIC MSWebCam *linphone_call_get_video_device(const LinphoneCall *call); -MSWebCam *get_nowebcam_device(void); +MSWebCam *get_nowebcam_device(MSFactory *f); #endif bool_t linphone_core_lime_for_file_sharing_enabled(const LinphoneCore *lc); diff --git a/gtk/audio_assistant.c b/gtk/audio_assistant.c index b972a08ec..a3f765a27 100644 --- a/gtk/audio_assistant.c +++ b/gtk/audio_assistant.c @@ -213,7 +213,7 @@ void linphone_gtk_start_record_sound(GtkWidget *w, gpointer data){ LinphoneCore *lc = linphone_gtk_get_core(); MSFactory *factory = linphone_core_get_factory((void*)lc); AudioStream *stream = NULL; - MSSndCardManager *manager = ms_snd_card_manager_get(); + MSSndCardManager *manager = ms_factory_get_snd_manager(factory); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); gint timeout_id; @@ -259,7 +259,7 @@ void linphone_gtk_start_play_record_sound(GtkWidget *w,gpointer data){ MSFactory *factory = linphone_core_get_factory((void*)lc); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); AudioStream *stream = NULL; - MSSndCardManager *manager = ms_snd_card_manager_get(); + MSSndCardManager *manager = ms_factory_get_snd_manager(factory); if(active){ gchar *path = g_object_get_data(G_OBJECT(audio_assistant),"path"); @@ -455,7 +455,7 @@ static void prepare(GtkAssistant *w){ //Speaker page if(page == 1){ - MSSndCardManager *manager = ms_snd_card_manager_get(); + MSSndCardManager *manager = ms_factory_get_snd_manager(factory); audio_stream = audio_stream_start_with_sndcards(&av_profile,9898,"127.0.0.1",19898,0,0,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE, factory); if (mic_audiolevel != NULL && audio_stream != NULL){ g_object_set_data(G_OBJECT(audio_assistant),"stream",audio_stream); diff --git a/mediastreamer2 b/mediastreamer2 index 00125cf3f..2e8c945a1 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 00125cf3f29528da5c542733fcc006797c14d839 +Subproject commit 2e8c945a113865f7ec04a65990b2ef2bdfe97f06 diff --git a/tester/player_tester.c b/tester/player_tester.c index 4d630f293..1575531aa 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -47,7 +47,9 @@ static void play_file(const char *filename, bool_t supported_format, const char audio_codec_supported = (audio_mime && ms_factory_get_decoder(linphone_core_get_factory((void *)lc_manager->lc), audio_mime)); video_codec_supported = (video_mime && ms_factory_get_decoder(linphone_core_get_factory((void *)lc_manager->lc), video_mime)); - player = linphone_core_create_local_player(lc_manager->lc, ms_snd_card_manager_get_default_card(ms_snd_card_manager_get()), video_stream_get_default_video_renderer(), 0); + player = linphone_core_create_local_player(lc_manager->lc, + ms_snd_card_manager_get_default_card(ms_factory_get_snd_manager(linphone_core_get_factory((void *)lc_manager->lc))), + video_stream_get_default_video_renderer(), 0); BC_ASSERT_PTR_NOT_NULL(player); if(player == NULL) goto fail; diff --git a/tester/tester.c b/tester/tester.c index 2486450a5..bb689f5b1 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -302,13 +302,13 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { { MSWebCam *cam; - cam = ms_web_cam_manager_get_cam(ms_web_cam_manager_get(), "Mire: Mire (synthetic moving picture)"); + cam = ms_web_cam_manager_get_cam(ms_factory_get_wbc_manager(mgr->lc->factory), "Mire: Mire (synthetic moving picture)"); if (cam == NULL) { MSWebCamDesc *desc = ms_mire_webcam_desc_get(); if (desc){ cam=ms_web_cam_new(desc); - ms_web_cam_manager_add_cam(ms_web_cam_manager_get(), cam); + ms_web_cam_manager_add_cam(ms_factory_get_wbc_manager(mgr->lc->factory), cam); } } } diff --git a/tools/auto_answer.c b/tools/auto_answer.c index 8cedc9bc0..d39a70fd3 100644 --- a/tools/auto_answer.c +++ b/tools/auto_answer.c @@ -164,7 +164,7 @@ int main(int argc, char *argv[]){ { MSWebCamDesc *desc = ms_mire_webcam_desc_get(); if (desc){ - ms_web_cam_manager_add_cam(ms_web_cam_manager_get(),ms_web_cam_new(desc)); + ms_web_cam_manager_add_cam(ms_factory_get_wbc_manager(linphone_core_get_factory((void*)lc)),ms_web_cam_new(desc)); linphone_core_set_video_device(lc,"Mire: Mire (synthetic moving picture)"); } } From 86d2d9ffc3e7ba24083530bb781423c8abdec60c Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 28 Jan 2016 14:49:20 +0100 Subject: [PATCH 22/56] Update media streamer and small fix for webcam. --- coreapi/linphonecall.c | 4 ++-- mediastreamer2 | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 94cf6d473..57ff6e775 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -48,9 +48,9 @@ static void _linphone_call_set_next_video_frame_decoded_trigger(LinphoneCall *ca void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index); -MSWebCam *get_nowebcam_device(){ +MSWebCam *get_nowebcam_device(MSFactory* f){ #ifdef VIDEO_ENABLED - return ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"StaticImage: Static picture"); + return ms_web_cam_manager_get_cam(ms_factory_get_wbc_manager(f),"StaticImage: Static picture"); #else return NULL; #endif diff --git a/mediastreamer2 b/mediastreamer2 index b3b4e3248..9cd601595 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b3b4e324874c58cd09e72d735396983fd01687b9 +Subproject commit 9cd601595fbd43aecbbdb4cda4360e25db880e5c From 466437763d6061bc0a04926fb7d5b5fea83c7ebd Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 28 Jan 2016 14:56:43 +0100 Subject: [PATCH 23/56] small fix in linphone_call_get_video_device --- coreapi/linphonecall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 57ff6e775..572e7ecb1 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -4748,7 +4748,7 @@ MSWebCam *linphone_call_get_video_device(const LinphoneCall *call) { LinphoneCallState state = linphone_call_get_state(call); bool_t paused = (state == LinphoneCallPausing) || (state == LinphoneCallPaused); if (paused || call->all_muted || (call->camera_enabled == FALSE)) - return get_nowebcam_device(); + return get_nowebcam_device(call->core->factory); else return call->core->video_conf.device; } From 3abef135398545f1d898f7a446e00bd011d8016e Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 28 Jan 2016 16:18:36 +0100 Subject: [PATCH 24/56] Update media streamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 9cd601595..5e9a21c8d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 9cd601595fbd43aecbbdb4cda4360e25db880e5c +Subproject commit 5e9a21c8dae0ff2fe62b82977dbafa3f00ca744f From 9e71f27970fb9e1b335a155052f736361cd4bfdd Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 28 Jan 2016 16:46:30 +0100 Subject: [PATCH 25/56] Fixing merge mistake - reapplying commits 93f7cbd86ffd15ca45d7d26f3da1f2276a4a5ea3 cd3beba1c46a3e8b6bb33c762cdc062a2195aa8e --- coreapi/linphonecall.c | 70 ++++++++++++++++++++++++++++++------------ 1 file changed, 50 insertions(+), 20 deletions(-) diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 572e7ecb1..2386136d2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -932,6 +932,7 @@ static void port_config_set(LinphoneCall *call, int stream_index, int min_port, static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from, LinphoneAddress *to){ int min_port, max_port; ms_message("New LinphoneCall [%p] initialized (LinphoneCore version: %s)",call,linphone_core_get_version()); + call->core->send_call_stats_periodical_updates = lp_config_get_int(call->core->config, "misc", "send_call_stats_periodical_updates", 0); call->main_audio_stream_index = LINPHONE_CALL_STATS_AUDIO; call->main_video_stream_index = LINPHONE_CALL_STATS_VIDEO; call->main_text_stream_index = LINPHONE_CALL_STATS_TEXT; @@ -2236,7 +2237,7 @@ int linphone_call_prepare_ice(LinphoneCall *call, bool_t incoming_offer){ if (call->params->realtimetext_enabled) _linphone_call_prepare_ice_for_stream(call,call->main_text_stream_index,TRUE); /*start ICE gathering*/ if (incoming_offer) - linphone_call_update_ice_from_remote_media_description(call,remote); /*this may delete the ice session*/ + linphone_call_update_ice_from_remote_media_description(call, remote, TRUE); /*this may delete the ice session*/ if (call->ice_session && !ice_session_candidates_gathered(call->ice_session)){ if (call->audiostream->ms.state==MSStreamInitialized) audio_stream_prepare_sound(call->audiostream, NULL, NULL); @@ -4169,20 +4170,22 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_download_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_down_bw(ts)*1e-3) : 0.f; call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_upload_bandwidth=(ts_active) ? (float)(media_stream_get_rtcp_up_bw(ts)*1e-3) : 0.f; - call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); - call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; - if (as) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); + if (call->core->send_call_stats_periodical_updates){ + call->stats[LINPHONE_CALL_STATS_AUDIO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_AUDIO]); + call->stats[LINPHONE_CALL_STATS_AUDIO].updated=0; + if (as_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_AUDIO], as); - call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); - call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; - if (vs) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); + call->stats[LINPHONE_CALL_STATS_VIDEO].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_VIDEO]); + call->stats[LINPHONE_CALL_STATS_VIDEO].updated=0; + if (vs_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_VIDEO], vs); - call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; - linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); - call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; - if (ts) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); + call->stats[LINPHONE_CALL_STATS_TEXT].updated|=LINPHONE_CALL_STATS_PERIODICAL_UPDATE; + linphone_core_notify_call_stats_updated(call->core, call, &call->stats[LINPHONE_CALL_STATS_TEXT]); + call->stats[LINPHONE_CALL_STATS_TEXT].updated=0; + if (ts_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts); + } ms_message( "Bandwidth usage for call [%p]:\n" @@ -4313,8 +4316,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){ linphone_core_update_ice_state_in_call_stats(call); } } else if (evt == ORTP_EVENT_ICE_RESTART_NEEDED) { - ice_session_restart(call->ice_session, IR_Controlling); - ice_session_set_role(call->ice_session, IR_Controlling); + ice_session_restart(call->ice_session, IR_Controlling); linphone_core_update_call(call->core, call, call->current_params); } } @@ -4373,6 +4375,28 @@ void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){ } } +static MediaStream * linphone_call_get_media_stream(LinphoneCall *call, int stream_index){ + if (stream_index == call->main_audio_stream_index) + return (MediaStream*)call->audiostream; + if (stream_index == call->main_video_stream_index) + return (MediaStream*)call->videostream; + if (stream_index == call->main_text_stream_index) + return (MediaStream*)call->textstream; + ms_error("linphone_call_get_media_stream(): no stream index %i", stream_index); + return NULL; +} + +static OrtpEvQueue *linphone_call_get_event_queue(LinphoneCall *call, int stream_index){ + if (stream_index == call->main_audio_stream_index) + return call->audiostream_app_evq; + if (stream_index == call->main_video_stream_index) + return call->videostream_app_evq; + if (stream_index == call->main_text_stream_index) + return call->textstream_app_evq; + ms_error("linphone_call_get_event_queue(): no stream index %i", stream_index); + return NULL; +} + void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){ MediaStream *ms = stream_index == call->main_audio_stream_index ? (MediaStream *)call->audiostream : (stream_index == call->main_video_stream_index ? (MediaStream *)call->videostream : (MediaStream *)call->textstream); OrtpEvQueue *evq; @@ -4401,11 +4425,15 @@ void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){ } } /*yes the event queue has to be taken at each iteration, because ice events may perform operations re-creating the streams*/ - while ((evq = stream_index == call->main_audio_stream_index ? call->audiostream_app_evq : (stream_index == call->main_video_stream_index ? call->videostream_app_evq : call->textstream_app_evq)) && (NULL != (ev=ortp_ev_queue_get(evq)))){ + while((evq = linphone_call_get_event_queue(call, stream_index)) != NULL && NULL != (ev=ortp_ev_queue_get(evq))){ OrtpEventType evt=ortp_event_get_type(ev); OrtpEventData *evd=ortp_event_get_data(ev); - int stats_index = stream_index == call->main_audio_stream_index ? LINPHONE_CALL_STATS_AUDIO : (stream_index == call->main_video_stream_index ? LINPHONE_CALL_STATS_VIDEO : LINPHONE_CALL_STATS_TEXT); + + /*and yes the MediaStream must be taken at each iteration, because it may have changed due to the handling of events + * in this loop*/ + ms = linphone_call_get_media_stream(call, stream_index); + if (ms) linphone_call_stats_fill(&call->stats[stats_index],ms,ev); linphone_call_notify_stats_updated(call,stats_index); @@ -4790,8 +4818,10 @@ MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index) return MSVideo; } else if (stream_index == call->main_text_stream_index) { return MSText; + } else if (stream_index == call->main_audio_stream_index){ + return MSAudio; } - return MSAudio; + return MSUnknownMedia; } RtpTransport* linphone_call_get_meta_rtp_transport(LinphoneCall *call, int stream_index) { @@ -4850,6 +4880,7 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ /*First, make sure that the proxy from which we received this call, or to which we routed this call is registered*/ if (!call->dest_proxy || linphone_proxy_config_get_state(call->dest_proxy) != LinphoneRegistrationOk) return; + if (!call->core->media_network_reachable) return; switch (call->state){ case LinphoneCallStreamsRunning: @@ -4857,8 +4888,7 @@ void linphone_call_repair_if_broken(LinphoneCall *call){ case LinphoneCallPausedByRemote: ms_message("LinphoneCall[%p] is going to be updated (reINVITE) in order to recover from lost connectivity", call); if (call->ice_session){ - ice_session_restart(call->ice_session, IR_Controlling); - ice_session_set_role(call->ice_session, IR_Controlling); + ice_session_restart(call->ice_session, IR_Controlling); } params = linphone_core_create_call_params(call->core, call); linphone_core_update_call(call->core, call, params); From 580310fc74c6d1b1f986d68a71d2a690c88a1500 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Fri, 29 Jan 2016 14:00:24 +0100 Subject: [PATCH 26/56] implement io error handling for list subscription --- coreapi/callbacks.c | 2 +- coreapi/friendlist.c | 2 +- tester/presence_tester.c | 29 ++++++++++++++++++++--------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 26e207d79..d6fd1c32b 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -1303,7 +1303,7 @@ static void subscribe_response(SalOp *op, SalSubscribeStatus status){ }else if (status==SalSubscribePending){ linphone_event_set_state(lev,LinphoneSubscriptionPending); }else{ - if (lev->subscription_state==LinphoneSubscriptionActive && ei->reason==SalReasonIOError){ + if (lev->subscription_state==LinphoneSubscriptionActive && (ei->reason==SalReasonIOError || ei->reason == SalReasonNoMatch)){ linphone_event_set_state(lev,LinphoneSubscriptionOutgoingProgress); } else linphone_event_set_state(lev,LinphoneSubscriptionError); diff --git a/coreapi/friendlist.c b/coreapi/friendlist.c index 9201d6d9c..fd0841782 100644 --- a/coreapi/friendlist.c +++ b/coreapi/friendlist.c @@ -489,7 +489,7 @@ void linphone_friend_list_subscription_state_changed(LinphoneCore *lc, LinphoneE , lev , list); - if (state == LinphoneSubscriptionOutgoingProgress) { + if (state == LinphoneSubscriptionOutgoingProgress && linphone_event_get_reason(lev) == LinphoneReasonNoMatch) { ms_message("Resseting version count for friend list [%p]",list); list->expected_notification_version = 0; } diff --git a/tester/presence_tester.c b/tester/presence_tester.c index 77815e847..ebb4350d0 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -820,7 +820,7 @@ static void test_presence_list_subscription_expire_for_unknown(void) { linphone_core_manager_destroy(laure); } -static void test_presence_list_subscribe_dialog_expire(void) { +static void test_presence_list_subscribe_with_error(bool_t io_error) { LinphoneCoreManager *laure = linphone_core_manager_new("laure_tcp_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_rc"); const char *rls_uri = "sip:rls@sip.example.org"; @@ -866,17 +866,21 @@ static void test_presence_list_subscribe_dialog_expire(void) { BC_ASSERT_EQUAL(lf->subscribe_active, TRUE, int, "%d"); BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_NotifyPresenceReceived, 2, 5000)); - ms_message("Simulating in/out packets losses"); - sal_set_send_error(laure->lc->sal,1500); /*make sure no refresh is sent, trash the message without generating error*/ - sal_set_recv_error(laure->lc->sal, 1500); /*make sure server notify to close the dialog is also ignored*/ - - wait_for_list(lcs, &dummy, 1, 3000); /* Wait a little bit for the subscribe to happen */ - + if (io_error) { + ms_message("Simulating socket error"); + sal_set_recv_error(laure->lc->sal, -1); + wait_for_list(lcs, &dummy, 1, 1000); /* just time for socket to be closed */ + + } else { + ms_message("Simulating in/out packets losses"); + sal_set_send_error(laure->lc->sal,1500); /*make sure no refresh is sent, trash the message without generating error*/ + sal_set_recv_error(laure->lc->sal, 1500); /*make sure server notify to close the dialog is also ignored*/ + wait_for_list(lcs, &dummy, 1, 3000); /* Wait a little bit for the subscribe to happen */ + } /*restart normal behavior*/ sal_set_send_error(laure->lc->sal,0); sal_set_recv_error(laure->lc->sal, 1); - linphone_core_set_presence_model(pauline->lc, linphone_core_create_presence_model_with_activity(pauline->lc, LinphonePresenceActivityAway, NULL)); BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_NotifyPresenceReceived, 3, 5000)); @@ -887,7 +891,13 @@ static void test_presence_list_subscribe_dialog_expire(void) { linphone_core_manager_destroy(pauline); } +static void test_presence_list_subscribe_dialog_expire(void) { + test_presence_list_subscribe_with_error(FALSE); +} +static void test_presence_list_subscribe_io_error(void) { + test_presence_list_subscribe_with_error(TRUE); +} test_t presence_tests[] = { TEST_NO_TAG("Simple Subscribe", simple_subscribe), @@ -904,7 +914,8 @@ test_t presence_tests[] = { TEST_NO_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish), TEST_NO_TAG("Presence list", test_presence_list), TEST_NO_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown), - TEST_NO_TAG("Presence list, silent subscription expiration", test_presence_list_subscribe_dialog_expire) + TEST_NO_TAG("Presence list, silent subscription expiration", test_presence_list_subscribe_dialog_expire), + TEST_NO_TAG("Presence list, io error",test_presence_list_subscribe_io_error) }; test_suite_t presence_test_suite = {"Presence", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, From 933748ee9becf3186776f9d1cb69a00e92dc2905 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 29 Jan 2016 16:29:26 +0100 Subject: [PATCH 27/56] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 7053d54e7..64777b9d0 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 7053d54e7e3375944ee54671b82c3b5f63eac072 +Subproject commit 64777b9d01fc114e62efe24390e3868821fd5271 From 2f0002f419fd4a7cb062ce7cda809a21a4075f7b Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Fri, 29 Jan 2016 17:14:31 +0100 Subject: [PATCH 28/56] Update media streamer. --- coreapi/lsd.c | 2 -- mediastreamer2 | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/coreapi/lsd.c b/coreapi/lsd.c index f3a324637..b2000632d 100644 --- a/coreapi/lsd.c +++ b/coreapi/lsd.c @@ -61,7 +61,6 @@ struct _LinphoneSoundDaemon { static MSFilter *create_writer(MSSndCard *c){ LinphoneSoundDaemon *lsd=(LinphoneSoundDaemon*)c->data; -// MSFilter *itcsink=ms_filter_new(MS_ITC_SINK_ID); MSFilter *itcsink=ms_factory_create_filter(ms_snd_card_factory_get(c), MS_ITC_SINK_ID); ms_filter_call_method(itcsink,MS_ITC_SINK_CONNECT,lsd->branches[0].player); return itcsink; @@ -237,7 +236,6 @@ LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char * lsd=ms_new0(LinphoneSoundDaemon,1); lsd->soundout=ms_snd_card_create_writer(card); -// lsd->mixer=ms_filter_new(MS_AUDIO_MIXER_ID); lsd->mixer=ms_factory_create_filter(ms_snd_card_factory_get(card),MS_AUDIO_MIXER_ID); lsd->out_rate=rate; lsd->out_nchans=nchannels; diff --git a/mediastreamer2 b/mediastreamer2 index 5e9a21c8d..085f64d41 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 5e9a21c8dae0ff2fe62b82977dbafa3f00ca744f +Subproject commit 085f64d41e8c6643294f6c9cb9f256ca52e9c019 From 2338c9467457ada5bf2ecd036e76d042cece9d57 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 29 Jan 2016 17:48:55 +0100 Subject: [PATCH 29/56] fix routing of quality reporting publishes --- coreapi/bellesip_sal/sal_address_impl.c | 5 +++++ coreapi/quality_reporting.c | 24 +++++++++++++++--------- include/sal/sal.h | 1 + 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/coreapi/bellesip_sal/sal_address_impl.c b/coreapi/bellesip_sal/sal_address_impl.c index b6ed5b77e..8b8b75417 100644 --- a/coreapi/bellesip_sal/sal_address_impl.c +++ b/coreapi/bellesip_sal/sal_address_impl.c @@ -208,6 +208,11 @@ void sal_address_set_uri_params(SalAddress *addr, const char *params){ belle_sip_parameters_set(parameters,params); } +bool_t sal_address_has_uri_param(SalAddress *addr, const char *name){ + belle_sip_parameters_t* parameters = BELLE_SIP_PARAMETERS(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(addr))); + belle_sip_parameters_has_parameter(parameters, name); +} + void sal_address_set_header(SalAddress *addr, const char *header_name, const char *header_value){ belle_sip_uri_set_header(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(addr)),header_name, header_value); } diff --git a/coreapi/quality_reporting.c b/coreapi/quality_reporting.c index 5f01ab99b..ea4ba3f6e 100644 --- a/coreapi/quality_reporting.c +++ b/coreapi/quality_reporting.c @@ -271,8 +271,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report, int ret = 0; LinphoneEvent *lev; LinphoneAddress *request_uri; - char * domain; - const char* route; + const char* collector_uri; /*if we are on a low bandwidth network, do not send reports to not overload it*/ if (linphone_call_params_low_bandwidth_enabled(linphone_call_get_current_params(call))){ @@ -353,14 +352,21 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report, } - route = linphone_proxy_config_get_quality_reporting_collector(call->dest_proxy); - domain = ms_strdup_printf("sip:%s", linphone_proxy_config_get_domain(call->dest_proxy)); - request_uri = linphone_address_new(route ? route : domain); - ms_free(domain); + collector_uri = linphone_proxy_config_get_quality_reporting_collector(call->dest_proxy); + if (!collector_uri){ + collector_uri = ms_strdup_printf("sip:%s", linphone_proxy_config_get_domain(call->dest_proxy)); + } + request_uri = linphone_address_new(collector_uri); lev=linphone_core_create_publish(call->core, request_uri, "vq-rtcpxr", expires); - if (route) { - ms_message("Publishing report with custom route %s", route); - sal_op_set_route(lev->op, route); + /* Special exception for quality report PUBLISH: if the collector_uri has any transport related parameters + * (port, transport, maddr), then it is sent directly. + * Otherwise it is routed as any LinphoneEvent publish, following proxy config policy. + **/ + if (sal_address_has_uri_param((SalAddress*)request_uri, "transport") || + sal_address_has_uri_param((SalAddress*)request_uri, "maddr") || + linphone_address_get_port(request_uri) != 0) { + ms_message("Publishing report with custom route %s", collector_uri); + sal_op_set_route(lev->op, collector_uri); } if (linphone_event_send_publish(lev, content) != 0){ diff --git a/include/sal/sal.h b/include/sal/sal.h index ca06b1d13..5a7e59138 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -126,6 +126,7 @@ void sal_address_set_transport_name(SalAddress* addr,const char* transport); void sal_address_set_method_param(SalAddress *addr, const char *method); void sal_address_set_params(SalAddress *addr, const char *params); void sal_address_set_uri_params(SalAddress *addr, const char *params); +bool_t sal_address_has_uri_param(SalAddress *addr, const char *name); bool_t sal_address_is_ipv6(const SalAddress *addr); bool_t sal_address_is_sip(const SalAddress *addr); void sal_address_set_password(SalAddress *addr, const char *passwd); From 058c8fdc6bbb25b5c15d619156b7abce13a1fd56 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Fri, 29 Jan 2016 17:51:00 +0100 Subject: [PATCH 30/56] fix bug in last commit --- coreapi/bellesip_sal/sal_address_impl.c | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/bellesip_sal/sal_address_impl.c b/coreapi/bellesip_sal/sal_address_impl.c index 8b8b75417..505ee95e3 100644 --- a/coreapi/bellesip_sal/sal_address_impl.c +++ b/coreapi/bellesip_sal/sal_address_impl.c @@ -210,7 +210,7 @@ void sal_address_set_uri_params(SalAddress *addr, const char *params){ bool_t sal_address_has_uri_param(SalAddress *addr, const char *name){ belle_sip_parameters_t* parameters = BELLE_SIP_PARAMETERS(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(addr))); - belle_sip_parameters_has_parameter(parameters, name); + return belle_sip_parameters_has_parameter(parameters, name); } void sal_address_set_header(SalAddress *addr, const char *header_name, const char *header_value){ diff --git a/mediastreamer2 b/mediastreamer2 index 64777b9d0..bce674252 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 64777b9d01fc114e62efe24390e3868821fd5271 +Subproject commit bce6742522a3cc32e26f13aef68123f941bd77ab From 89c76ba9238355ea3104598387360d220de1855f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sat, 30 Jan 2016 21:57:52 +0100 Subject: [PATCH 31/56] fix specfile --- linphone.spec.in | 1 + 1 file changed, 1 insertion(+) diff --git a/linphone.spec.in b/linphone.spec.in index fa5541a0a..a92ec864e 100644 --- a/linphone.spec.in +++ b/linphone.spec.in @@ -100,6 +100,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/lpc2xml_test %{_bindir}/xml2lpc_test %{_bindir}/lp-gen-wrappers +%{_bindir}/lp-sendmsg %{_includedir}/linphone %{_libdir}/*.a %{_libdir}/*.la From 395c7a38bbb1cbabbbf80344bb91b871206b5d0c Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Sun, 31 Jan 2016 09:08:06 +0100 Subject: [PATCH 32/56] set longer timeout for getting registered, don't send a REGISTER to an AT&T machine. --- tester/call_tester.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tester/call_tester.c b/tester/call_tester.c index 8eb458f93..32a16075f 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -547,14 +547,14 @@ static void call_outbound_with_multiple_proxy(void) { // set first LPC to unreacheable proxy addr linphone_proxy_config_edit(lpc); - linphone_proxy_config_set_server_addr(lpc,"12.13.14.15:5223;transport=udp"); - linphone_proxy_config_set_route(lpc, "12.13.14.15:5223;transport=udp;lr"); + linphone_proxy_config_set_server_addr(lpc,"sip:linphone.org:9016;transport=udp"); + linphone_proxy_config_set_route(lpc, "sip:linphone.org:9016;transport=udp;lr"); linphone_proxy_config_done(lpc); - BC_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 2000)); + BC_ASSERT_TRUE(wait_for_until(pauline->lc, NULL, &pauline->stat.number_of_LinphoneRegistrationOk, 1, 10000)); BC_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationProgress, 2, 200)); - BC_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk, 1, 2000)); + BC_ASSERT_TRUE(wait_for_until(marie->lc, NULL, &marie->stat.number_of_LinphoneRegistrationOk, 1, 10000)); // calling marie should go through the second proxy config BC_ASSERT_TRUE(call(marie, pauline)); From 9314c11a65b1773c80a275ce4dbe3d61ca6eb305 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 1 Feb 2016 11:25:53 +0100 Subject: [PATCH 33/56] Update submodule mediastreamer2 with merge of dev_msfactory. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index f6fb1dc8f..b2eb303aa 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit f6fb1dc8f24aaf2f1064bb756cdd0144a2c452da +Subproject commit b2eb303aabac2620b80f366d4aab50d38d7acc86 From e69e79f181214bf0e872c30b28ec2f8e92b70474 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 1 Feb 2016 11:25:57 +0100 Subject: [PATCH 34/56] Improved SQL call log storage test for start_time --- tester/call_tester.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tester/call_tester.c b/tester/call_tester.c index 32a16075f..698ca68ee 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -5710,7 +5710,8 @@ static void call_logs_sqlite_storage(void) { MSList *logs = NULL; LinphoneCallLog *call_log = NULL; LinphoneAddress *laure = NULL; - time_t start_time = time(NULL); + time_t user_data_time = time(NULL); + time_t start_time = NULL; unlink(logs_db); linphone_core_set_call_logs_database_path(marie->lc, logs_db); @@ -5719,7 +5720,8 @@ static void call_logs_sqlite_storage(void) { BC_ASSERT_TRUE(call(marie, pauline)); wait_for_until(marie->lc, pauline->lc, NULL, 5, 500); call_log = linphone_call_get_call_log(linphone_core_get_current_call(marie->lc)); - linphone_call_log_set_user_data(call_log, &start_time); + start_time = linphone_call_log_get_start_date(call_log); + linphone_call_log_set_user_data(call_log, &user_data_time); linphone_call_log_set_ref_key(call_log, "ref_key"); end_call(marie, pauline); BC_ASSERT_TRUE(linphone_core_get_call_history_size(marie->lc) == 1); @@ -5752,7 +5754,7 @@ static void call_logs_sqlite_storage(void) { if (ref_key) { BC_ASSERT_STRING_EQUAL(ref_key, "ref_key"); } - BC_ASSERT_PTR_EQUAL(linphone_call_log_get_user_data(call_log), &start_time); + BC_ASSERT_PTR_EQUAL(linphone_call_log_get_user_data(call_log), &user_data_time); call_id = linphone_call_log_get_call_id(call_log); BC_ASSERT_PTR_NOT_NULL(call_id); @@ -5762,7 +5764,8 @@ static void call_logs_sqlite_storage(void) { linphone_call_log_get_remote_address(call_log), linphone_proxy_config_get_identity_address(linphone_core_get_default_proxy_config(pauline->lc)))); BC_ASSERT_PTR_NOT_NULL(linphone_call_log_get_remote_stats(call_log)); - BC_ASSERT_GREATER(linphone_call_log_get_start_date(call_log), start_time, int, "%d"); + BC_ASSERT_PTR_NOT_NULL(linphone_call_log_get_start_date(call_log)); + BC_ASSERT_EQUAL(linphone_call_log_get_start_date(call_log), start_time, int, "%d"); BC_ASSERT_EQUAL(linphone_call_log_get_status(call_log), LinphoneCallSuccess, int, "%d"); } From 0d0d9ee8caeae174b50f73226103c1dbe5e290a2 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Mon, 1 Feb 2016 14:18:07 +0100 Subject: [PATCH 35/56] Fix 0002832: Date/time of calls not show in call history on Windows. --- gtk/calllogs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/calllogs.c b/gtk/calllogs.c index 713ed6e96..58fb4e6e5 100644 --- a/gtk/calllogs.c +++ b/gtk/calllogs.c @@ -301,7 +301,7 @@ void linphone_gtk_call_log_update(GtkWidget *w){ time_t start_date_time=linphone_call_log_get_start_date(cl); const gchar *call_status_icon_name; -#if GLIB_CHECK_VERSION(2,26,0) +#if GLIB_CHECK_VERSION(2,30,0) // The g_date_time_format function exists since 2.26.0 but the '%c' format is only supported since 2.30.0 if (start_date_time){ GDateTime *dt=g_date_time_new_from_unix_local(start_date_time); start_date=g_date_time_format(dt,"%c"); @@ -309,6 +309,9 @@ void linphone_gtk_call_log_update(GtkWidget *w){ } #else start_date=g_strdup(ctime(&start_date_time)); + if (start_date[strlen(start_date) - 1] == '\n') { + start_date[strlen(start_date) - 1] = '\0'; + } #endif lf=linphone_core_get_friend_by_address(linphone_gtk_get_core(),addr); if(lf != NULL){ From df4ea94a8e9216261fe42d3d901afd3fbfa4e1be Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Feb 2016 14:48:25 +0100 Subject: [PATCH 36/56] clean a few things around MSFactory usage --- coreapi/callbacks.c | 2 +- coreapi/conference.cc | 2 +- coreapi/linphonecall.c | 29 ++++++++++----------- coreapi/linphonecore.c | 43 +++++++++++++++--------------- coreapi/linphonecore.h | 59 ++++++++++++++++++++++-------------------- coreapi/localplayer.c | 8 +++--- coreapi/lsd.c | 8 +++--- coreapi/player.c | 6 ++--- coreapi/private.h | 2 +- gtk/audio_assistant.c | 18 ++++++------- gtk/propertybox.c | 2 +- gtk/videowindow.c | 2 +- mediastreamer2 | 2 +- tester/call_tester.c | 8 +++--- tester/player_tester.c | 8 +++--- tester/tester.c | 4 +-- tools/auto_answer.c | 2 +- tools/test_lsd.c | 2 +- 18 files changed, 103 insertions(+), 104 deletions(-) diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 8bb6c368a..4b55f474e 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -405,7 +405,7 @@ static void start_remote_ring(LinphoneCore *lc, LinphoneCall *call) { if (call->audiostream) audio_stream_unprepare_sound(call->audiostream); if( lc->sound_conf.remote_ring ){ - lc->ringstream=ring_start(lc->sound_conf.remote_ring,2000,ringcard,lc->factory); + lc->ringstream=ring_start(lc->factory, lc->sound_conf.remote_ring,2000,ringcard); } } } diff --git a/coreapi/conference.cc b/coreapi/conference.cc index 90f5117e6..50dd57c2d 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -317,7 +317,7 @@ RtpProfile *LocalConference::sMakeDummyProfile(int samplerate){ void LocalConference::addLocalEndpoint() { /*create a dummy audiostream in order to extract the local part of it */ /* network address and ports have no meaning and are not used here. */ - AudioStream *st=audio_stream_new(65000,65001,FALSE,m_core->factory); + AudioStream *st=audio_stream_new(m_core->factory, 65000,65001,FALSE); MSSndCard *playcard=m_core->sound_conf.lsd_card ? m_core->sound_conf.lsd_card : m_core->sound_conf.play_sndcard; MSSndCard *captcard=m_core->sound_conf.capt_sndcard; diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 2386136d2..ba55fd1c2 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -50,7 +50,7 @@ void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index); MSWebCam *get_nowebcam_device(MSFactory* f){ #ifdef VIDEO_ENABLED - return ms_web_cam_manager_get_cam(ms_factory_get_wbc_manager(f),"StaticImage: Static picture"); + return ms_web_cam_manager_get_cam(ms_factory_get_web_cam_manager(f),"StaticImage: Static picture"); #else return NULL; #endif @@ -2340,10 +2340,9 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ if (remotedesc) stream_desc = sal_media_description_find_best_stream(remotedesc, SalAudio); - call->audiostream=audiostream=audio_stream_new2(linphone_call_get_bind_ip_for_stream(call,call->main_audio_stream_index), + call->audiostream=audiostream=audio_stream_new2(lc->factory, linphone_call_get_bind_ip_for_stream(call,call->main_audio_stream_index), multicast_role == SalMulticastReceiver ? stream_desc->rtp_port : call->media_ports[call->main_audio_stream_index].rtp_port, - multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_audio_stream_index].rtcp_port, - call->core->factory); + multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_audio_stream_index].rtcp_port); if (multicast_role == SalMulticastReceiver) linphone_call_join_multicast_group(call, call->main_audio_stream_index, &audiostream->ms); rtp_session_enable_network_simulation(call->audiostream->ms.sessions.rtp_session, &lc->net_conf.netsim_params); @@ -2354,7 +2353,7 @@ void linphone_call_init_audio_stream(LinphoneCall *call){ setup_dtls_params(call, &audiostream->ms); media_stream_reclaim_sessions(&audiostream->ms, &call->sessions[call->main_audio_stream_index]); }else{ - call->audiostream=audio_stream_new_with_sessions(&call->sessions[call->main_audio_stream_index], lc->factory); + call->audiostream=audio_stream_new_with_sessions(lc->factory, &call->sessions[call->main_audio_stream_index]); } audiostream=call->audiostream; @@ -2441,10 +2440,9 @@ void linphone_call_init_video_stream(LinphoneCall *call){ if (remotedesc) stream_desc = sal_media_description_find_best_stream(remotedesc, SalVideo); - call->videostream=video_stream_new2(linphone_call_get_bind_ip_for_stream(call,call->main_video_stream_index), + call->videostream=video_stream_new2(lc->factory, linphone_call_get_bind_ip_for_stream(call,call->main_video_stream_index), multicast_role == SalMulticastReceiver ? stream_desc->rtp_port : call->media_ports[call->main_video_stream_index].rtp_port, - multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_video_stream_index].rtcp_port, - lc->factory); + multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_video_stream_index].rtcp_port); if (multicast_role == SalMulticastReceiver) linphone_call_join_multicast_group(call, call->main_video_stream_index, &call->videostream->ms); rtp_session_enable_network_simulation(call->videostream->ms.sessions.rtp_session, &lc->net_conf.netsim_params); @@ -2455,7 +2453,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){ setup_dtls_params(call, &call->videostream->ms); media_stream_reclaim_sessions(&call->videostream->ms, &call->sessions[call->main_video_stream_index]); }else{ - call->videostream=video_stream_new_with_sessions(&call->sessions[call->main_video_stream_index], lc->factory); + call->videostream=video_stream_new_with_sessions(lc->factory, &call->sessions[call->main_video_stream_index]); } if (call->media_ports[call->main_video_stream_index].rtp_port==-1){ @@ -2508,10 +2506,9 @@ void linphone_call_init_text_stream(LinphoneCall *call){ if (call->op) remotedesc = sal_call_get_remote_media_description(call->op); if (remotedesc) stream_desc = sal_media_description_find_best_stream(remotedesc, SalText); - call->textstream = textstream = text_stream_new2(linphone_call_get_bind_ip_for_stream(call,call->main_text_stream_index), + call->textstream = textstream = text_stream_new2(lc->factory, linphone_call_get_bind_ip_for_stream(call,call->main_text_stream_index), multicast_role == SalMulticastReceiver ? stream_desc->rtp_port : call->media_ports[call->main_text_stream_index].rtp_port, - multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_text_stream_index].rtcp_port, - call->core->factory); + multicast_role == SalMulticastReceiver ? 0 /*disabled for now*/ : call->media_ports[call->main_text_stream_index].rtcp_port); if (multicast_role == SalMulticastReceiver) linphone_call_join_multicast_group(call, call->main_text_stream_index, &textstream->ms); rtp_session_enable_network_simulation(call->textstream->ms.sessions.rtp_session, &lc->net_conf.netsim_params); @@ -2521,7 +2518,7 @@ void linphone_call_init_text_stream(LinphoneCall *call){ setup_dtls_params(call, &textstream->ms); media_stream_reclaim_sessions(&textstream->ms, &call->sessions[call->main_text_stream_index]); } else { - call->textstream = text_stream_new_with_sessions(&call->sessions[call->main_text_stream_index],call->core->factory); + call->textstream = text_stream_new_with_sessions(lc->factory, &call->sessions[call->main_text_stream_index]); } textstream = call->textstream; if (call->media_ports[call->main_text_stream_index].rtp_port == -1) { @@ -2946,7 +2943,7 @@ static RtpSession * create_audio_rtp_io_session(LinphoneCall *call) { if (pt != NULL) { call->rtp_io_audio_profile = rtp_profile_new("RTP IO audio profile"); rtp_profile_set_payload(call->rtp_io_audio_profile, ptnum, payload_type_clone(pt)); - rtp_session = ms_create_duplex_rtp_session(local_ip, local_port, -1); + rtp_session = ms_create_duplex_rtp_session(local_ip, local_port, -1, ms_factory_get_mtu(lc->factory)); rtp_session_set_profile(rtp_session, call->rtp_io_audio_profile); rtp_session_set_remote_addr_and_port(rtp_session, remote_ip, remote_port, -1); rtp_session_enable_rtcp(rtp_session, FALSE); @@ -3147,7 +3144,7 @@ static RtpSession * create_video_rtp_io_session(LinphoneCall *call) { if (pt != NULL) { call->rtp_io_video_profile = rtp_profile_new("RTP IO video profile"); rtp_profile_set_payload(call->rtp_io_video_profile, ptnum, payload_type_clone(pt)); - rtp_session = ms_create_duplex_rtp_session(local_ip, local_port, -1); + rtp_session = ms_create_duplex_rtp_session(local_ip, local_port, -1, ms_factory_get_mtu(lc->factory)); rtp_session_set_profile(rtp_session, call->rtp_io_video_profile); rtp_session_set_remote_addr_and_port(rtp_session, remote_ip, remote_port, -1); rtp_session_enable_rtcp(rtp_session, FALSE); @@ -3342,7 +3339,7 @@ static void linphone_call_start_text_stream(LinphoneCall *call) { if (is_multicast) rtp_session_set_multicast_ttl(call->textstream->ms.sessions.rtp_session,tstream->ttl); - text_stream_start(call->textstream, call->text_profile, rtp_addr, tstream->rtp_port, rtcp_addr, (linphone_core_rtcp_enabled(lc) && !is_multicast) ? (tstream->rtcp_port ? tstream->rtcp_port : tstream->rtp_port + 1) : 0, used_pt, call->core->factory); + text_stream_start(call->textstream, call->text_profile, rtp_addr, tstream->rtp_port, rtcp_addr, (linphone_core_rtcp_enabled(lc) && !is_multicast) ? (tstream->rtcp_port ? tstream->rtcp_port : tstream->rtp_port + 1) : 0, used_pt); ms_filter_add_notify_callback(call->textstream->rttsink, real_time_text_character_received, call, FALSE); ms_media_stream_sessions_set_encryption_mandatory(&call->textstream->ms.sessions,call->current_params->encryption_mandatory); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index e0dd9e24b..95efd2a1d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -779,7 +779,7 @@ static void build_sound_devices_table(LinphoneCore *lc){ const char **old; int ndev; int i; - const MSList *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_manager(lc->factory)); + const MSList *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_card_manager(lc->factory)); ndev=ms_list_size(elem); devices=ms_malloc((ndev+1)*sizeof(const char *)); for (i=0;elem!=NULL;elem=elem->next,i++){ @@ -824,13 +824,13 @@ static void sound_config_read(LinphoneCore *lc) char s=*i; *i='\0'; card=ms_alsa_card_new_custom(d+l,d+l); - ms_snd_card_manager_add_card(ms_factory_get_snd_manager(linphone_core_get_factory((void*)lc))),card); + ms_snd_card_manager_add_card(ms_factory_get_snd_card_manager(lc->factory),card); *i=s; l=i-d+1; } if(d[l]!='\0') { card=ms_alsa_card_new_custom(d+l,d+l); - ms_snd_card_manager_add_card(ms_factory_get_snd_manager(linphone_core_get_factory((void*)lc))),card); + ms_snd_card_manager_add_card(ms_factory_get_snd_card_manager(lc->factory),card); } free(d); } @@ -1295,7 +1295,7 @@ static void build_video_devices_table(LinphoneCore *lc){ if (lc->video_conf.cams) ms_free(lc->video_conf.cams); /* retrieve all video devices */ - elem=ms_web_cam_manager_get_list(ms_factory_get_wbc_manager(lc->factory)); + elem=ms_web_cam_manager_get_list(ms_factory_get_web_cam_manager(lc->factory)); ndev=ms_list_size(elem); devices=ms_malloc((ndev+1)*sizeof(const char *)); for (i=0;elem!=NULL;elem=elem->next,i++){ @@ -1686,7 +1686,7 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab ortp_init(); linphone_core_activate_log_serialization_if_needed(); - lc->factory = ms_factory_create(lc->factory); + lc->factory = ms_factory_new_with_voip(); linphone_core_register_default_codecs(lc); linphone_core_register_offer_answer_providers(lc); /* Get the mediastreamer2 event queue */ @@ -4458,7 +4458,7 @@ void linphone_core_set_rec_level(LinphoneCore *lc, int level) static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap, MSFactory *f){ MSSndCard *sndcard=NULL; if (devid!=NULL){ - sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_manager(f),devid); + sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(f),devid); if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & cap)==0 ){ ms_warning("%s card does not have the %s capability, ignoring.", @@ -4469,15 +4469,15 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap, M } if (sndcard==NULL) { if ((cap & MS_SND_CARD_CAP_CAPTURE) && (cap & MS_SND_CARD_CAP_PLAYBACK)){ - sndcard=ms_snd_card_manager_get_default_card(ms_factory_get_snd_manager(f)); + sndcard=ms_snd_card_manager_get_default_card(ms_factory_get_snd_card_manager(f)); }else if (cap & MS_SND_CARD_CAP_CAPTURE){ - sndcard=ms_snd_card_manager_get_default_capture_card(ms_factory_get_snd_manager(f)); + sndcard=ms_snd_card_manager_get_default_capture_card(ms_factory_get_snd_card_manager(f)); } else if (cap & MS_SND_CARD_CAP_PLAYBACK){ - sndcard=ms_snd_card_manager_get_default_playback_card(ms_factory_get_snd_manager(f)); + sndcard=ms_snd_card_manager_get_default_playback_card(ms_factory_get_snd_card_manager(f)); } if (sndcard==NULL){/*looks like a bug! take the first one !*/ - const MSList *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_manager(f)); + const MSList *elem=ms_snd_card_manager_get_list(ms_factory_get_snd_card_manager(f)); if (elem) sndcard=(MSSndCard*)elem->data; } } @@ -4494,7 +4494,7 @@ static MSSndCard *get_card_from_string_id(const char *devid, unsigned int cap, M **/ bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *devid){ MSSndCard *sndcard; - sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_manager(lc->factory),devid); + sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(lc->factory),devid); if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_CAPTURE)) return TRUE; return FALSE; } @@ -4508,7 +4508,7 @@ bool_t linphone_core_sound_device_can_capture(LinphoneCore *lc, const char *devi **/ bool_t linphone_core_sound_device_can_playback(LinphoneCore *lc, const char *devid){ MSSndCard *sndcard; - sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_manager(lc->factory),devid); + sndcard=ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(lc->factory),devid); if (sndcard!=NULL && (ms_snd_card_get_capabilities(sndcard) & MS_SND_CARD_CAP_PLAYBACK)) return TRUE; return FALSE; } @@ -4634,7 +4634,7 @@ void linphone_core_reload_sound_devices(LinphoneCore *lc){ if (capture != NULL) { capture_copy = ms_strdup(capture); } - ms_snd_card_manager_reload(ms_factory_get_snd_manager(lc->factory)); + ms_snd_card_manager_reload(ms_factory_get_snd_card_manager(lc->factory)); build_sound_devices_table(lc); if (ringer_copy != NULL) { linphone_core_set_ringer_device(lc, ringer_copy); @@ -4656,7 +4656,7 @@ void linphone_core_reload_video_devices(LinphoneCore *lc){ if (devid != NULL) { devid_copy = ms_strdup(devid); } - ms_web_cam_manager_reload(ms_factory_get_wbc_manager(lc->factory)); + ms_web_cam_manager_reload(ms_factory_get_web_cam_manager(lc->factory)); build_video_devices_table(lc); if (devid_copy != NULL) { linphone_core_set_video_device(lc, devid_copy); @@ -4789,8 +4789,8 @@ int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCb return err; } -MSFactory *linphone_core_get_factory(void *lc){ - return ((LinphoneCore*)lc)->factory; +MSFactory *linphone_core_get_ms_factory(LinphoneCore *lc){ + return lc->factory; } /** * Sets the path to a wav file used for ringing back. @@ -5407,13 +5407,13 @@ int linphone_core_set_video_device(LinphoneCore *lc, const char *id){ MSWebCam *olddev=lc->video_conf.device; const char *vd; if (id!=NULL){ - lc->video_conf.device=ms_web_cam_manager_get_cam(ms_factory_get_wbc_manager(lc->factory),id); + lc->video_conf.device=ms_web_cam_manager_get_cam(ms_factory_get_web_cam_manager(lc->factory),id); if (lc->video_conf.device==NULL){ ms_warning("Could not find video device %s",id); } } if (lc->video_conf.device==NULL) - lc->video_conf.device=ms_web_cam_manager_get_default_cam(ms_factory_get_wbc_manager(lc->factory)); + lc->video_conf.device=ms_web_cam_manager_get_default_cam(ms_factory_get_web_cam_manager(lc->factory)); if (olddev!=NULL && olddev!=lc->video_conf.device){ toggle_video_preview(lc,FALSE);/*restart the video local preview*/ } @@ -5922,7 +5922,7 @@ static MSFilter *get_audio_resource(LinphoneCore *lc, LinphoneAudioResourceType if (ringcard == NULL) return NULL; - ringstream=lc->ringstream=ring_start(NULL,0,ringcard, lc->factory); + ringstream=lc->ringstream=ring_start(lc->factory, NULL,0,ringcard); ms_filter_call_method(lc->ringstream->gendtmf,MS_DTMF_GEN_SET_DEFAULT_AMPLITUDE,&); lc->dmfs_playing_start_time = ms_get_cur_time_ms()/1000; }else{ @@ -6440,13 +6440,12 @@ static void linphone_core_uninit(LinphoneCore *lc) if (lc->supported_formats) ms_free(lc->supported_formats); linphone_core_message_storage_close(lc); linphone_core_call_log_storage_close(lc); - - lc->factory = ms_factory_exit(lc->factory); - linphone_core_set_state(lc,LinphoneGlobalOff,"Off"); linphone_core_deactivate_log_serialization_if_needed(); ms_list_free_with_data(lc->vtable_refs,(void (*)(void *))v_table_reference_destroy); + + ms_factory_destroy(lc->factory); } static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable, time_t curtime){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 31aee17a5..bf8e5af31 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -41,11 +41,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define LINPHONE_PUBLIC MS2_PUBLIC #endif -#ifndef LINPHONE_DEPRECATED +#ifndef MS2_DEPRECATED #if defined(_MSC_VER) - #define LINPHONE_DEPRECATED __declspec(deprecated) + #define MS2_DEPRECATED __declspec(deprecated) #else - #define LINPHONE_DEPRECATED __attribute__ ((deprecated)) + #define MS2_DEPRECATED __attribute__ ((deprecated)) #endif #endif @@ -627,7 +627,7 @@ typedef struct _LinphonePlayer LinphonePlayer; **/ typedef void (*LinphonePlayerEofCallback)(struct _LinphonePlayer *obj, void *user_data); -LINPHONE_PUBLIC int linphone_player_open(MSFactory* f, LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data); +LINPHONE_PUBLIC int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data); LINPHONE_PUBLIC int linphone_player_start(LinphonePlayer *obj); LINPHONE_PUBLIC int linphone_player_pause(LinphonePlayer *obj); LINPHONE_PUBLIC int linphone_player_seek(LinphonePlayer *obj, int time_ms); @@ -896,7 +896,7 @@ LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call * @deprecated Use linphone_call_get_conference() instead. * @ingroup call_control */ -LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_call_is_in_conference(const LinphoneCall *call); +LINPHONE_PUBLIC MS2_DEPRECATED bool_t linphone_call_is_in_conference(const LinphoneCall *call); /** * Return the associated conference object @@ -1336,7 +1336,7 @@ LINPHONE_PUBLIC bool_t linphone_core_chat_enabled(const LinphoneCore *lc); * @param cr #LinphoneChatRoom object * @deprecated Use linphone_chat_room_unref() instead. */ -LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_room_destroy(LinphoneChatRoom *cr); +LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_room_destroy(LinphoneChatRoom *cr); /** * Create a message attached to a dedicated chat room; * @param cr the chat room. @@ -1406,7 +1406,7 @@ LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_room_get_peer_address(Linph * @param cr #LinphoneChatRoom object * @param msg message to be sent */ -LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg); +LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg); /** * Send a message to peer member of this chat room. * @param cr #LinphoneChatRoom object @@ -1417,7 +1417,7 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_room_send_message(Linphon * @note The LinphoneChatMessage must not be destroyed until the the callback is called. * The LinphoneChatMessage reference is transfered to the function and thus doesn't need to be unref'd by the application. */ -LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangedCb status_cb,void* ud); +LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangedCb status_cb,void* ud); /** * Send a message to peer member of this chat room. * @param[in] cr LinphoneChatRoom object @@ -1492,7 +1492,7 @@ LINPHONE_PUBLIC int linphone_chat_room_get_unread_messages_count(LinphoneChatRoo * Returns back pointer to LinphoneCore object. * @deprecated use linphone_chat_room_get_core() **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr); +LINPHONE_PUBLIC MS2_DEPRECATED LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr); /** * Returns back pointer to LinphoneCore object. **/ @@ -1601,7 +1601,7 @@ LINPHONE_PUBLIC const LinphoneContent* linphone_chat_message_get_file_transfer_i * @param status_cb LinphoneChatMessageStateChangeCb status callback invoked when file is downloaded or could not be downloaded * @deprecated Use linphone_chat_message_download_file() instead. */ -LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_message_start_file_download(LinphoneChatMessage* message, LinphoneChatMessageStateChangedCb status_cb, void* ud); +LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_message_start_file_download(LinphoneChatMessage* message, LinphoneChatMessageStateChangedCb status_cb, void* ud); /** * Start the download of the file referenced in a LinphoneChatMessage from remote server. * @param[in] message LinphoneChatMessage object. @@ -2091,15 +2091,15 @@ typedef struct _LinphoneCoreVTable{ LinphoneCoreNotifyReceivedCb notify_received; /**< Notifies a an event notification, see linphone_core_subscribe() */ LinphoneCorePublishStateChangedCb publish_state_changed;/**Notifies publish state change (only from #LinphoneEvent api)*/ LinphoneCoreConfiguringStatusCb configuring_status; /** Notifies configuring status changes */ - LINPHONE_DEPRECATED DisplayStatusCb display_status; /**< @deprecated Callback that notifies various events with human readable text.*/ - LINPHONE_DEPRECATED DisplayMessageCb display_message;/**< @deprecated Callback to display a message to the user */ - LINPHONE_DEPRECATED DisplayMessageCb display_warning;/**< @deprecated Callback to display a warning to the user */ - LINPHONE_DEPRECATED DisplayUrlCb display_url; /**< @deprecated */ - LINPHONE_DEPRECATED ShowInterfaceCb show; /**< @deprecated Notifies the application that it should show up*/ - LINPHONE_DEPRECATED LinphoneCoreTextMessageReceivedCb text_received; /**< @deprecated, use #message_received instead
A text message has been received */ - LINPHONE_DEPRECATED LinphoneCoreFileTransferRecvCb file_transfer_recv; /**< @deprecated Callback to store file received attached to a #LinphoneChatMessage */ - LINPHONE_DEPRECATED LinphoneCoreFileTransferSendCb file_transfer_send; /**< @deprecated Callback to collect file chunk to be sent for a #LinphoneChatMessage */ - LINPHONE_DEPRECATED LinphoneCoreFileTransferProgressIndicationCb file_transfer_progress_indication; /**< @deprecated Callback to indicate file transfer progress */ + MS2_DEPRECATED DisplayStatusCb display_status; /**< @deprecated Callback that notifies various events with human readable text.*/ + MS2_DEPRECATED DisplayMessageCb display_message;/**< @deprecated Callback to display a message to the user */ + MS2_DEPRECATED DisplayMessageCb display_warning;/**< @deprecated Callback to display a warning to the user */ + MS2_DEPRECATED DisplayUrlCb display_url; /**< @deprecated */ + MS2_DEPRECATED ShowInterfaceCb show; /**< @deprecated Notifies the application that it should show up*/ + MS2_DEPRECATED LinphoneCoreTextMessageReceivedCb text_received; /**< @deprecated, use #message_received instead
A text message has been received */ + MS2_DEPRECATED LinphoneCoreFileTransferRecvCb file_transfer_recv; /**< @deprecated Callback to store file received attached to a #LinphoneChatMessage */ + MS2_DEPRECATED LinphoneCoreFileTransferSendCb file_transfer_send; /**< @deprecated Callback to collect file chunk to be sent for a #LinphoneChatMessage */ + MS2_DEPRECATED LinphoneCoreFileTransferProgressIndicationCb file_transfer_progress_indication; /**< @deprecated Callback to indicate file transfer progress */ LinphoneCoreNetworkReachableCb network_reachable; /**< Callback to report IP network status (I.E up/down )*/ LinphoneCoreLogCollectionUploadStateChangedCb log_collection_upload_state_changed; /**< Callback to upload collected logs */ LinphoneCoreLogCollectionUploadProgressIndicationCb log_collection_upload_progress_indication; /**< Callback to indicate log collection upload progress */ @@ -2357,11 +2357,11 @@ LINPHONE_PUBLIC const char *linphone_core_get_user_agent(LinphoneCore *lc); /** * @deprecated Use #linphone_core_get_user_agent instead. **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED const char *linphone_core_get_user_agent_name(void); +LINPHONE_PUBLIC MS2_DEPRECATED const char *linphone_core_get_user_agent_name(void); /** * @deprecated Use #linphone_core_get_user_agent instead. **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED const char *linphone_core_get_user_agent_version(void); +LINPHONE_PUBLIC MS2_DEPRECATED const char *linphone_core_get_user_agent_version(void); /** * Instanciates a LinphoneCore object. @@ -2533,7 +2533,7 @@ LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address2(Linphone * @param dtmf The dtmf name specified as a char, such as '0', '#' etc... * **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf); +LINPHONE_PUBLIC MS2_DEPRECATED void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf); /** * Sets the local "from" identity. @@ -2906,7 +2906,7 @@ LINPHONE_PUBLIC void linphone_core_set_default_proxy_index(LinphoneCore *lc, int * @return the default proxy configuration, that is the one used to determine the current identity. * @deprecated Use linphone_core_get_default_proxy_config() instead. **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config); +LINPHONE_PUBLIC MS2_DEPRECATED int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config); /** * @return the default proxy configuration, that is the one used to determine the current identity. @@ -3241,7 +3241,10 @@ LINPHONE_PUBLIC void linphone_core_set_ring_during_incoming_early_media(Linphone LINPHONE_PUBLIC bool_t linphone_core_get_ring_during_incoming_early_media(const LinphoneCore *lc); LINPHONE_PUBLIC int linphone_core_preview_ring(LinphoneCore *lc, const char *ring,LinphoneCoreCbFunc func,void * userdata); -LINPHONE_PUBLIC MSFactory* linphone_core_get_factory(void* lc); +/** + * Returns the MSFactory (mediastreamer2 factory) used by the LinphoneCore to control mediastreamer2 library. +**/ +LINPHONE_PUBLIC MSFactory* linphone_core_get_ms_factory(LinphoneCore* lc); LINPHONE_PUBLIC int linphone_core_play_local(LinphoneCore *lc, const char *audiofile); LINPHONE_PUBLIC void linphone_core_enable_echo_cancellation(LinphoneCore *lc, bool_t val); LINPHONE_PUBLIC bool_t linphone_core_echo_cancellation_enabled(LinphoneCore *lc); @@ -3268,13 +3271,13 @@ bool_t linphone_core_agc_enabled(const LinphoneCore *lc); /** * @deprecated Use #linphone_core_enable_mic instead. **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted); +LINPHONE_PUBLIC MS2_DEPRECATED void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted); /** * Get mic state. * @deprecated Use #linphone_core_mic_enabled instead **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_core_is_mic_muted(LinphoneCore *lc); +LINPHONE_PUBLIC MS2_DEPRECATED bool_t linphone_core_is_mic_muted(LinphoneCore *lc); /** * Enable or disable the microphone. @@ -3402,7 +3405,7 @@ LINPHONE_PUBLIC bool_t linphone_core_video_supported(LinphoneCore *lc); * @ingroup media_parameters * @deprecated Use #linphone_core_enable_video_capture and #linphone_core_enable_video_display instead. **/ -LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled); +LINPHONE_PUBLIC MS2_DEPRECATED void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled); /** * Returns TRUE if either capture or display is enabled, FALSE otherwise. @@ -4392,7 +4395,7 @@ LINPHONE_PUBLIC LinphoneTransportType linphone_transport_parse(const char* trans * @return LinphoneCallParams * @deprecated use linphone_core_create_call_params() */ -LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc); +LINPHONE_PUBLIC MS2_DEPRECATED LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc); typedef struct _LinphoneRingtonePlayer LinphoneRingtonePlayer; diff --git a/coreapi/localplayer.c b/coreapi/localplayer.c index 91ce833a9..a741a0a9b 100644 --- a/coreapi/localplayer.c +++ b/coreapi/localplayer.c @@ -21,7 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include -static int _local_player_open(LinphonePlayer *obj, const char *filename, MSFactory *factory); +static int _local_player_open(LinphonePlayer *obj, const char *filename); static int _local_player_start(LinphonePlayer *obj); static int _local_player_pause(LinphonePlayer *obj); static int _local_player_seek(LinphonePlayer *obj, int time_ms); @@ -36,7 +36,7 @@ LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *s LinphonePlayer *obj = ms_new0(LinphonePlayer, 1); if(snd_card == NULL) snd_card = lc->sound_conf.ring_sndcard; if(video_out == NULL) video_out = linphone_core_get_video_display_filter(lc); - obj->impl = ms_media_player_new(snd_card, video_out, window_id); + obj->impl = ms_media_player_new(lc->factory, snd_card, video_out, window_id); obj->open = _local_player_open; obj->start = _local_player_start; obj->pause = _local_player_pause; @@ -54,8 +54,8 @@ bool_t linphone_local_player_matroska_supported(void) { return ms_media_player_matroska_supported(); } -static int _local_player_open(LinphonePlayer *obj, const char *filename,MSFactory* factory) { - return ms_media_player_open((MSMediaPlayer *)obj->impl, filename, factory) ? 0 : -1; +static int _local_player_open(LinphonePlayer *obj, const char *filename) { + return ms_media_player_open((MSMediaPlayer *)obj->impl, filename) ? 0 : -1; } static int _local_player_start(LinphonePlayer *obj) { diff --git a/coreapi/lsd.c b/coreapi/lsd.c index b2000632d..dd28511a5 100644 --- a/coreapi/lsd.c +++ b/coreapi/lsd.c @@ -61,7 +61,7 @@ struct _LinphoneSoundDaemon { static MSFilter *create_writer(MSSndCard *c){ LinphoneSoundDaemon *lsd=(LinphoneSoundDaemon*)c->data; - MSFilter *itcsink=ms_factory_create_filter(ms_snd_card_factory_get(c), MS_ITC_SINK_ID); + MSFilter *itcsink=ms_factory_create_filter(ms_snd_card_get_factory(c), MS_ITC_SINK_ID); ms_filter_call_method(itcsink,MS_ITC_SINK_CONNECT,lsd->branches[0].player); return itcsink; } @@ -223,11 +223,11 @@ LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char * int i; MSConnectionPoint mp; LinphoneSoundDaemon *lsd; - MSSndCard *card=ms_snd_card_manager_get_card(ms_factory_get_snd_manager(factory), + MSSndCard *card=ms_snd_card_manager_get_card(ms_factory_get_snd_card_manager(factory), cardname); if (card==NULL){ card=ms_snd_card_manager_get_default_playback_card ( - ms_factory_get_snd_manager(factory)); + ms_factory_get_snd_card_manager(factory)); if (card==NULL){ ms_error("linphone_sound_daemon_new(): No playback soundcard available"); return NULL; @@ -236,7 +236,7 @@ LinphoneSoundDaemon * linphone_sound_daemon_new(MSFactory* factory, const char * lsd=ms_new0(LinphoneSoundDaemon,1); lsd->soundout=ms_snd_card_create_writer(card); - lsd->mixer=ms_factory_create_filter(ms_snd_card_factory_get(card),MS_AUDIO_MIXER_ID); + lsd->mixer=ms_factory_create_filter(ms_snd_card_get_factory(card),MS_AUDIO_MIXER_ID); lsd->out_rate=rate; lsd->out_nchans=nchannels; ms_filter_call_method(lsd->soundout,MS_FILTER_SET_SAMPLE_RATE,&lsd->out_rate); diff --git a/coreapi/player.c b/coreapi/player.c index 8c9913ab6..668b91c01 100644 --- a/coreapi/player.c +++ b/coreapi/player.c @@ -28,10 +28,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * @param user_data a user-data provided in the callback to help the application to retrieve its context. * @return 0 if successful, -1 otherwise **/ -int linphone_player_open(MSFactory *f, LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback cb, void *user_data){ +int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback cb, void *user_data){ obj->user_data=user_data; obj->cb=cb; - return obj->open(obj,filename, f); + return obj->open(obj,filename); } /** @@ -137,7 +137,7 @@ static void on_eof(void *user_data, MSFilter *f, unsigned int event_id, void *ar if (player->cb) player->cb(player,player->user_data); } -static int call_player_open(LinphonePlayer* player, const char *filename, MSFactory *factory){ +static int call_player_open(LinphonePlayer* player, const char *filename){ LinphoneCall *call=(LinphoneCall*)player->impl; MSFilter *filter; if (!call_player_check_state(player,FALSE)) return -1; diff --git a/coreapi/private.h b/coreapi/private.h index 8cb2d030a..7236d025f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -1235,7 +1235,7 @@ LINPHONE_PUBLIC int linphone_remote_provisioning_load_file( LinphoneCore* lc, co ****************************************************************************/ struct _LinphonePlayer{ - int (*open)(struct _LinphonePlayer* player, const char *filename, MSFactory *factory); + int (*open)(struct _LinphonePlayer* player, const char *filename); int (*start)(struct _LinphonePlayer* player); int (*pause)(struct _LinphonePlayer* player); int (*seek)(struct _LinphonePlayer* player, int time_ms); diff --git a/gtk/audio_assistant.c b/gtk/audio_assistant.c index a3f765a27..e3166b4a4 100644 --- a/gtk/audio_assistant.c +++ b/gtk/audio_assistant.c @@ -211,15 +211,15 @@ static gboolean linphone_gtk_stop_record(gpointer data){ void linphone_gtk_start_record_sound(GtkWidget *w, gpointer data){ LinphoneCore *lc = linphone_gtk_get_core(); - MSFactory *factory = linphone_core_get_factory((void*)lc); + MSFactory *factory = linphone_core_get_ms_factory(lc); AudioStream *stream = NULL; - MSSndCardManager *manager = ms_factory_get_snd_manager(factory); + MSSndCardManager *manager = ms_factory_get_snd_card_manager(factory); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); gint timeout_id; if(active){ gchar *path = get_record_file(); - stream=audio_stream_new(8888, 8889, FALSE, factory); + stream=audio_stream_new(factory, 8888, 8889, FALSE); if(stream != NULL){ audio_stream_start_full(stream,&av_profile,"127.0.0.1",8888,"127.0.0.1",8889,0,0,NULL, path,NULL,ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE); @@ -256,14 +256,14 @@ static void endoffile_cb(void *ud, MSFilter *f, unsigned int ev,void * arg){ void linphone_gtk_start_play_record_sound(GtkWidget *w,gpointer data){ LinphoneCore *lc = linphone_gtk_get_core(); - MSFactory *factory = linphone_core_get_factory((void*)lc); + MSFactory *factory = linphone_core_get_ms_factory(lc); gboolean active=gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w)); AudioStream *stream = NULL; - MSSndCardManager *manager = ms_factory_get_snd_manager(factory); + MSSndCardManager *manager = ms_factory_get_snd_card_manager(factory); if(active){ gchar *path = g_object_get_data(G_OBJECT(audio_assistant),"path"); - stream=audio_stream_new(8888, 8889, FALSE, factory); + stream=audio_stream_new(factory, 8888, 8889, FALSE); if(path != NULL){ audio_stream_start_full(stream,&av_profile,"127.0.0.1",8888,"127.0.0.1",8889,0,0,path, NULL,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),NULL,FALSE); @@ -448,15 +448,15 @@ static GtkWidget *create_end_page(void){ static void prepare(GtkAssistant *w){ AudioStream *audio_stream = NULL; LinphoneCore *lc=linphone_gtk_get_core(); - MSFactory *factory = linphone_core_get_factory((void*)lc); + MSFactory *factory = linphone_core_get_ms_factory(lc); int page = gtk_assistant_get_current_page(w); GtkWidget *mic_audiolevel = get_widget_from_assistant("mic_audiolevel"); GtkWidget *label_audiolevel = get_widget_from_assistant("label_audiolevel"); //Speaker page if(page == 1){ - MSSndCardManager *manager = ms_factory_get_snd_manager(factory); - audio_stream = audio_stream_start_with_sndcards(&av_profile,9898,"127.0.0.1",19898,0,0,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE, factory); + MSSndCardManager *manager = ms_factory_get_snd_card_manager(factory); + audio_stream = audio_stream_start_with_sndcards(factory, &av_profile,9898,"127.0.0.1",19898,0,0,ms_snd_card_manager_get_card(manager,linphone_core_get_playback_device(lc)),ms_snd_card_manager_get_card(manager,linphone_core_get_capture_device(lc)),FALSE); if (mic_audiolevel != NULL && audio_stream != NULL){ g_object_set_data(G_OBJECT(audio_assistant),"stream",audio_stream); linphone_gtk_init_audio_meter(mic_audiolevel,(get_volume_t)audio_stream_get_record_volume,audio_stream); diff --git a/gtk/propertybox.c b/gtk/propertybox.c index fa2898e3d..b826029c8 100644 --- a/gtk/propertybox.c +++ b/gtk/propertybox.c @@ -1417,7 +1417,7 @@ void linphone_gtk_fill_webcams(GtkWidget *pb){ void linphone_gtk_fill_video_renderers(GtkWidget *pb){ #ifdef VIDEO_ENABLED /* video_stream_get_default_video_renderer requires video enabled */ LinphoneCore *lc=linphone_gtk_get_core(); - MSFactory *factory = linphone_core_get_factory((void*)lc); + MSFactory *factory = linphone_core_get_ms_factory(lc); GtkWidget *combo=linphone_gtk_get_widget(pb,"renderers"); MSList *l=ms_factory_lookup_filter_by_interface(factory, MSFilterVideoDisplayInterface); MSList *elem; diff --git a/gtk/videowindow.c b/gtk/videowindow.c index 0cf6ac5d3..86c84ac5a 100644 --- a/gtk/videowindow.c +++ b/gtk/videowindow.c @@ -63,7 +63,7 @@ static void drag_data_received(GtkWidget *widget, GdkDragContext *context, gint if (player){ const char* filepath = (strstr(path,"file://")==path) ? path+strlen("file://") : path; - if (linphone_player_open(linphone_core_get_factory((void*)linphone_call_get_core(call)),player,filepath,on_end_of_play,NULL)==0){ + if (linphone_player_open(player,filepath,on_end_of_play,NULL)==0){ linphone_player_start(player); }else{ diff --git a/mediastreamer2 b/mediastreamer2 index b2eb303aa..483fcd85d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b2eb303aabac2620b80f366d4aab50d38d7acc86 +Subproject commit 483fcd85d98ffdf220e37195575c6dd8209e7d6b diff --git a/tester/call_tester.c b/tester/call_tester.c index ab0491710..0e0f58674 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -2917,7 +2917,7 @@ static void call_with_file_player(void) { player=linphone_call_get_player(linphone_core_get_current_call(marie->lc)); BC_ASSERT_PTR_NOT_NULL(player); if (player){ - BC_ASSERT_EQUAL(linphone_player_open(marie->lc->factory, player,hellopath,on_eof,marie),0, int, "%d"); + BC_ASSERT_EQUAL(linphone_player_open(player,hellopath,on_eof,marie),0, int, "%d"); BC_ASSERT_EQUAL(linphone_player_start(player),0, int, "%d"); } /* This assert should be modified to be at least as long as the WAV file */ @@ -2983,7 +2983,7 @@ static void call_with_mkv_file_player(void) { player=linphone_call_get_player(linphone_core_get_current_call(marie->lc)); BC_ASSERT_PTR_NOT_NULL(player); if (player){ - int res = linphone_player_open(marie->lc->factory, player,hellomkv,on_eof,marie); + int res = linphone_player_open(player,hellomkv,on_eof,marie); //if(!ms_filter_codec_supported("opus")) { if(!ms_factory_codec_supported(marie->lc->factory, "opus") && !ms_factory_codec_supported(pauline->lc->factory, "opus")){ BC_ASSERT_EQUAL(res, -1, int, "%d"); @@ -5047,7 +5047,7 @@ static void call_with_rtp_io_mode(void) { player = linphone_call_get_player(linphone_core_get_current_call(marie->lc)); BC_ASSERT_PTR_NOT_NULL(player); if (player) { - BC_ASSERT_EQUAL(linphone_player_open(marie->lc->factory, player, hellopath, on_eof, marie) , 0, int, "%d"); + BC_ASSERT_EQUAL(linphone_player_open(player, hellopath, on_eof, marie) , 0, int, "%d"); BC_ASSERT_EQUAL(linphone_player_start(player) , 0, int, "%d"); } @@ -5339,7 +5339,7 @@ static void custom_rtp_modifier(bool_t pauseResumeTest, bool_t recordTest) { BC_ASSERT_PTR_NOT_NULL(player); if (player) { // This will ask pauline to play the file - BC_ASSERT_EQUAL(linphone_player_open(marie->lc->factory,player, hellopath, on_eof, pauline),0, int, "%d"); + BC_ASSERT_EQUAL(linphone_player_open(player, hellopath, on_eof, pauline),0, int, "%d"); BC_ASSERT_EQUAL(linphone_player_start(player), 0, int, "%d"); } /* This assert should be modified to be at least as long as the WAV file */ diff --git a/tester/player_tester.c b/tester/player_tester.c index 1575531aa..7625329ed 100644 --- a/tester/player_tester.c +++ b/tester/player_tester.c @@ -44,16 +44,16 @@ static void play_file(const char *filename, bool_t supported_format, const char BC_ASSERT_PTR_NOT_NULL(lc_manager); if(lc_manager == NULL) return; - audio_codec_supported = (audio_mime && ms_factory_get_decoder(linphone_core_get_factory((void *)lc_manager->lc), audio_mime)); - video_codec_supported = (video_mime && ms_factory_get_decoder(linphone_core_get_factory((void *)lc_manager->lc), video_mime)); + audio_codec_supported = (audio_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), audio_mime)); + video_codec_supported = (video_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), video_mime)); player = linphone_core_create_local_player(lc_manager->lc, - ms_snd_card_manager_get_default_card(ms_factory_get_snd_manager(linphone_core_get_factory((void *)lc_manager->lc))), + ms_snd_card_manager_get_default_card(ms_factory_get_snd_card_manager(linphone_core_get_ms_factory((void *)lc_manager->lc))), video_stream_get_default_video_renderer(), 0); BC_ASSERT_PTR_NOT_NULL(player); if(player == NULL) goto fail; - res = linphone_player_open(linphone_core_get_factory((void*)lc_manager->lc), player, filename, eof_callback, &eof); + res = linphone_player_open(player, filename, eof_callback, &eof); if(supported_format && (audio_codec_supported || video_codec_supported)) { BC_ASSERT_EQUAL(res, 0, int, "%d"); } else { diff --git a/tester/tester.c b/tester/tester.c index 08f010dc0..510f5d3b4 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -296,13 +296,13 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) { { MSWebCam *cam; - cam = ms_web_cam_manager_get_cam(ms_factory_get_wbc_manager(mgr->lc->factory), "Mire: Mire (synthetic moving picture)"); + cam = ms_web_cam_manager_get_cam(ms_factory_get_web_cam_manager(mgr->lc->factory), "Mire: Mire (synthetic moving picture)"); if (cam == NULL) { MSWebCamDesc *desc = ms_mire_webcam_desc_get(); if (desc){ cam=ms_web_cam_new(desc); - ms_web_cam_manager_add_cam(ms_factory_get_wbc_manager(mgr->lc->factory), cam); + ms_web_cam_manager_add_cam(ms_factory_get_web_cam_manager(mgr->lc->factory), cam); } } } diff --git a/tools/auto_answer.c b/tools/auto_answer.c index d39a70fd3..133b88d84 100644 --- a/tools/auto_answer.c +++ b/tools/auto_answer.c @@ -164,7 +164,7 @@ int main(int argc, char *argv[]){ { MSWebCamDesc *desc = ms_mire_webcam_desc_get(); if (desc){ - ms_web_cam_manager_add_cam(ms_factory_get_wbc_manager(linphone_core_get_factory((void*)lc)),ms_web_cam_new(desc)); + ms_web_cam_manager_add_cam(ms_factory_get_web_cam_manager(linphone_core_get_ms_factory(lc)),ms_web_cam_new(desc)); linphone_core_set_video_device(lc,"Mire: Mire (synthetic moving picture)"); } } diff --git a/tools/test_lsd.c b/tools/test_lsd.c index ed38fedde..9c308cb04 100644 --- a/tools/test_lsd.c +++ b/tools/test_lsd.c @@ -51,7 +51,7 @@ int main(int argc, char *argv[]) { linphone_core_enable_logs(stdout); lc = linphone_core_new(&vtable, NULL, NULL, NULL); - lsd = linphone_sound_daemon_new(NULL, 44100, 1); + lsd = linphone_sound_daemon_new(linphone_core_get_ms_factory(lc), NULL, 44100, 1); linphone_core_use_sound_daemon(lc, lsd); From 779de0f0b537bd744a5b416d8d29e107607aadfa Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Mon, 1 Feb 2016 16:30:52 +0100 Subject: [PATCH 37/56] Updating mediastreamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 483fcd85d..8c6bf3d3b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 483fcd85d98ffdf220e37195575c6dd8209e7d6b +Subproject commit 8c6bf3d3b2b17a79b8fdb18ed128be1a8fd76152 From 943a463933b72e9fe9aad1b55717907a5a469a1f Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 1 Feb 2016 21:41:02 +0100 Subject: [PATCH 38/56] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 8c6bf3d3b..6e446f4bf 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 8c6bf3d3b2b17a79b8fdb18ed128be1a8fd76152 +Subproject commit 6e446f4bfc2e245c47e90ea9aa78217f5066cdf0 From ca8d64d592161d1f83f3b72a215f2b11c1eb2d9a Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 2 Feb 2016 10:40:14 +0100 Subject: [PATCH 39/56] Update mediastreamer --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 6e446f4bf..cb1ea6ee2 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 6e446f4bfc2e245c47e90ea9aa78217f5066cdf0 +Subproject commit cb1ea6ee25710bbe2b831c294f8e9703738bf2c1 From b4452da58d5ad1b078f5d306fa53d31defa964c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Mon, 1 Feb 2016 11:26:35 +0100 Subject: [PATCH 40/56] Release the reference on the focus call when thatone fails --- coreapi/conference.cc | 219 +++++++++++++++++++++++------------ coreapi/conference.h | 12 +- coreapi/conference_private.h | 37 ++++++ coreapi/linphonecore.c | 28 ++++- tester/liblinphone_tester.h | 3 +- tester/multi_call_tester.c | 61 ++++++++-- tester/tester.c | 21 +++- 7 files changed, 288 insertions(+), 93 deletions(-) diff --git a/coreapi/conference.cc b/coreapi/conference.cc index 50dd57c2d..a59608b43 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -32,31 +32,39 @@ namespace Linphone { -class Participant { -public: - Participant(LinphoneCall *call); - Participant(const Participant &src); - ~Participant(); - bool operator==(const Participant &src) const; - const LinphoneAddress *getUri() const {return m_uri;} - LinphoneCall *getCall() const {return m_call;} - void setCall(LinphoneCall *call) {m_call = call;} - -private: - LinphoneAddress *m_uri; - LinphoneCall *m_call; -}; - class Conference { public: + class Participant { + public: + Participant(LinphoneCall *call); + Participant(const Participant &src); + ~Participant(); + bool operator==(const Participant &src) const; + const LinphoneAddress *getUri() const {return m_uri;} + LinphoneCall *getCall() const {return m_call;} + void setCall(LinphoneCall *call) {m_call = call;} + + private: + LinphoneAddress *m_uri; + LinphoneCall *m_call; + }; + class Params { public: Params(const LinphoneCore *core = NULL); void enableVideo(bool enable) {m_enableVideo = enable;} bool videoRequested() const {return m_enableVideo;} + void setStateChangedCallback(LinphoneConferenceStateChangedCb cb, void *user_data) { + m_state_changed_cb=cb; + m_user_data=user_data; + } private: bool m_enableVideo; + LinphoneConferenceStateChangedCb m_state_changed_cb; + void *m_user_data; + + friend class Conference; }; Conference(LinphoneCore *core, const Params *params = NULL); @@ -88,14 +96,19 @@ public: virtual void onCallStreamStopping(LinphoneCall *call) {}; virtual void onCallTerminating(LinphoneCall *call) {}; + LinphoneConferenceState getState() const {return m_state;} + static const char *stateToString(LinphoneConferenceState state); + protected: const Participant *findParticipant(const LinphoneAddress* uri) const; + void setState(LinphoneConferenceState state); LinphoneCore *m_core; AudioStream *m_localParticipantStream; bool m_isMuted; std::list m_participants; Params m_currentParams; + LinphoneConferenceState m_state; }; class LocalConference: public Conference { @@ -153,12 +166,9 @@ public: virtual int stopRecording() {return 0;} private: - enum State { - NotConnectedToFocus, - ConnectingToFocus, - ConnectedToFocus, - }; - static const char *stateToString(State state); + bool focusIsReady() const; + bool transferToFocus(LinphoneCall *call); + void reset(); void onFocusCallSateChanged(LinphoneCallState state); void onPendingCallStateChanged(LinphoneCall *call, LinphoneCallState state); @@ -170,10 +180,10 @@ private: const char *m_focusAddr; char *m_focusContact; LinphoneCall *m_focusCall; - State m_state; LinphoneCoreVTable *m_vtable; MSList *m_pendingCalls; MSList *m_transferingCalls; + bool m_isTerminating; }; }; @@ -183,22 +193,22 @@ using namespace Linphone; using namespace std; -Participant::Participant(LinphoneCall *call) { +Conference::Participant::Participant(LinphoneCall *call) { m_uri = linphone_address_clone(linphone_call_get_remote_address(call)); m_call = linphone_call_ref(call); } -Participant::Participant(const Participant &src) { +Conference::Participant::Participant(const Participant &src) { m_uri = linphone_address_clone(src.m_uri); m_call = src.m_call ? linphone_call_ref(src.m_call) : NULL; } -Participant::~Participant() { +Conference::Participant::~Participant() { linphone_address_unref(m_uri); if(m_call) linphone_call_unref(m_call); } -bool Participant::operator==(const Participant &src) const { +bool Conference::Participant::operator==(const Participant &src) const { return linphone_address_equal(m_uri, src.m_uri); } @@ -216,7 +226,9 @@ Conference::Params::Params(const LinphoneCore *core): m_enableVideo(false) { Conference::Conference(LinphoneCore *core, const Conference::Params *params): m_core(core), m_localParticipantStream(NULL), - m_isMuted(false) { + m_isMuted(false), + m_currentParams(), + m_state(LinphoneConferenceStopped) { if(params) m_currentParams = *params; } @@ -275,7 +287,19 @@ float Conference::getInputVolume() const { return LINPHONE_VOLUME_DB_LOWEST; } -const Participant *Conference::findParticipant(const LinphoneAddress *uri) const { +const char *Conference::stateToString(LinphoneConferenceState state) { + switch(state) { + case LinphoneConferenceStopped: return "Stopped"; + case LinphoneConferenceStarting: return "Starting"; + case LinphoneConferenceReady: return "Ready"; + case LinphoneConferenceStartingFailed: return "Startig failed"; + default: return "Invalid state"; + } +} + + + +const Conference::Participant *Conference::findParticipant(const LinphoneAddress *uri) const { list::const_iterator it = m_participants.begin(); while(it!=m_participants.end()) { if(linphone_address_equal(uri, it->getUri())) break; @@ -285,6 +309,17 @@ const Participant *Conference::findParticipant(const LinphoneAddress *uri) const else return &*it; } +void Conference::setState(LinphoneConferenceState state) { + if(m_state != state) { + ms_message("Switching conference [%p] into state '%s'", this, stateToString(state)); + m_state = state; + if(m_currentParams.m_state_changed_cb) { + m_currentParams.m_state_changed_cb((LinphoneConference *)this, state, m_currentParams.m_user_data); + } + } +} + + LocalConference::LocalConference(LinphoneCore *core, const Conference::Params *params): @@ -298,7 +333,7 @@ LocalConference::LocalConference(LinphoneCore *core, const Conference::Params *p MSAudioConferenceParams ms_conf_params; ms_conf_params.samplerate = lp_config_get_int(m_core->config, "sound","conference_rate",16000); m_conf=ms_audio_conference_new(&ms_conf_params, core->factory); - + m_state=LinphoneConferenceReady; } LocalConference::~LocalConference() { @@ -587,10 +622,10 @@ RemoteConference::RemoteConference(LinphoneCore *core, const Conference::Params m_focusAddr(NULL), m_focusContact(NULL), m_focusCall(NULL), - m_state(NotConnectedToFocus), m_vtable(NULL), m_pendingCalls(NULL), - m_transferingCalls(NULL) { + m_transferingCalls(NULL), + m_isTerminating(false) { m_focusAddr = lp_config_get_string(m_core->config, "misc", "conference_focus_addr", ""); m_vtable = linphone_core_v_table_new(); m_vtable->call_state_changed = callStateChangedCb; @@ -600,7 +635,7 @@ RemoteConference::RemoteConference(LinphoneCore *core, const Conference::Params } RemoteConference::~RemoteConference() { - if(m_state == ConnectedToFocus) terminate(); + terminate(); linphone_core_remove_listener(m_core, m_vtable); linphone_core_v_table_destroy(m_vtable); } @@ -610,34 +645,38 @@ int RemoteConference::addParticipant(LinphoneCall *call) { LinphoneCallParams *params; switch(m_state) { - case NotConnectedToFocus: + case LinphoneConferenceStopped: + case LinphoneConferenceStartingFailed: Conference::addParticipant(call); ms_message("Calling the conference focus (%s)", m_focusAddr); addr = linphone_address_new(m_focusAddr); if(addr) { params = linphone_core_create_call_params(m_core, NULL); linphone_call_params_enable_video(params, m_currentParams.videoRequested()); - m_focusCall = linphone_call_ref(linphone_core_invite_address_with_params(m_core, addr, params)); + m_focusCall = linphone_core_invite_address_with_params(m_core, addr, params); m_focusCall->conf_ref = (LinphoneConference *)this; m_localParticipantStream = m_focusCall->audiostream; m_pendingCalls = ms_list_append(m_pendingCalls, call); - m_state = ConnectingToFocus; LinphoneCallLog *callLog = linphone_call_get_call_log(m_focusCall); callLog->was_conference = TRUE; linphone_address_unref(addr); linphone_call_params_unref(params); + setState(LinphoneConferenceStarting); return 0; } else return -1; - case ConnectingToFocus: + case LinphoneConferenceStarting: Conference::addParticipant(call); - m_pendingCalls = ms_list_append(m_pendingCalls, call); + if(focusIsReady()) { + transferToFocus(call); + } else { + m_pendingCalls = ms_list_append(m_pendingCalls, call); + } return 0; - case ConnectedToFocus: + case LinphoneConferenceReady: Conference::addParticipant(call); - m_transferingCalls = ms_list_append(m_transferingCalls, call); - linphone_core_transfer_call(m_core, call, m_focusContact); + transferToFocus(call); return 0; default: @@ -651,15 +690,21 @@ int RemoteConference::removeParticipant(const LinphoneAddress *uri) { int res; switch(m_state) { - case ConnectedToFocus: + case LinphoneConferenceReady: tmp = linphone_address_as_string_uri_only(uri); refer_to = ms_strdup_printf("%s;method=BYE", tmp); res = sal_call_refer(m_focusCall->op, refer_to); ms_free(tmp); ms_free(refer_to); - if(res == 0) return Conference::removeParticipant(uri); - else return -1; + if(res == 0) { + return Conference::removeParticipant(uri); + } else { + char *tmp = linphone_address_as_string(uri); + ms_error("Conference: could not remove participant '%s': REFER with BYE has failed", tmp); + ms_free(tmp); + return -1; + } default: ms_error("Cannot remove %s from conference: Bad conference state (%s)", linphone_address_as_string(uri), stateToString(m_state)); @@ -668,20 +713,25 @@ int RemoteConference::removeParticipant(const LinphoneAddress *uri) { } int RemoteConference::terminate() { + m_isTerminating = true; switch(m_state) { - case ConnectingToFocus: - case ConnectedToFocus: + case LinphoneConferenceReady: + case LinphoneConferenceStarting: linphone_core_terminate_call(m_core, m_focusCall); + reset(); + Conference::terminate(); + setState(LinphoneConferenceStopped); break; + default: break; } - Conference::terminate(); + m_isTerminating = false; return 0; } int RemoteConference::enter() { - if(m_state != ConnectedToFocus) { + if(m_state != LinphoneConferenceReady) { ms_error("Could not enter in the conference: bad conference state (%s)", stateToString(m_state)); return -1; } @@ -699,7 +749,7 @@ int RemoteConference::enter() { } int RemoteConference::leave() { - if(m_state != ConnectedToFocus) { + if(m_state != LinphoneConferenceReady) { ms_error("Could not leave the conference: bad conference state (%s)", stateToString(m_state)); return -1; } @@ -717,26 +767,45 @@ int RemoteConference::leave() { } bool RemoteConference::isIn() const { - if(m_state != ConnectedToFocus) return false; + if(m_state != LinphoneConferenceReady) return false; LinphoneCallState callState = linphone_call_get_state(m_focusCall); return callState == LinphoneCallStreamsRunning; } -const char *RemoteConference::stateToString(RemoteConference::State state) { - switch(state) { - case NotConnectedToFocus: return "NotConnectedToFocus"; - case ConnectingToFocus: return "ConnectingToFocus"; - case ConnectedToFocus: return "ConnectedToFocus"; - default: return "Unknown"; +bool RemoteConference::focusIsReady() const { + LinphoneCallState focusState; + if(m_focusCall == NULL) return false; + focusState = linphone_call_get_state(m_focusCall); + return focusState == LinphoneCallStreamsRunning || focusState == LinphoneCallPaused; +} + +bool RemoteConference::transferToFocus(LinphoneCall *call) { + if(linphone_core_transfer_call(m_core, call, m_focusContact) == 0) { + m_transferingCalls = ms_list_append(m_transferingCalls, call); + return true; + } else { + ms_error("Conference: could not transfer call [%p] to %s", call, m_focusContact); + return false; } } +void RemoteConference::reset() { + m_localParticipantStream = NULL; + m_focusAddr = NULL; + if(m_focusContact) { + ms_free(m_focusContact); + m_focusContact = NULL; + } + m_focusCall = NULL; + m_pendingCalls = ms_list_free(m_pendingCalls); + m_transferingCalls = ms_list_free(m_transferingCalls); +} + void RemoteConference::onFocusCallSateChanged(LinphoneCallState state) { MSList *it; switch (state) { case LinphoneCallConnected: - m_state = ConnectedToFocus; m_focusContact = ms_strdup(linphone_call_get_remote_contact(m_focusCall)); it = m_pendingCalls; while (it) { @@ -746,27 +815,21 @@ void RemoteConference::onFocusCallSateChanged(LinphoneCallState state) { MSList *current_elem = it; it = it->next; m_pendingCalls = ms_list_remove_link(m_pendingCalls, current_elem); - m_transferingCalls = ms_list_append(m_transferingCalls, pendingCall); - linphone_core_transfer_call(m_core, pendingCall, m_focusContact); + transferToFocus(pendingCall); } else { it = it->next; } } + setState(LinphoneConferenceReady); break; case LinphoneCallError: + reset(); + setState(LinphoneConferenceStartingFailed); + break; + case LinphoneCallEnd: - m_state = NotConnectedToFocus; - linphone_call_unref(m_focusCall); - m_focusCall = NULL; - m_localParticipantStream = NULL; - if(m_focusContact) { - ms_free(m_focusContact); - m_focusContact = NULL; - } - m_pendingCalls = ms_list_free(m_pendingCalls); - m_transferingCalls = ms_list_free(m_transferingCalls); - Conference::terminate(); + if(!m_isTerminating) terminate(); break; default: break; @@ -777,7 +840,7 @@ void RemoteConference::onPendingCallStateChanged(LinphoneCall *call, LinphoneCal switch(state) { case LinphoneCallStreamsRunning: case LinphoneCallPaused: - if(m_state == ConnectedToFocus) { + if(m_state == LinphoneConferenceReady) { m_pendingCalls = ms_list_remove(m_pendingCalls, call); m_transferingCalls = ms_list_append(m_transferingCalls, call); linphone_core_transfer_call(m_core, call, m_focusContact); @@ -827,6 +890,10 @@ void RemoteConference::transferStateChanged(LinphoneCore *lc, LinphoneCall *tran +const char *linphone_conference_state_to_string(LinphoneConferenceState state) { + return Conference::stateToString(state); +} + LinphoneConferenceParams *linphone_conference_params_new(const LinphoneCore *core) { return (LinphoneConferenceParams *)new Conference::Params(core); } @@ -847,6 +914,10 @@ bool_t linphone_conference_params_video_requested(const LinphoneConferenceParams return ((Conference::Params *)params)->videoRequested(); } +void linphone_conference_params_set_state_changed_callback(LinphoneConferenceParams *params, LinphoneConferenceStateChangedCb cb, void *user_data) { + ((Conference::Params *)params)->setStateChangedCallback(cb, user_data); +} + LinphoneConference *linphone_local_conference_new(LinphoneCore *core) { @@ -869,6 +940,10 @@ void linphone_conference_free(LinphoneConference *obj) { delete (Conference *)obj; } +LinphoneConferenceState linphone_conference_get_state(const LinphoneConference *obj) { + return ((Conference *)obj)->getState(); +} + int linphone_conference_add_participant(LinphoneConference *obj, LinphoneCall *call) { return ((Conference *)obj)->addParticipant(call); } @@ -918,9 +993,9 @@ int linphone_conference_get_size(const LinphoneConference *obj) { } MSList *linphone_conference_get_participants(const LinphoneConference *obj) { - const list &participants = ((Conference *)obj)->getParticipants(); + const list &participants = ((Conference *)obj)->getParticipants(); MSList *participants_list = NULL; - for(list::const_iterator it=participants.begin();it!=participants.end();it++) { + for(list::const_iterator it=participants.begin();it!=participants.end();it++) { LinphoneAddress *uri = linphone_address_clone(it->getUri()); participants_list = ms_list_append(participants_list, uri); } diff --git a/coreapi/conference.h b/coreapi/conference.h index a043a8a33..cc9762bf1 100644 --- a/coreapi/conference.h +++ b/coreapi/conference.h @@ -37,11 +37,18 @@ extern "C" { * @{ */ +/** + * LinphoneConference class + */ +typedef struct _LinphoneConference LinphoneConference; /** * Parameters for initialization of conferences */ typedef struct _LinphoneCorferenceParams LinphoneConferenceParams; + + + /** * Create a #LinphoneConferenceParams with default parameters set. * @param core #LinphoneCore to use to find out the default parameters. Can be NULL. @@ -73,10 +80,7 @@ LINPHONE_PUBLIC bool_t linphone_conference_params_video_requested(const Linphone -/** - * LinphoneConference class - */ -typedef struct _LinphoneConference LinphoneConference; + /** * Remove a participant from a conference diff --git a/coreapi/conference_private.h b/coreapi/conference_private.h index 3147cfd9a..bc203f794 100644 --- a/coreapi/conference_private.h +++ b/coreapi/conference_private.h @@ -37,11 +37,48 @@ typedef enum { LinphoneConferenceClassRemote } LinphoneConferenceClass; +/** + * List of states used by #LinphoneConference + */ +typedef enum { + LinphoneConferenceStopped, /*< Initial state */ + LinphoneConferenceStarting, /*< A participant has been added but the conference is not running yet */ + LinphoneConferenceReady, /*< The conference is running */ + LinphoneConferenceStartingFailed /*< A participant has been added but the initialization of the conference has failed */ +} LinphoneConferenceState; +/** + * Type of the funtion to pass as callback to linphone_conference_params_set_state_changed_callback() + * @param conference The conference instance which the state has changed + * @param new_state The new state of the conferenece + * @param user_data Pointer pass to user_data while linphone_conference_params_set_state_changed_callback() was being called + */ +typedef void (*LinphoneConferenceStateChangedCb)(LinphoneConference *conference, LinphoneConferenceState new_state, void *user_data); + + +/** + * A function to converte a #LinphoneConferenceState into a string + */ +const char *linphone_conference_state_to_string(LinphoneConferenceState state); + + +/** + * Set a callback which will be called when the state of the conferenec is switching + * @param params A #LinphoneConferenceParams object + * @param cb The callback to call + * @param user_data Pointer to pass to the user_data parameter of #LinphoneConferenceStateChangedCb + */ +void linphone_conference_params_set_state_changed_callback(LinphoneConferenceParams *params, LinphoneConferenceStateChangedCb cb, void *user_data); + + LinphoneConference *linphone_local_conference_new(LinphoneCore *core); LinphoneConference *linphone_local_conference_new_with_params(LinphoneCore *core, const LinphoneConferenceParams *params); LinphoneConference *linphone_remote_conference_new(LinphoneCore *core); LinphoneConference *linphone_remote_conference_new_with_params(LinphoneCore *core, const LinphoneConferenceParams *params); void linphone_conference_free(LinphoneConference *obj); +/** + * Get the state of a conference + */ +LinphoneConferenceState linphone_conference_get_state(const LinphoneConference *obj); int linphone_conference_add_participant(LinphoneConference *obj, LinphoneCall *call); int linphone_conference_remove_participant_with_call(LinphoneConference *obj, LinphoneCall *call); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 95efd2a1d..f1deb704d 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -7461,18 +7461,30 @@ LinphoneRingtonePlayer *linphone_core_get_ringtoneplayer(LinphoneCore *lc) { return lc->ringtoneplayer; } +static void linphone_core_conference_state_changed(LinphoneConference *conf, LinphoneConferenceState cstate, void *user_data) { + LinphoneCore *lc = (LinphoneCore *)user_data; + if(cstate == LinphoneConferenceStartingFailed || cstate == LinphoneConferenceStopped) { + linphone_conference_free(lc->conf_ctx); + lc->conf_ctx = NULL; + } +} + LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc, const LinphoneConferenceParams *params) { const char *conf_method_name; if(lc->conf_ctx == NULL) { + LinphoneConferenceParams *params2 = linphone_conference_params_clone(params); + linphone_conference_params_set_state_changed_callback(params2, linphone_core_conference_state_changed, lc); conf_method_name = lp_config_get_string(lc->config, "misc", "conference_type", "local"); if(strcasecmp(conf_method_name, "local") == 0) { - lc->conf_ctx = linphone_local_conference_new_with_params(lc, params); + lc->conf_ctx = linphone_local_conference_new_with_params(lc, params2); } else if(strcasecmp(conf_method_name, "remote") == 0) { - lc->conf_ctx = linphone_remote_conference_new_with_params(lc, params); + lc->conf_ctx = linphone_remote_conference_new_with_params(lc, params2); } else { ms_error("'%s' is not a valid conference method", conf_method_name); + linphone_conference_params_free(params2); return NULL; } + linphone_conference_params_free(params2); } else { ms_error("Could not create a conference: a conference instance already exists"); return NULL; @@ -7482,7 +7494,12 @@ LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call) { LinphoneConference *conference = linphone_core_get_conference(lc); - if(conference == NULL) conference = linphone_core_create_conference_with_params(lc, NULL); + if(conference == NULL) { + LinphoneConferenceParams *params = linphone_conference_params_new(lc); + linphone_conference_params_set_state_changed_callback(params, linphone_core_conference_state_changed, lc); + conference = linphone_core_create_conference_with_params(lc, params); + linphone_conference_params_free(params); + } if(conference) return linphone_conference_add_participant(lc->conf_ctx, call); else return -1; } @@ -7508,7 +7525,10 @@ int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call) { } int linphone_core_terminate_conference(LinphoneCore *lc) { - if(lc->conf_ctx == NULL) return -1; + if(lc->conf_ctx == NULL) { + ms_error("Could not terminate conference: no conference context"); + return -1; + } linphone_conference_terminate(lc->conf_ctx); linphone_conference_free(lc->conf_ctx); lc->conf_ctx = NULL; diff --git a/tester/liblinphone_tester.h b/tester/liblinphone_tester.h index ee1b2eec8..9c9898983 100644 --- a/tester/liblinphone_tester.h +++ b/tester/liblinphone_tester.h @@ -258,6 +258,7 @@ typedef struct _LinphoneConferenceServer { LinphoneCoreManager base; LinphoneCall *first_call; LinphoneCoreVTable *vtable; + LinphoneRegistrationState reg_state; } LinphoneConferenceServer; typedef struct _LinphoneCallTestParams { @@ -361,7 +362,7 @@ void liblinphone_tester_uninit(void); int liblinphone_tester_set_log_file(const char *filename); bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, LinphoneIceState state); -LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file); +LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bool_t do_registration); void linphone_conference_server_destroy(LinphoneConferenceServer *conf_srv); extern const char *liblinphone_tester_mire_id; diff --git a/tester/multi_call_tester.c b/tester/multi_call_tester.c index 58474c041..a7f00e855 100644 --- a/tester/multi_call_tester.c +++ b/tester/multi_call_tester.c @@ -188,6 +188,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag LinphoneConference *conference; const MSList* calls; bool_t is_remote_conf; + bool_t focus_is_up = (focus && ((LinphoneConferenceServer *)focus)->reg_state == LinphoneRegistrationOk); MSList* lcs=ms_list_append(NULL,marie->lc); lcs=ms_list_append(lcs,pauline->lc); lcs=ms_list_append(lcs,laure->lc); @@ -213,9 +214,21 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag if(!is_remote_conf) { BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallUpdating,initial_marie_stat.number_of_LinphoneCallUpdating+1,5000)); } else { - BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,initial_marie_stat.number_of_LinphoneCallStreamsRunning+1,5000)); - BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,initial_marie_stat.number_of_LinphoneTransferCallConnected+1,5000)); - BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,initial_marie_stat.number_of_LinphoneCallEnd+1,5000)); + if(focus_is_up) { + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallStreamsRunning,initial_marie_stat.number_of_LinphoneCallStreamsRunning+1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneTransferCallConnected,initial_marie_stat.number_of_LinphoneTransferCallConnected+1,5000)); + BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,initial_marie_stat.number_of_LinphoneCallEnd+1,5000)); + } else { + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallError, initial_marie_stat.number_of_LinphoneCallError+1, 5000)); + BC_ASSERT_PTR_NULL(linphone_core_get_conference(marie->lc)); + BC_ASSERT_EQUAL(linphone_core_terminate_conference(marie->lc), -1, int, "%d"); + linphone_core_terminate_call(marie->lc, marie_call_pauline); + linphone_core_terminate_call(marie->lc, marie_call_laure); + BC_ASSERT_TRUE(wait_for_list(lcs, &marie->stat.number_of_LinphoneCallEnd, initial_marie_stat.number_of_LinphoneCallEnd+2, 10000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &pauline->stat.number_of_LinphoneCallEnd, initial_pauline_stat.number_of_LinphoneCallEnd+1, 5000)); + BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneCallEnd, initial_laure_stat.number_of_LinphoneCallEnd+1, 5000)); + goto end; + } } linphone_core_add_to_conference(marie->lc,marie_call_pauline); @@ -267,11 +280,11 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag } linphone_core_terminate_conference(marie->lc); - BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneCallEnd,is_remote_conf?2:1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneCallEnd,is_remote_conf?3:1,10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&laure->stat.number_of_LinphoneCallEnd,is_remote_conf?2:1,10000)); - + +end: ms_list_free(lcs); } @@ -766,7 +779,38 @@ void simple_remote_conference(void) { LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_tcp_rc"); LinphoneCoreManager *laure = linphone_core_manager_new("laure_rc"); - LinphoneConferenceServer *focus = linphone_conference_server_new("conference_focus_rc"); + LinphoneConferenceServer *focus = linphone_conference_server_new("conference_focus_rc", TRUE); + LpConfig *marie_config = linphone_core_get_config(marie->lc); + LinphoneProxyConfig *focus_proxy_config = linphone_core_get_default_proxy_config(((LinphoneCoreManager *)focus)->lc); + LinphoneProxyConfig *laure_proxy_config = linphone_core_get_default_proxy_config(((LinphoneCoreManager *)laure)->lc); + const char *laure_proxy_uri = linphone_proxy_config_get_server_addr(laure_proxy_config); + const char *focus_uri = linphone_proxy_config_get_identity(focus_proxy_config); + int laure_n_register = laure->stat.number_of_LinphoneRegistrationOk; + MSList *lcs = NULL; + + lp_config_set_string(marie_config, "misc", "conference_type", "remote"); + lp_config_set_string(marie_config, "misc", "conference_focus_addr", focus_uri); + + linphone_proxy_config_edit(laure_proxy_config); + linphone_proxy_config_set_route(laure_proxy_config, laure_proxy_uri); + linphone_proxy_config_done(laure_proxy_config); + lcs = ms_list_append(lcs, laure->lc); + BC_ASSERT_TRUE(wait_for_list(lcs, &laure->stat.number_of_LinphoneRegistrationOk, laure_n_register+1, 5000)); + ms_list_free(lcs); + + simple_conference_base(marie, pauline, laure, (LinphoneCoreManager *)focus); + + linphone_core_manager_destroy(marie); + linphone_core_manager_destroy(pauline); + linphone_core_manager_destroy(laure); + linphone_conference_server_destroy(focus); +} + +void simple_remote_conference_shut_down_focus(void) { + LinphoneCoreManager *marie = linphone_core_manager_new("marie_rc"); + LinphoneCoreManager *pauline = linphone_core_manager_new("pauline_tcp_rc"); + LinphoneCoreManager *laure = linphone_core_manager_new("laure_rc"); + LinphoneConferenceServer *focus = linphone_conference_server_new("conference_focus_rc", FALSE); LpConfig *marie_config = linphone_core_get_config(marie->lc); LinphoneProxyConfig *focus_proxy_config = linphone_core_get_default_proxy_config(((LinphoneCoreManager *)focus)->lc); LinphoneProxyConfig *laure_proxy_config = linphone_core_get_default_proxy_config(((LinphoneCoreManager *)laure)->lc); @@ -797,7 +841,7 @@ void eject_from_3_participants_remote_conference(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); LinphoneCoreManager* laure = linphone_core_manager_new( "laure_rc"); - LinphoneConferenceServer *focus = linphone_conference_server_new("conference_focus_rc"); + LinphoneConferenceServer *focus = linphone_conference_server_new("conference_focus_rc", TRUE); LpConfig *marie_config = linphone_core_get_config(marie->lc); LinphoneProxyConfig *focus_proxy_config = linphone_core_get_default_proxy_config(((LinphoneCoreManager *)focus)->lc); LinphoneProxyConfig *laure_proxy_config = linphone_core_get_default_proxy_config(((LinphoneCoreManager *)laure)->lc); @@ -840,7 +884,8 @@ test_t multi_call_tests[] = { TEST_NO_TAG("Unattended call transfer with error", unattended_call_transfer_with_error), TEST_NO_TAG("Call transfer existing call outgoing call", call_transfer_existing_call_outgoing_call), TEST_NO_TAG("Simple remote conference", simple_remote_conference), - TEST_NO_TAG("Eject from 3 participants in remote conference", eject_from_3_participants_remote_conference) + TEST_NO_TAG("Simple remote conference with shut down focus", simple_remote_conference_shut_down_focus), + TEST_NO_TAG("Eject from 3 participants in remote conference", eject_from_3_participants_remote_conference), }; test_suite_t multi_call_test_suite = {"Multi call", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, diff --git a/tester/tester.c b/tester/tester.c index 510f5d3b4..7abe6829f 100644 --- a/tester/tester.c +++ b/tester/tester.c @@ -667,7 +667,7 @@ bool_t check_ice(LinphoneCoreManager* caller, LinphoneCoreManager* callee, Linph return video_enabled ? (realtime_text_enabled ? text_success && audio_success && video_success : audio_success && video_success) : realtime_text_enabled ? text_success && audio_success : audio_success; } -void linphone_conference_server_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) { +static void linphone_conference_server_call_state_changed(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *msg) { LinphoneCoreVTable *vtable = linphone_core_get_current_vtable(lc); LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)vtable->user_data; @@ -696,7 +696,7 @@ void linphone_conference_server_call_state_changed(LinphoneCore *lc, LinphoneCal } } -void linphone_conference_server_refer_received(LinphoneCore *core, const char *refer_to) { +static void linphone_conference_server_refer_received(LinphoneCore *core, const char *refer_to) { char method[20]; LinphoneAddress *refer_to_addr = linphone_address_new(refer_to); char *uri; @@ -714,17 +714,30 @@ void linphone_conference_server_refer_received(LinphoneCore *core, const char *r linphone_address_destroy(refer_to_addr); } -LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file) { +static void linphone_conference_server_registration_state_changed(LinphoneCore *core, + LinphoneProxyConfig *cfg, + LinphoneRegistrationState cstate, + const char *message) { + LinphoneCoreVTable *vtable = linphone_core_get_current_vtable(core); + LinphoneConferenceServer *m = (LinphoneConferenceServer *)linphone_core_v_table_get_user_data(vtable); + if(cfg == linphone_core_get_default_proxy_config(core)) { + m->reg_state = cstate; + } +} + +LinphoneConferenceServer* linphone_conference_server_new(const char *rc_file, bool_t do_registration) { LinphoneConferenceServer *conf_srv = (LinphoneConferenceServer *)ms_new0(LinphoneConferenceServer, 1); LinphoneCoreManager *lm = (LinphoneCoreManager *)conf_srv; conf_srv->vtable = linphone_core_v_table_new(); conf_srv->vtable->call_state_changed = linphone_conference_server_call_state_changed; conf_srv->vtable->refer_received = linphone_conference_server_refer_received; + conf_srv->vtable->registration_state_changed = linphone_conference_server_registration_state_changed; conf_srv->vtable->user_data = conf_srv; + conf_srv->reg_state = LinphoneRegistrationNone; linphone_core_manager_init(lm, rc_file); linphone_core_add_listener(lm->lc, conf_srv->vtable); - linphone_core_manager_start(lm, TRUE); + linphone_core_manager_start(lm, do_registration); return conf_srv; } From d6376609909f91bbb5f600eb69bfaa74a7cb26bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Grisez?= Date: Tue, 2 Feb 2016 11:30:54 +0100 Subject: [PATCH 41/56] Fix build issue --- tester/call_tester.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tester/call_tester.c b/tester/call_tester.c index 0e0f58674..5f21c59b8 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -5712,7 +5712,7 @@ static void call_logs_sqlite_storage(void) { LinphoneCallLog *call_log = NULL; LinphoneAddress *laure = NULL; time_t user_data_time = time(NULL); - time_t start_time = NULL; + time_t start_time = 0; unlink(logs_db); linphone_core_set_call_logs_database_path(marie->lc, logs_db); From d39a16476f6f67bd8345507304fa2b41b6dd28b6 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 2 Feb 2016 12:25:57 +0100 Subject: [PATCH 42/56] Update ortp and ms2 submodules. --- mediastreamer2 | 2 +- oRTP | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index cb1ea6ee2..2011ba719 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit cb1ea6ee25710bbe2b831c294f8e9703738bf2c1 +Subproject commit 2011ba719ebd639eb084b39733f12bd67bff01e3 diff --git a/oRTP b/oRTP index 83bf0a09c..1d533c749 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 83bf0a09cc2127086e15817d16793320c9fb9af0 +Subproject commit 1d533c7490475b26a29f3fce300ac7004ab74a88 From 672838c7a06b0e2dd502abbea722e56b1a664f4b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 2 Feb 2016 12:51:49 +0100 Subject: [PATCH 43/56] fix preview stream --- console/commands.c | 8 ++++---- coreapi/linphonecore.c | 2 +- mediastreamer2 | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/console/commands.c b/console/commands.c index 6f527831e..5fca480a6 100644 --- a/console/commands.c +++ b/console/commands.c @@ -287,10 +287,10 @@ static LPC_COMMAND advanced_commands[] = { "'codec list' : list audio codecs\n" "'codec enable ' : enable available audio codec\n" "'codec disable ' : disable audio codec" }, - { "vcodec", lpc_cmd_vcodec, "Video codec configuration", - "'vcodec list' : list video codecs\n" - "'vcodec enable ' : enable available video codec\n" - "'vcodec disable ' : disable video codec" }, + { "vcodec", lpc_cmd_vcodec, "Video codec configuration", + "'vcodec list' : list video codecs\n" + "'vcodec enable ' : enable available video codec\n" + "'vcodec disable ' : disable video codec" }, { "ec", lpc_cmd_echocancellation, "Echo cancellation", "'ec on [] [] []' : turn EC on with given delay, tail length and framesize\n" "'ec off' : turn echo cancellation (EC) off\n" diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f1deb704d..2b65fb5cd 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -5227,7 +5227,7 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val){ if (lc->previewstream==NULL){ const char *display_filter=linphone_core_get_video_display_filter(lc); MSVideoSize vsize=lc->video_conf.preview_vsize.width!=0 ? lc->video_conf.preview_vsize : lc->video_conf.vsize; - lc->previewstream=video_preview_new(); + lc->previewstream=video_preview_new(lc->factory); video_preview_set_size(lc->previewstream,vsize); if (display_filter) video_preview_set_display_filter_name(lc->previewstream,display_filter); diff --git a/mediastreamer2 b/mediastreamer2 index 2011ba719..3cf3ebfec 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 2011ba719ebd639eb084b39733f12bd67bff01e3 +Subproject commit 3cf3ebfec8b0c3c42c297e101d55754bd995a798 From 9afc1e15093bfe1d44987767bd5f2b7408de09d3 Mon Sep 17 00:00:00 2001 From: Brieuc Viel Date: Tue, 2 Feb 2016 14:30:01 +0100 Subject: [PATCH 44/56] fix compilation iOS --- coreapi/ringtoneplayer.c | 2 +- mediastreamer2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/ringtoneplayer.c b/coreapi/ringtoneplayer.c index fd7e8421f..1e1e64fd6 100644 --- a/coreapi/ringtoneplayer.c +++ b/coreapi/ringtoneplayer.c @@ -37,7 +37,7 @@ void linphone_ringtoneplayer_destroy(LinphoneRingtonePlayer* rp) { linphone_ringtoneplayer_ios_destroy(rp); } -int linphone_ringtoneplayer_start_with_cb(LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms, LinphoneRingtonePlayerFunc end_of_ringtone, void * user_data) { +int linphone_ringtoneplayer_start_with_cb(MSFactory* f, LinphoneRingtonePlayer* rp, MSSndCard* card, const char* ringtone, int loop_pause_ms, LinphoneRingtonePlayerFunc end_of_ringtone, void * user_data) { if (linphone_ringtoneplayer_is_started(rp)) { ms_message("the local ringtone is already started"); return 2; diff --git a/mediastreamer2 b/mediastreamer2 index 3cf3ebfec..adc3383e4 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 3cf3ebfec8b0c3c42c297e101d55754bd995a798 +Subproject commit adc3383e454ba312dcb04b0afa7a3e1090eef24f From 6724016f94b4370eb26c18dd5be8c7d6dc6b2e9f Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Tue, 2 Feb 2016 14:37:23 +0100 Subject: [PATCH 45/56] Fix build for Windows 10. --- mediastreamer2 | 2 +- tester/liblinphone_tester_windows.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mediastreamer2 b/mediastreamer2 index adc3383e4..1cbbf9d7b 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit adc3383e454ba312dcb04b0afa7a3e1090eef24f +Subproject commit 1cbbf9d7bf1039d3807ce4d9221c64232dd740a1 diff --git a/tester/liblinphone_tester_windows.cpp b/tester/liblinphone_tester_windows.cpp index 015af02d2..1748e712b 100644 --- a/tester/liblinphone_tester_windows.cpp +++ b/tester/liblinphone_tester_windows.cpp @@ -108,7 +108,7 @@ bool NativeTester::run(Platform::String^ suiteName, Platform::String^ caseName, linphone_core_set_log_level_mask(ORTP_FATAL); } linphone_core_set_log_handler(libLinphoneNativeOutputTraceHandler); - return bc_tester_run_tests(wssuitename == all ? 0 : csuitename, wscasename == all ? 0 : ccasename) != 0; + return bc_tester_run_tests(wssuitename == all ? 0 : csuitename, wscasename == all ? 0 : ccasename, NULL) != 0; } void NativeTester::runAllToXml() From 0f67bd96959f79f420cab1ef4ca934a75c5f138f Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 2 Feb 2016 15:14:45 +0100 Subject: [PATCH 46/56] Update media streamer. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index 1cbbf9d7b..b111db1ef 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 1cbbf9d7bf1039d3807ce4d9221c64232dd740a1 +Subproject commit b111db1efbd3d32a98db67a93a14f1d5f01c1460 From b74d95e464169d3cf7f554cbde455615a752d1d7 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 2 Feb 2016 16:14:01 +0100 Subject: [PATCH 47/56] Use ms_factory_get_cpu_count instead of deprecated ms_get_cpu_count in call_tester. --- tester/call_tester.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tester/call_tester.c b/tester/call_tester.c index 5f21c59b8..c1a267e36 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -667,7 +667,7 @@ static void call_with_specified_codec_bitrate(void) { int max_bw=50; #ifdef __arm__ - if (ms_get_cpu_count() <2) { /*2 opus codec channel + resampler is too much for a single core*/ + if (ms_factory_get_cpu_count(marie->lc->factory) <2) { /*2 opus codec channel + resampler is too much for a single core*/ #ifndef ANDROID codec = "speex"; rate = 8000; From 2ebbc1aae4c7f793aa9c37e894846261f5e502eb Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Tue, 2 Feb 2016 16:15:42 +0100 Subject: [PATCH 48/56] Update media streamer. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index b111db1ef..e13e34dad 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit b111db1efbd3d32a98db67a93a14f1d5f01c1460 +Subproject commit e13e34dad9d2267e9469dede3f67b8cd1670a2f4 From 29e0109c5313aba18b2685533f9d220f4e4cb588 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Tue, 2 Feb 2016 16:28:55 +0100 Subject: [PATCH 49/56] -Publish are now implemented using LinphoneEvent API. --- coreapi/bellesip_sal/sal_op_events.c | 9 -- coreapi/bellesip_sal/sal_op_impl.c | 8 ++ coreapi/bellesip_sal/sal_op_publish.c | 67 +++++------- coreapi/callbacks.c | 15 ++- coreapi/event.c | 14 ++- coreapi/event.h | 15 +++ coreapi/linphonecore.c | 1 + coreapi/linphonepresence.h | 15 +++ coreapi/presence.c | 55 +++++++--- coreapi/private.h | 8 +- coreapi/proxy.c | 140 ++++++++++++++++++++------ coreapi/sal.c | 26 +++-- coreapi/vtables.c | 2 +- include/sal/sal.h | 17 +++- tester/presence_tester.c | 88 ++++++++++++---- tester/register_tester.c | 2 +- 16 files changed, 345 insertions(+), 137 deletions(-) diff --git a/coreapi/bellesip_sal/sal_op_events.c b/coreapi/bellesip_sal/sal_op_events.c index 75f87a2d9..0c93ff2fa 100644 --- a/coreapi/bellesip_sal/sal_op_events.c +++ b/coreapi/bellesip_sal/sal_op_events.c @@ -236,15 +236,6 @@ int sal_subscribe(SalOp *op, const char *from, const char *to, const char *event return -1; } -int sal_subscribe_refresh(SalOp *op) { - if (op->refresher) { - belle_sip_refresher_refresh(op->refresher,belle_sip_refresher_get_expires(op->refresher)); - return 0; - } - ms_warning("sal_refresh_subscribe(): no refresher"); - return -1; -} - int sal_unsubscribe(SalOp *op){ if (op->refresher){ const belle_sip_transaction_t *tr=(const belle_sip_transaction_t*) belle_sip_refresher_get_transaction(op->refresher); diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index 88d6cf0f9..9fcca24a6 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -789,3 +789,11 @@ bool_t sal_op_cnx_ip_to_0000_if_sendonly_enabled(SalOp *op) { bool_t sal_op_is_forked_of(const SalOp *op1, const SalOp *op2){ return op1->base.call_id && op2->base.call_id && strcmp(op1->base.call_id, op2->base.call_id) == 0; } +int sal_op_refresh(SalOp *op) { + if (op->refresher) { + belle_sip_refresher_refresh(op->refresher,belle_sip_refresher_get_expires(op->refresher)); + return 0; + } + ms_warning("sal_refresh on op [%p] of type [%s] no refresher",op,sal_op_type_to_string(op)); + return -1; +} diff --git a/coreapi/bellesip_sal/sal_op_publish.c b/coreapi/bellesip_sal/sal_op_publish.c index a1dc85204..d5c16ff66 100644 --- a/coreapi/bellesip_sal/sal_op_publish.c +++ b/coreapi/bellesip_sal/sal_op_publish.c @@ -25,17 +25,17 @@ static void publish_refresher_listener (belle_sip_refresher_t* refresher ,const char* reason_phrase) { SalOp* op = (SalOp*)user_pointer; const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->refresher); - belle_sip_request_t* last_publish=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(last_publish_trans)); belle_sip_response_t *response=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(last_publish_trans)); - /*belle_sip_response_t* response=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher)));*/ ms_message("Publish refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase?reason_phrase:"none",sal_op_get_proxy(op)); - if (status_code==412){ - /*resubmit the request after removing the SIP-If-Match*/ - belle_sip_message_remove_header((belle_sip_message_t*)last_publish,"SIP-If-Match"); - belle_sip_refresher_refresh(op->refresher,BELLE_SIP_REFRESHER_REUSE_EXPIRES); - }else if (status_code==0){ + if (status_code==0){ op->base.root->callbacks.on_expire(op); }else if (status_code>=200){ + belle_sip_header_t *sip_etag; + const char *sip_etag_string = NULL; + if ((sip_etag = belle_sip_message_get_header(BELLE_SIP_MESSAGE(response), "SIP-ETag"))) { + sip_etag_string = belle_sip_header_get_unparsed_value(sip_etag); + } + sal_op_set_entity_tag(op, sip_etag_string); sal_error_info_set(&op->error_info,SalReasonUnknown,status_code,reason_phrase,NULL); sal_op_assign_recv_headers(op,(belle_sip_message_t*)response); op->base.root->callbacks.on_publish_response(op); @@ -60,42 +60,6 @@ void sal_op_publish_fill_cbs(SalOp *op) { op->type=SalOpPublish; } -/* - * Sending a publish with 0 expires removes the event state and such request shall not contain a body. - * See RFC3903, section 4.5 - */ - -/*presence publish */ -int sal_publish_presence(SalOp *op, const char *from, const char *to, int expires, SalPresenceModel *presence){ - belle_sip_request_t *req=NULL; - if(!op->refresher || !belle_sip_refresher_get_transaction(op->refresher)) { - if (from) - sal_op_set_from(op,from); - if (to) - sal_op_set_to(op,to); - - op->type=SalOpPublish; - req=sal_op_build_request(op,"PUBLISH"); - - if( req == NULL ){ - return -1; - } - - if (sal_op_get_contact_address(op)){ - belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(sal_op_create_contact(op))); - } - belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("Event","presence")); - sal_add_presence_info(op,BELLE_SIP_MESSAGE(req),presence); - return sal_op_send_and_create_refresher(op,req,expires,publish_refresher_listener); - } else { - /*update presence status*/ - const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->refresher); - belle_sip_request_t* last_publish=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(last_publish_trans)); - sal_add_presence_info(op,BELLE_SIP_MESSAGE(last_publish),expires!=0 ? presence : NULL); - return belle_sip_refresher_refresh(op->refresher,expires); - } -} - int sal_publish(SalOp *op, const char *from, const char *to, const char *eventname, int expires, const SalBodyHandler *body_handler){ belle_sip_request_t *req=NULL; if(!op->refresher || !belle_sip_refresher_get_transaction(op->refresher)) { @@ -109,7 +73,11 @@ int sal_publish(SalOp *op, const char *from, const char *to, const char *eventna if( req == NULL ){ return -1; } - + + if (sal_op_get_entity_tag(op)) { + belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("SIP-If-Match", sal_op_get_entity_tag(op))); + } + if (sal_op_get_contact_address(op)){ belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(sal_op_create_contact(op))); } @@ -131,3 +99,14 @@ int sal_publish(SalOp *op, const char *from, const char *to, const char *eventna return belle_sip_refresher_refresh(op->refresher,expires==-1 ? BELLE_SIP_REFRESHER_REUSE_EXPIRES : expires); } } + +int sal_op_unpublish(SalOp *op){ + if (op->refresher){ + const belle_sip_transaction_t *tr=(const belle_sip_transaction_t*) belle_sip_refresher_get_transaction(op->refresher); + belle_sip_request_t *last_req=belle_sip_transaction_get_request(tr); + belle_sip_message_set_body(BELLE_SIP_MESSAGE(last_req), NULL, 0); + belle_sip_refresher_refresh(op->refresher,0); + return 0; + } + return -1; +} diff --git a/coreapi/callbacks.c b/coreapi/callbacks.c index 4b55f474e..b884bf224 100644 --- a/coreapi/callbacks.c +++ b/coreapi/callbacks.c @@ -1038,10 +1038,11 @@ static void register_failure(SalOp *op){ } else { linphone_proxy_config_set_state(cfg,LinphoneRegistrationFailed,details); } - if (cfg->publish_op){ + if (cfg->long_term_event){ /*prevent publish to be sent now until registration gets successful*/ - sal_op_release(cfg->publish_op); - cfg->publish_op=NULL; + linphone_event_terminate(cfg->long_term_event); + linphone_event_unref(cfg->long_term_event); + cfg->long_term_event=NULL; cfg->send_publish=cfg->publish; } } @@ -1137,7 +1138,13 @@ static void parse_presence_requested(SalOp *op, const char *content_type, const } static void convert_presence_to_xml_requested(SalOp *op, SalPresenceModel *presence, const char *contact, char **content) { - linphone_notify_convert_presence_to_xml(op, presence, contact, content); + /*for backward compatibility because still used by notify. No loguer used for publish*/ + + if(linphone_presence_model_get_presentity((LinphonePresenceModel*)presence) == NULL) { + LinphoneAddress * presentity = linphone_address_new(contact); + linphone_presence_model_set_presentity((LinphonePresenceModel*)presence, presentity); + } + *content = linphone_presence_model_to_xml((LinphonePresenceModel*)presence); } static void notify_presence(SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model, const char *msg){ diff --git a/coreapi/event.c b/coreapi/event.c index 2d6c8f270..07e373b73 100644 --- a/coreapi/event.c +++ b/coreapi/event.c @@ -201,7 +201,7 @@ int linphone_event_update_subscribe(LinphoneEvent *lev, const LinphoneContent *b } int linphone_event_refresh_subscribe(LinphoneEvent *lev) { - return sal_subscribe_refresh(lev->op); + return sal_op_refresh(lev->op); } int linphone_event_accept_subscription(LinphoneEvent *lev){ @@ -291,6 +291,16 @@ int linphone_event_update_publish(LinphoneEvent* lev, const LinphoneContent* bod return linphone_event_send_publish(lev,body); } +int linphone_event_refresh_publish(LinphoneEvent *lev) { + return sal_op_refresh(lev->op); +} +void linphone_event_pause_publish(LinphoneEvent *lev) { + if (lev->op) sal_op_stop_refreshing(lev->op); +} +void linphone_event_unpublish(LinphoneEvent *lev) { + lev->terminating = TRUE; /* needed to get clear event*/ + if (lev->op) sal_op_unpublish(lev->op); +} void linphone_event_set_user_data(LinphoneEvent *ev, void *up){ ev->userdata=up; } @@ -320,7 +330,7 @@ void linphone_event_terminate(LinphoneEvent *lev){ if (lev->publish_state!=LinphonePublishNone){ if (lev->publish_state==LinphonePublishOk && lev->expires!=-1){ sal_publish(lev->op,NULL,NULL,NULL,0,NULL); - }else sal_op_stop_refreshing(lev->op); + }else sal_op_unpublish(lev->op); linphone_event_set_publish_state(lev,LinphonePublishCleared); return; } diff --git a/coreapi/event.h b/coreapi/event.h index 5200beb66..b9033f8c7 100644 --- a/coreapi/event.h +++ b/coreapi/event.h @@ -208,6 +208,21 @@ LINPHONE_PUBLIC int linphone_event_send_publish(LinphoneEvent *lev, const Linpho **/ LINPHONE_PUBLIC int linphone_event_update_publish(LinphoneEvent *lev, const LinphoneContent *body); +/** + * Refresh an outgoing publish keeping the same body. + * @param lev LinphoneEvent object. + * @return 0 if successful, -1 otherwise. + */ +LINPHONE_PUBLIC int linphone_event_refresh_publish(LinphoneEvent *lev); + +/** + * Prevent an event from refreshing its publish. + * This is useful to let registrations to expire naturally (or) when the application wants to keep control on when + * refreshes are sent. + * The refreshing operations can be resumed with linphone_proxy_config_refresh_register(). + * @param[in] cfg #LinphoneEvent object. + **/ +LINPHONE_PUBLIC void linphone_event_pause_publish(LinphoneEvent *lev); /** * Return reason code (in case of error state reached). diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 2b65fb5cd..b4523d41c 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -6184,6 +6184,7 @@ void sip_config_uninit(LinphoneCore *lc) if (lc->sip_network_reachable) { for(elem=config->proxies;elem!=NULL;elem=ms_list_next(elem)){ LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)(elem->data); + _linphone_proxy_config_unpublish(cfg); /* to unpublish without changing the stored flag enable_publish */ _linphone_proxy_config_unregister(cfg); /* to unregister without changing the stored flag enable_register */ } diff --git a/coreapi/linphonepresence.h b/coreapi/linphonepresence.h index c0168cb8b..a4a451ad6 100644 --- a/coreapi/linphonepresence.h +++ b/coreapi/linphonepresence.h @@ -261,6 +261,21 @@ LINPHONE_PUBLIC char * linphone_presence_model_get_contact(const LinphonePresenc */ LINPHONE_PUBLIC int linphone_presence_model_set_contact(LinphonePresenceModel *model, const char *contact); +/** + * Sets the presentity of a presence model. + * @param[in] model The #LinphonePresenceModel object for which to set the contact. + * @param[in] presentity The presentity address to set (presentity is copied). + * @return 0 if successful, a value < 0 in case of error. + */ +LINPHONE_PUBLIC int linphone_presence_model_set_presentity(LinphonePresenceModel *model, const LinphoneAddress *presentity); +/** + * Gets the presentity of a presence model. + * @param[in] model The #LinphonePresenceModel object to get the contact from. + * @return A pointer to a const LinphoneAddress, or NULL if no contact is found. + * + */ +LINPHONE_PUBLIC const LinphoneAddress * linphone_presence_model_get_presentity(const LinphonePresenceModel *model); + /** * Gets the first activity of a presence model (there is usually only one). * @param[in] model The #LinphonePresenceModel object to get the activity from. diff --git a/coreapi/presence.c b/coreapi/presence.c index cec2b1547..b4d46f934 100644 --- a/coreapi/presence.c +++ b/coreapi/presence.c @@ -67,6 +67,7 @@ struct _LinphonePresencePerson { * This model is not complete. For example, it does not handle devices. */ struct _LinphonePresenceModel { + LinphoneAddress *presentity; /* "The model seeks to describe the presentity, identified by a presentity URI.*/ void *user_data; int refcnt; MSList *services; /**< A list of _LinphonePresenceService structures. Also named tuples in the RFC. */ @@ -246,7 +247,8 @@ static void presence_model_find_open_basic_status(LinphonePresenceService *servi static void presence_model_delete(LinphonePresenceModel *model) { if (model == NULL) return; - + if (model->presentity) + linphone_address_unref(model->presentity); ms_list_for_each(model->services, (MSIterateFunc)linphone_presence_service_unref); ms_list_free(model->services); ms_list_for_each(model->persons, (MSIterateFunc)linphone_presence_person_unref); @@ -671,7 +673,22 @@ int linphone_presence_model_clear_persons(LinphonePresenceModel *model) { return 0; } +int linphone_presence_model_set_presentity(LinphonePresenceModel *model, const LinphoneAddress *presentity) { + + if (model->presentity) { + linphone_address_unref(model->presentity); + model->presentity = NULL; + } + if (presentity) { + model->presentity=linphone_address_clone(presentity); + linphone_address_clean(model->presentity); + } + return 0; +} +const LinphoneAddress * linphone_presence_model_get_presentity(const LinphonePresenceModel *model) { + return model->presentity; +} /***************************************************************************** * PRESENCE SERVICE FUNCTIONS TO GET ACCESS TO ALL FUNCTIONALITIES * @@ -1772,24 +1789,28 @@ static void write_xml_presence_person_obj(LinphonePresencePerson *person, struct if (err < 0) *st->err = err; } -void linphone_notify_convert_presence_to_xml(SalOp *op, SalPresenceModel *presence, const char *contact, char **content) { - LinphonePresenceModel *model; - xmlBufferPtr buf; - xmlTextWriterPtr writer; +char *linphone_presence_model_to_xml(LinphonePresenceModel *model) { + xmlBufferPtr buf = NULL; + xmlTextWriterPtr writer = NULL; int err; - - if ((contact == NULL) || (content == NULL)) return; - - model = (LinphonePresenceModel *)presence; + char *contact = NULL; + char * content = NULL; + + if (model->presentity) { + contact = linphone_address_as_string_uri_only(model->presentity); + } else { + ms_error("Cannot convert presence model [%p] to xml because no presentity set", model); + goto end; + } buf = xmlBufferCreate(); if (buf == NULL) { ms_error("Error creating the XML buffer"); - return; + goto end; } writer = xmlNewTextWriterMemory(buf, 0); if (writer == NULL) { ms_error("Error creating the XML writer"); - return; + goto end; } xmlTextWriterSetIndent(writer,1); @@ -1815,7 +1836,7 @@ void linphone_notify_convert_presence_to_xml(SalOp *op, SalPresenceModel *presen } else { struct _presence_service_obj_st st={0}; st.writer = writer; - st.contact = contact; + st.contact = contact; /*default value*/ st.err = &err; ms_list_for_each2(model->services, (MSIterate2Func)write_xml_presence_service_obj, &st); } @@ -1842,10 +1863,14 @@ void linphone_notify_convert_presence_to_xml(SalOp *op, SalPresenceModel *presen } if (err > 0) { /* xmlTextWriterEndDocument returns the size of the content. */ - *content = ms_strdup((char *)buf->content); + content = ms_strdup((char *)buf->content); } - xmlFreeTextWriter(writer); - xmlBufferFree(buf); + +end: + if (contact) ms_free(contact); + if (writer) xmlFreeTextWriter(writer); + if (buf) xmlBufferFree(buf); + return content; } void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model){ diff --git a/coreapi/private.h b/coreapi/private.h index 7236d025f..9c3b07f8f 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -398,6 +398,8 @@ void linphone_proxy_config_set_state(LinphoneProxyConfig *cfg, LinphoneRegistrat void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig *obj); void linphone_proxy_config_write_all_to_config_file(LinphoneCore *lc); void _linphone_proxy_config_release(LinphoneProxyConfig *cfg); +void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj); + /* * returns service route as defined in as defined by rfc3608, might be a list instead of just one. * Can be NULL @@ -595,7 +597,6 @@ struct _LinphoneProxyConfig int auth_failures; char *dial_prefix; LinphoneRegistrationState state; - SalOp *publish_op; LinphoneAVPFMode avpf_mode; bool_t commit; @@ -615,6 +616,8 @@ struct _LinphoneProxyConfig LinphoneAddress *saved_identity; /*---*/ LinphoneAddress *pending_contact; /*use to store previous contact in case of network failure*/ + LinphoneEvent *long_term_event; + unsigned long long previous_publish_config_hash[2]; }; @@ -1108,6 +1111,7 @@ SalReason linphone_reason_to_sal(LinphoneReason reason); LinphoneReason linphone_reason_from_sal(SalReason reason); LinphoneEvent *linphone_event_new(LinphoneCore *lc, LinphoneSubscriptionDir dir, const char *name, int expires); LinphoneEvent *linphone_event_new_with_op(LinphoneCore *lc, SalOp *op, LinphoneSubscriptionDir dir, const char *name); +void linphone_event_unpublish(LinphoneEvent *lev); /** * Useful for out of dialog notify * */ @@ -1438,6 +1442,8 @@ BELLE_SIP_DECLARE_VPTR(LinphoneTunnelConfig); int linphone_core_get_default_proxy_config_index(LinphoneCore *lc); +char *linphone_presence_model_to_xml(LinphonePresenceModel *model) ; + #ifdef __cplusplus } #endif diff --git a/coreapi/proxy.c b/coreapi/proxy.c index 01c8ddcb7..cf16fddea 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -130,6 +130,50 @@ LinphoneProxyConfig *linphone_proxy_config_new() { return linphone_core_create_proxy_config(NULL); } +static char * append_linphone_address(LinphoneAddress *addr,char *out) { + char *res = out; + if (addr) { + char *tmp; + tmp = linphone_address_as_string(addr); + res = ms_strcat_printf(out, "%s",tmp); + ms_free(tmp); + } + return res; +}; +static char * append_string(const char * string,char *out) { + char *res = out; + if (string) { + res = ms_strcat_printf(out, "%s",string); + } + return res; +} +/* + * return true if computed value has changed + */ +bool_t linphone_proxy_config_compute_publish_params_hash(LinphoneProxyConfig * cfg) { + char * source = NULL; + char hash[33]; + char saved; + unsigned long long previous_hash[2]; + previous_hash[0] = cfg->previous_publish_config_hash[0]; + previous_hash[1] = cfg->previous_publish_config_hash[1]; + + source = ms_strcat_printf(source, "%i",cfg->privacy); + source=append_linphone_address(cfg->identity_address, source); + source=append_string(cfg->reg_proxy,source); + source=append_string(cfg->reg_route,source); + source=append_string(cfg->realm,source); + source = ms_strcat_printf(source, "%i",cfg->publish_expires); + source = ms_strcat_printf(source, "%i",cfg->publish); + belle_sip_auth_helper_compute_ha1(source, "dummy", "dummy", hash); + ms_free(source); + saved = hash[16]; + hash[16] = '\0'; + cfg->previous_publish_config_hash[0] = strtoull(hash, (char **)NULL, 16); + hash[16] = saved; + cfg->previous_publish_config_hash[1] = strtoull(&hash[16], (char **)NULL, 16); + return previous_hash[0] != cfg->previous_publish_config_hash[0] || previous_hash[1] != cfg->previous_publish_config_hash[1]; +} static void _linphone_proxy_config_destroy(LinphoneProxyConfig *cfg); BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneProxyConfig); @@ -152,9 +196,9 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *cfg){ sal_op_release(cfg->op); cfg->op=NULL; } - if (cfg->publish_op){ - sal_op_release(cfg->publish_op); - cfg->publish_op=NULL; + if (cfg->long_term_event){ + linphone_event_unref(cfg->long_term_event); + cfg->long_term_event=NULL; } } @@ -320,15 +364,13 @@ void linphone_proxy_config_pause_register(LinphoneProxyConfig *cfg){ } void linphone_proxy_config_edit(LinphoneProxyConfig *cfg){ - if (cfg->publish && cfg->publish_op){ - /*unpublish*/ - sal_publish_presence(cfg->publish_op,NULL,NULL,0,(SalPresenceModel *)NULL); - sal_op_release(cfg->publish_op); - cfg->publish_op=NULL; - } /*store current config related to server location*/ linphone_proxy_config_store_server_config(cfg); - + linphone_proxy_config_compute_publish_params_hash(cfg); + + if (cfg->publish && cfg->long_term_event){ + linphone_event_pause_publish(cfg->long_term_event); + } /*stop refresher in any case*/ linphone_proxy_config_pause_register(cfg); } @@ -351,9 +393,10 @@ void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig * cfg){ cfg->pending_contact=contact_addr; } - if (cfg->publish_op){ - sal_op_release(cfg->publish_op); - cfg->publish_op=NULL; + if (cfg->long_term_event){ /*might probably do better*/ + linphone_event_terminate(cfg->long_term_event); + linphone_event_unref(cfg->long_term_event); + cfg->long_term_event=NULL; } if (cfg->op){ sal_op_release(cfg->op); @@ -1001,6 +1044,26 @@ int linphone_proxy_config_done(LinphoneProxyConfig *cfg) sal_op_unref(cfg->op); /*but we keep refresher to handle authentication if needed*/ cfg->op=NULL; } + if (cfg->long_term_event) { + if (res == LinphoneProxyConfigAddressDifferent) { + _linphone_proxy_config_unpublish(cfg); + } + + } + } + if (linphone_proxy_config_compute_publish_params_hash(cfg)) { + ms_message("Publish params have changed on proxy config [%p]",cfg); + if (cfg->long_term_event) { + if (!cfg->publish) { + /*publish is terminated*/ + linphone_event_terminate(cfg->long_term_event); + } + linphone_event_unref(cfg->long_term_event); + cfg->long_term_event = NULL; + } + if (cfg->publish) cfg->send_publish=TRUE; + } else { + ms_message("Publish params have not changed on proxy config [%p]",cfg); } cfg->commit=TRUE; linphone_proxy_config_write_all_to_config_file(cfg->lc); @@ -1021,28 +1084,46 @@ void linphone_proxy_config_set_realm(LinphoneProxyConfig *cfg, const char *realm int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy, LinphonePresenceModel *presence){ int err=0; - + if (proxy->state==LinphoneRegistrationOk || proxy->state==LinphoneRegistrationCleared){ - if (proxy->publish_op==NULL){ - const LinphoneAddress *to=linphone_proxy_config_get_identity_address(proxy); - proxy->publish_op=sal_op_new(proxy->lc->sal); - - linphone_configure_op(proxy->lc, proxy->publish_op, - to, NULL, FALSE); - - if (lp_config_get_int(proxy->lc->config,"sip","publish_msg_with_contact",0)){ - sal_op_set_contact_address(proxy->publish_op,linphone_proxy_config_get_identity_address(proxy)); - } + LinphoneContent *content; + char *presence_body; + if (proxy->long_term_event==NULL){ + proxy->long_term_event = linphone_core_create_publish(proxy->lc + , linphone_proxy_config_get_identity_address(proxy) + , "presence" + , linphone_proxy_config_get_publish_expires(proxy)); } - err=sal_publish_presence(proxy->publish_op - ,NULL - ,NULL - ,linphone_proxy_config_get_publish_expires(proxy) - ,(SalPresenceModel *)presence); + proxy->long_term_event->internal = TRUE; + + if (linphone_presence_model_get_presentity(presence) == NULL) { + ms_message("No presentity set for model [%p], using identity from proxy config [%p]", presence, proxy); + linphone_presence_model_set_presentity(presence,linphone_proxy_config_get_identity_address(proxy)); + } + + if (!(presence_body = linphone_presence_model_to_xml(presence))) { + ms_error("Cannot publish presence model [%p] for proxy config [%p] because of xml serilization error",presence,proxy); + return -1; + } + + content = linphone_content_new(); + linphone_content_set_buffer(content,presence_body,strlen(presence_body)); + linphone_content_set_type(content, "application"); + linphone_content_set_subtype(content,"pidf+xml"); + err = linphone_event_send_publish(proxy->long_term_event, content); + linphone_content_unref(content); }else proxy->send_publish=TRUE; /*otherwise do not send publish if registration is in progress, this will be done later*/ return err; } +void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj) { + if (obj->long_term_event + && (linphone_event_get_publish_state(obj->long_term_event) == LinphonePublishOk || + (linphone_event_get_publish_state(obj->long_term_event) == LinphoneIceStateInProgress && obj->publish_expires != 0))) { + linphone_event_unpublish(obj->long_term_event); + } +} + const char *linphone_proxy_config_get_route(const LinphoneProxyConfig *cfg){ return cfg->reg_route; } @@ -1376,7 +1457,6 @@ void linphone_proxy_config_update(LinphoneProxyConfig *cfg){ if (can_register(cfg)){ linphone_proxy_config_register(cfg); cfg->commit=FALSE; - if (cfg->publish) cfg->send_publish=TRUE; } } if (cfg->send_publish && (cfg->state==LinphoneRegistrationOk || cfg->state==LinphoneRegistrationCleared)){ diff --git a/coreapi/sal.c b/coreapi/sal.c index 701d68b90..97d45f612 100644 --- a/coreapi/sal.c +++ b/coreapi/sal.c @@ -570,13 +570,6 @@ const SalAddress *sal_op_get_to_address(const SalOp *op){ return ((SalOpBase*)op)->to_address; } -const char *sal_op_get_route(const SalOp *op){ -#ifdef BELLE_SIP -ms_fatal("sal_op_get_route not supported, use sal_op_get_route_addresses instead"); -#endif - return ((SalOpBase*)op)->route; -} - const char *sal_op_get_remote_ua(const SalOp *op){ return ((SalOpBase*)op)->remote_ua; } @@ -696,6 +689,11 @@ void __sal_op_free(SalOp *op){ sal_custom_header_free(b->recv_custom_headers); if (b->sent_custom_headers) sal_custom_header_free(b->sent_custom_headers); + + if (b->entity_tag != NULL){ + ms_free(b->entity_tag); + b->entity_tag = NULL; + } ms_free(op); } @@ -1007,3 +1005,17 @@ char* sal_op_get_public_uri(SalOp *op) { } return NULL; } +const char *sal_op_get_entity_tag(const SalOp* op) { + SalOpBase* op_base = (SalOpBase*)op; + return op_base->entity_tag; +} +void sal_op_set_entity_tag(SalOp *op, const char* entity_tag) { + SalOpBase* op_base = (SalOpBase*)op; + if (op_base->entity_tag != NULL){ + ms_free(op_base->entity_tag); + } + if (entity_tag) + op_base->entity_tag = ms_strdup(entity_tag); + else + op_base->entity_tag = NULL; +} diff --git a/coreapi/vtables.c b/coreapi/vtables.c index a8840b5eb..7b1f6dd60 100644 --- a/coreapi/vtables.c +++ b/coreapi/vtables.c @@ -250,7 +250,7 @@ void linphone_core_notify_subscription_state_changed(LinphoneCore *lc, LinphoneE } void linphone_core_notify_publish_state_changed(LinphoneCore *lc, LinphoneEvent *lev, LinphonePublishState state) { - NOTIFY_IF_EXIST(publish_state_changed, lc,lev,state); + NOTIFY_IF_EXIST_INTERNAL(publish_state_changed, linphone_event_is_internal(lev), lc, lev, state); cleanup_dead_vtable_refs(lc); } diff --git a/include/sal/sal.h b/include/sal/sal.h index 07483faa0..fa42fe24c 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -354,6 +354,7 @@ typedef struct SalOpBase{ SalAddress* service_route; /*as defined by rfc3608, might be a list*/ SalCustomHeader *sent_custom_headers; SalCustomHeader *recv_custom_headers; + char* entity_tag; /*as defined by rfc3903 (I.E publih)*/ } SalOpBase; @@ -641,6 +642,8 @@ void sal_op_set_to(SalOp *op, const char *to); void sal_op_set_to_address(SalOp *op, const SalAddress *to); SalOp *sal_op_ref(SalOp* h); void sal_op_stop_refreshing(SalOp *op); +int sal_op_refresh(SalOp *op); + void sal_op_release(SalOp *h); /*same as release, but does not stop refresher if any*/ void* sal_op_unref(SalOp* op); @@ -654,7 +657,6 @@ const SalAddress *sal_op_get_from_address(const SalOp *op); const char *sal_op_get_to(const SalOp *op); const SalAddress *sal_op_get_to_address(const SalOp *op); const SalAddress *sal_op_get_contact_address(const SalOp *op); -const char *sal_op_get_route(const SalOp *op); const MSList* sal_op_get_route_addresses(const SalOp *op); const char *sal_op_get_proxy(const SalOp *op); /*raw contact header value with header params*/ @@ -684,6 +686,10 @@ const SalErrorInfo *sal_op_get_error_info(const SalOp *op); void sal_error_info_reset(SalErrorInfo *ei); void sal_error_info_set(SalErrorInfo *ei, SalReason reason, int code, const char *status_string, const char *warning); +/*entity tag used for publish (see RFC 3903)*/ +const char *sal_op_get_entity_tag(const SalOp* op); +void sal_op_set_entity_tag(SalOp *op, const char* entity_tag); + /*Call API*/ int sal_call_set_local_media_description(SalOp *h, SalMediaDescription *desc); int sal_call(SalOp *h, const char *from, const char *to); @@ -740,8 +746,9 @@ int sal_notify_presence(SalOp *op, SalPresenceModel *presence); int sal_notify_presence_close(SalOp *op); /*presence publish */ -int sal_publish_presence(SalOp *op, const char *from, const char *to, int expires, SalPresenceModel *presence); - +//int sal_publish_presence(SalOp *op, const char *from, const char *to, int expires, SalPresenceModel *presence); +SalBodyHandler *sal_presence_model_create_body_handler(SalPresenceModel *presence); + /*ping: main purpose is to obtain its own contact address behind firewalls*/ int sal_ping(SalOp *op, const char *from, const char *to); @@ -754,11 +761,11 @@ int sal_subscribe(SalOp *op, const char *from, const char *to, const char *event int sal_unsubscribe(SalOp *op); int sal_subscribe_accept(SalOp *op); int sal_subscribe_decline(SalOp *op, SalReason reason); -int sal_subscribe_refresh(SalOp *op); int sal_notify(SalOp *op, const SalBodyHandler *body); int sal_notify_close(SalOp *op); int sal_publish(SalOp *op, const char *from, const char *to, const char*event_name, int expires, const SalBodyHandler *body); - +int sal_op_unpublish(SalOp *op); + /*privacy, must be in sync with LinphonePrivacyMask*/ typedef enum _SalPrivacy { SalPrivacyNone=0x0, diff --git a/tester/presence_tester.c b/tester/presence_tester.c index ebb4350d0..32d3e7255 100644 --- a/tester/presence_tester.c +++ b/tester/presence_tester.c @@ -130,7 +130,10 @@ static void simple_publish_with_expire(int expires) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneProxyConfig* proxy; LinphonePresenceModel* presence; - + LinphoneCoreVTable *vtable = linphone_core_v_table_new(); + vtable->publish_state_changed = linphone_publish_state_changed; + _linphone_core_add_listener(marie->lc, vtable, TRUE, TRUE ); + proxy = linphone_core_get_default_proxy_config(marie->lc); linphone_proxy_config_edit(proxy); if (expires >0) { @@ -138,11 +141,44 @@ static void simple_publish_with_expire(int expires) { } linphone_proxy_config_enable_publish(proxy,TRUE); linphone_proxy_config_done(proxy); - wait_core(marie->lc); + + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,1)); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishOk,1)); + presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline,NULL); linphone_core_set_presence_model(marie->lc,presence); - wait_core(marie->lc); + + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,2)); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishOk,2)); + + linphone_proxy_config_edit(proxy); + linphone_proxy_config_done(proxy); + /*make sure no publish is sent*/ + BC_ASSERT_FALSE(wait_for_until(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,3,expires*1000/2)); + + linphone_proxy_config_edit(proxy); + linphone_proxy_config_enable_publish(proxy,FALSE); + linphone_proxy_config_done(proxy); + + /*BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,3));*/ + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishCleared,1)); + + linphone_proxy_config_edit(proxy); + linphone_proxy_config_enable_publish(proxy,TRUE); + linphone_proxy_config_done(proxy); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,3)); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishOk,3)); + + linphone_proxy_config_edit(proxy); + linphone_proxy_config_set_publish_expires(proxy, linphone_proxy_config_get_publish_expires(proxy)+1); + linphone_proxy_config_done(proxy); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishProgress,4)); + BC_ASSERT_TRUE(wait_for(marie->lc,marie->lc,&marie->stat.number_of_LinphonePublishOk,4)); + linphone_core_manager_destroy(marie); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishCleared,2,int,"%i"); + BC_ASSERT_EQUAL(marie->stat.number_of_LinphonePublishOk,4,int,"%i"); + } static void simple_publish(void) { @@ -150,7 +186,7 @@ static void simple_publish(void) { } static void publish_with_expires(void) { - simple_publish_with_expire(1); + simple_publish_with_expire(2); } static bool_t subscribe_to_callee_presence(LinphoneCoreManager* caller_mgr,LinphoneCoreManager* callee_mgr) { @@ -489,7 +525,7 @@ static void test_subscribe_notify_publish(void) { LpConfig *pauline_lp; char* lf_identity; LinphoneFriend *lf; - + linphone_core_set_user_agent(marie->lc, "full-presence-support", NULL); linphone_core_set_user_agent(pauline->lc, "full-presence-support", NULL); pauline_lp = linphone_core_get_config(pauline->lc); @@ -501,7 +537,7 @@ static void test_subscribe_notify_publish(void) { linphone_core_add_friend(pauline->lc,lf); /*wait for subscribe acknowledgment*/ - wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyPresenceReceived,1,2000); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyPresenceReceived,1,2000)); BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d"); /*enable publish*/ @@ -514,18 +550,18 @@ static void test_subscribe_notify_publish(void) { linphone_proxy_config_done(proxy); /*wait for marie status*/ - wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyPresenceReceived,2,2000); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyPresenceReceived,2,2000)); BC_ASSERT_EQUAL(LinphoneStatusOnline,linphone_friend_get_status(lf), int, "%d"); presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityBusy,NULL); linphone_core_set_presence_model(marie->lc,presence); /*wait for new status*/ - wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyPresenceReceived,3,2000); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyPresenceReceived,3,2000)); BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d"); /*wait for refresh*/ - wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyPresenceReceived,4,5000); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_NotifyPresenceReceived,4,5000)); BC_ASSERT_EQUAL(LinphoneStatusBusy,linphone_friend_get_status(lf), int, "%d"); /*linphone_core_remove_friend(pauline->lc,lf);*/ @@ -534,10 +570,24 @@ static void test_subscribe_notify_publish(void) { BC_ASSERT_EQUAL(LinphonePresenceActivityOffline,linphone_friend_get_status(lf), int, "%d"); */ - /*Expect a notify at publication expiration*/ - wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyPresenceReceived,6,5000); + /*Expect a notify at publication expiration because marie is no longuer scheduled*/ + BC_ASSERT_TRUE(wait_for_until(pauline->lc,pauline->lc,&pauline->stat.number_of_NotifyPresenceReceived,6,5000)); BC_ASSERT_EQUAL(LinphoneStatusOffline,linphone_friend_get_status(lf), int, "%d"); + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphonePresenceActivityBusy,4,5000));/*re- schedule marie to clean up things*/ + + /*simulate a rapid presence change to make sure only first and last are transmited*/ + linphone_core_set_presence_model(marie->lc,linphone_presence_model_new_with_activity(LinphonePresenceActivityAway,NULL)); + linphone_core_set_presence_model(marie->lc,linphone_presence_model_new_with_activity(LinphonePresenceActivityBreakfast,NULL)); + linphone_core_set_presence_model(marie->lc,linphone_presence_model_new_with_activity(LinphonePresenceActivityAppointment,NULL)); + + BC_ASSERT_TRUE(wait_for_until(pauline->lc,marie->lc,&pauline->stat.number_of_LinphonePresenceActivityAppointment,1,5000)); + + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePresenceActivityAway, 1, int,"%i"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePresenceActivityBreakfast, 0, int,"%i"); + BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePresenceActivityAppointment, 1, int,"%i"); + + linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); } @@ -727,6 +777,7 @@ static void test_presence_list(void) { lf = linphone_friend_list_find_friend_by_uri(pauline->lc->friendlist, marie_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusOnThePhone, int, "%d"); + ms_message("Disabling publish"); enable_publish(laure, FALSE); enable_publish(marie, FALSE); enable_publish(pauline, FALSE); @@ -829,7 +880,7 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) { const char *pauline_identity; MSList* lcs = NULL; int dummy = 0; - lp_config_set_int(laure->lc->config, "sip", "rls_presence_expires", 3); + lp_config_set_int(laure->lc->config, "sip", "rls_presence_expires", 5); pauline_identity = get_identity(pauline); @@ -853,7 +904,7 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) { wait_for_list(lcs, &dummy, 1, 2000); /* Wait a little bit for the subscribe to happen */ enable_publish(pauline, TRUE); - wait_for_list(lcs, &pauline->stat.number_of_NotifyPresenceReceived, 1, 2000); + BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 1, 6000)); BC_ASSERT_GREATER(laure->stat.number_of_NotifyPresenceReceived, 1, int, "%d"); BC_ASSERT_GREATER(laure->lc->friendlist->expected_notification_version, 1, int, "%d"); lf = linphone_friend_list_find_friend_by_uri(laure->lc->friendlist, pauline_identity); @@ -865,25 +916,26 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) { BC_ASSERT_EQUAL(lf->presence_received, FALSE, int, "%d"); BC_ASSERT_EQUAL(lf->subscribe_active, TRUE, int, "%d"); - BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_NotifyPresenceReceived, 2, 5000)); + BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 2, 6000)); if (io_error) { ms_message("Simulating socket error"); sal_set_recv_error(laure->lc->sal, -1); - wait_for_list(lcs, &dummy, 1, 1000); /* just time for socket to be closed */ - + wait_for_list(lcs, &dummy, 1, 500); /* just time for socket to be closed */ } else { ms_message("Simulating in/out packets losses"); sal_set_send_error(laure->lc->sal,1500); /*make sure no refresh is sent, trash the message without generating error*/ sal_set_recv_error(laure->lc->sal, 1500); /*make sure server notify to close the dialog is also ignored*/ - wait_for_list(lcs, &dummy, 1, 3000); /* Wait a little bit for the subscribe to happen */ + wait_for_list(lcs, &dummy, 1, 5000); /* Wait a little bit for the subscribe to happen */ } /*restart normal behavior*/ sal_set_send_error(laure->lc->sal,0); sal_set_recv_error(laure->lc->sal, 1); + BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityVacation, 3, 6000)); /* give time for subscription to recover to avoid to receive 491 Request pending*/ + linphone_core_set_presence_model(pauline->lc, linphone_core_create_presence_model_with_activity(pauline->lc, LinphonePresenceActivityAway, NULL)); - BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_NotifyPresenceReceived, 3, 5000)); + BC_ASSERT_TRUE(wait_for_until(laure->lc, pauline->lc, &laure->stat.number_of_LinphonePresenceActivityAway, 1, 6000)); lf = linphone_friend_list_find_friend_by_uri(laure->lc->friendlist, pauline_identity); BC_ASSERT_EQUAL(linphone_friend_get_status(lf), LinphoneStatusAway, int, "%d"); diff --git a/tester/register_tester.c b/tester/register_tester.c index a8fa71a82..4c062af9e 100644 --- a/tester/register_tester.c +++ b/tester/register_tester.c @@ -235,7 +235,7 @@ static void change_expires(void){ LinphoneProxyConfig* proxy_config; register_with_refresh_base(lcm->lc,FALSE,NULL,NULL); - linphone_core_get_default_proxy(lcm->lc,&proxy_config); + proxy_config = linphone_core_get_default_proxy_config(lcm->lc); linphone_proxy_config_edit(proxy_config); reset_counters(counters); /*clear stats*/ From 2f02f39756d671ea5469b83c7954a8d8d5ccaec3 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 2 Feb 2016 21:07:38 +0100 Subject: [PATCH 50/56] fix build --- coreapi/bellesip_sal/sal_op_impl.c | 2 +- coreapi/proxy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/coreapi/bellesip_sal/sal_op_impl.c b/coreapi/bellesip_sal/sal_op_impl.c index 9fcca24a6..3fabb55ca 100644 --- a/coreapi/bellesip_sal/sal_op_impl.c +++ b/coreapi/bellesip_sal/sal_op_impl.c @@ -794,6 +794,6 @@ int sal_op_refresh(SalOp *op) { belle_sip_refresher_refresh(op->refresher,belle_sip_refresher_get_expires(op->refresher)); return 0; } - ms_warning("sal_refresh on op [%p] of type [%s] no refresher",op,sal_op_type_to_string(op)); + ms_warning("sal_refresh on op [%p] of type [%s] no refresher",op,sal_op_type_to_string(op->type)); return -1; } diff --git a/coreapi/proxy.c b/coreapi/proxy.c index cf16fddea..90c5def90 100644 --- a/coreapi/proxy.c +++ b/coreapi/proxy.c @@ -1119,7 +1119,7 @@ int linphone_proxy_config_send_publish(LinphoneProxyConfig *proxy, LinphonePrese void _linphone_proxy_config_unpublish(LinphoneProxyConfig *obj) { if (obj->long_term_event && (linphone_event_get_publish_state(obj->long_term_event) == LinphonePublishOk || - (linphone_event_get_publish_state(obj->long_term_event) == LinphoneIceStateInProgress && obj->publish_expires != 0))) { + (linphone_event_get_publish_state(obj->long_term_event) == LinphonePublishProgress && obj->publish_expires != 0))) { linphone_event_unpublish(obj->long_term_event); } } From bea1b58e305a95dcc57d7e0f5d247fe62a2ec1b6 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Tue, 2 Feb 2016 21:13:29 +0100 Subject: [PATCH 51/56] fix crash Valgrind backtrace: 2016-02-02 21:08:50:540 ortp-warning-Audio conference MSTicker: We are late of 846 miliseconds. ==42557== Invalid write of size 1 ==42557== at 0x4E9253D: Linphone::RemoteConference::terminate() (conference.cc:729) ==42557== by 0x4EADA34: linphone_core_terminate_conference (linphonecore.c:7533) ==42557== by 0x5171B20: simple_conference_base (multi_call_tester.c:282) ==42557== by 0x5172468: simple_remote_conference (multi_call_tester.c:801) ==42557== by 0x80C76B5: run_single_test (in /usr/local/lib/libcunit.so.1.0.1) ==42557== by 0x80C52F7: CU_run_test (in /usr/local/lib/libcunit.so.1.0.1) ==42557== by 0x5194E7B: bc_tester_run_tests (bc_tester_utils.c:331) ==42557== by 0x400F4A: main (liblinphone_tester.c:245) ==42557== Address 0x1e0a5cc0 is 128 bytes inside a block of size 136 free'd ==42557== at 0x4C2C2BC: operator delete(void*) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==42557== by 0x4EA45BB: linphone_core_conference_state_changed (linphonecore.c:7468) ==42557== by 0x4E9253C: Linphone::RemoteConference::terminate() (conference.cc:723) ==42557== by 0x4EADA34: linphone_core_terminate_conference (linphonecore.c:7533) ==42557== by 0x5171B20: simple_conference_base (multi_call_tester.c:282) ==42557== by 0x5172468: simple_remote_conference (multi_call_tester.c:801) ==42557== by 0x80C76B5: run_single_test (in /usr/local/lib/libcunit.so.1.0.1) ==42557== by 0x80C52F7: CU_run_test (in /usr/local/lib/libcunit.so.1.0.1) ==42557== by 0x5194E7B: bc_tester_run_tests (bc_tester_utils.c:331) ==42557== by 0x400F4A: main (liblinphone_tester.c:245) ==42557== --- coreapi/conference.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/coreapi/conference.cc b/coreapi/conference.cc index a59608b43..fee935b82 100644 --- a/coreapi/conference.cc +++ b/coreapi/conference.cc @@ -720,13 +720,15 @@ int RemoteConference::terminate() { linphone_core_terminate_call(m_core, m_focusCall); reset(); Conference::terminate(); + m_isTerminating = false; setState(LinphoneConferenceStopped); break; default: + m_isTerminating = false; break; } - m_isTerminating = false; + return 0; } From 1db3b9a2978d64dc886c6c7db7b5ed21ee39bbe7 Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 3 Feb 2016 09:34:19 +0100 Subject: [PATCH 52/56] update ms2 --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index e13e34dad..d6f19f74d 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit e13e34dad9d2267e9469dede3f67b8cd1670a2f4 +Subproject commit d6f19f74d8f8a0e38818067fcf8c767fb97a1380 From 439b2a93e3fcbad9def89759ee3fcfa84eb5a50c Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 3 Feb 2016 12:20:14 +0100 Subject: [PATCH 53/56] Update ms2. --- mediastreamer2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mediastreamer2 b/mediastreamer2 index d6f19f74d..dd5ad1b73 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit d6f19f74d8f8a0e38818067fcf8c767fb97a1380 +Subproject commit dd5ad1b738989bc6964f889e17f275eea85e11c0 From c0566bbad0b2079329c95cea81e973394fd1c514 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Wed, 3 Feb 2016 12:35:48 +0100 Subject: [PATCH 54/56] Updating sip_setup_register_all to use ms_factory_load_plugins. --- coreapi/linphonecore.c | 2 +- coreapi/sipsetup.c | 5 +++-- coreapi/sipsetup.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index b4523d41c..815b1f1f2 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -1526,7 +1526,7 @@ static void misc_config_read(LinphoneCore *lc) { } static void linphone_core_start(LinphoneCore * lc) { - sip_setup_register_all(); + sip_setup_register_all(lc->factory); sound_config_read(lc); net_config_read(lc); rtp_config_read(lc); diff --git a/coreapi/sipsetup.c b/coreapi/sipsetup.c index 29ffd46fc..8a5aea58c 100644 --- a/coreapi/sipsetup.c +++ b/coreapi/sipsetup.c @@ -35,9 +35,10 @@ void sip_setup_register(SipSetup *ss){ registered_sip_setups=ms_list_append(registered_sip_setups,ss); } -void sip_setup_register_all(void){ +void sip_setup_register_all(MSFactory *factory){ SipSetup **p=all_sip_setups; - ms_load_plugins(LINPHONE_PLUGINS_DIR); + ms_factory_load_plugins(factory, LINPHONE_PLUGINS_DIR); + //ms_load_plugins(LINPHONE_PLUGINS_DIR); while(*p!=NULL){ sip_setup_register(*p); p++; diff --git a/coreapi/sipsetup.h b/coreapi/sipsetup.h index 63d71d5f1..dd1c48dc7 100644 --- a/coreapi/sipsetup.h +++ b/coreapi/sipsetup.h @@ -132,7 +132,7 @@ void buddy_lookup_request_set_max_results(BuddyLookupRequest *req, int ncount); void sip_setup_register(SipSetup *ss); -void sip_setup_register_all(void); +void sip_setup_register_all(MSFactory* factory); SipSetup *sip_setup_lookup(const char *type_name); void sip_setup_unregister_all(void); LINPHONE_PUBLIC unsigned int sip_setup_get_capabilities(SipSetup *s); From d678615e26cb1c9d078aa157c9bd70de7bc374a7 Mon Sep 17 00:00:00 2001 From: Jehan Monnier Date: Wed, 3 Feb 2016 15:49:25 +0100 Subject: [PATCH 55/56] make sure LinphoneFriend created on core always have core back pointer set --- coreapi/friend.c | 16 ++++++++++++++-- coreapi/linphonefriend.h | 6 ++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/coreapi/friend.c b/coreapi/friend.c index 1c11ab21a..0ba8af361 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -483,13 +483,25 @@ void linphone_friend_done(LinphoneFriend *fr){ linphone_friend_apply(fr,fr->lc); } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic push +#endif +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" LinphoneFriend * linphone_core_create_friend(LinphoneCore *lc) { - return linphone_friend_new(); + LinphoneFriend * lf = linphone_friend_new(); + lf->lc = lc; + return lf; } LinphoneFriend * linphone_core_create_friend_with_address(LinphoneCore *lc, const char *address) { - return linphone_friend_new_with_address(address); + LinphoneFriend * lf = linphone_friend_new_with_address(address); + if (lf) + lf->lc = lc; + return lf; } +#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4) +#pragma GCC diagnostic pop +#endif void linphone_core_add_friend(LinphoneCore *lc, LinphoneFriend *lf) { if ((lc->friendlist == NULL) || (linphone_friend_list_add_friend(lc->friendlist, lf) != LinphoneFriendListOK)) return; diff --git a/coreapi/linphonefriend.h b/coreapi/linphonefriend.h index e158d41b5..f0823eaed 100644 --- a/coreapi/linphonefriend.h +++ b/coreapi/linphonefriend.h @@ -118,15 +118,17 @@ typedef struct _LinphoneFriend LinphoneFriend; /** * Contructor * @return a new empty #LinphoneFriend + * @deprecated use #linphone_core_create_friend instead */ -LINPHONE_PUBLIC LinphoneFriend * linphone_friend_new(void); +LINPHONE_PUBLIC MS2_DEPRECATED LinphoneFriend * linphone_friend_new(void); /*fix me me replace MS2_DEPRECATED by LINPHONE_DEPRECATED*/ /** * Contructor same as linphone_friend_new() + linphone_friend_set_address() * @param addr a buddy address, must be a sip uri like sip:joe@sip.linphone.org * @return a new #LinphoneFriend with \link linphone_friend_get_address() address initialized \endlink + * @deprecated use #linphone_core_create_friend_with_address instead */ -LINPHONE_PUBLIC LinphoneFriend *linphone_friend_new_with_address(const char *addr); +LINPHONE_PUBLIC MS2_DEPRECATED LinphoneFriend *linphone_friend_new_with_address(const char *addr); /*fix me me replace MS2_DEPRECATED by LINPHONE_DEPRECATED*/ /** * Contructor same as linphone_friend_new() + linphone_friend_set_address() From 86d8674d8023bc8081bd1483cafccb26d3b612fa Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Wed, 3 Feb 2016 16:36:50 +0100 Subject: [PATCH 56/56] fix LINPHONE_DEPRECATED --- coreapi/linphonecore.h | 56 ++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 30 deletions(-) diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index bf8e5af31..0e7fc8100 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -38,15 +38,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define LINPHONE_HOSTNAME_SIZE 128 #ifndef LINPHONE_PUBLIC - #define LINPHONE_PUBLIC MS2_PUBLIC +#define LINPHONE_PUBLIC MS2_PUBLIC #endif -#ifndef MS2_DEPRECATED -#if defined(_MSC_VER) - #define MS2_DEPRECATED __declspec(deprecated) -#else - #define MS2_DEPRECATED __attribute__ ((deprecated)) -#endif +#ifndef LINPHONE_DEPRECATED +#define LINPHONE_DEPRECATED MS2_DEPRECATED #endif @@ -896,7 +892,7 @@ LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call * @deprecated Use linphone_call_get_conference() instead. * @ingroup call_control */ -LINPHONE_PUBLIC MS2_DEPRECATED bool_t linphone_call_is_in_conference(const LinphoneCall *call); +LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_call_is_in_conference(const LinphoneCall *call); /** * Return the associated conference object @@ -1336,7 +1332,7 @@ LINPHONE_PUBLIC bool_t linphone_core_chat_enabled(const LinphoneCore *lc); * @param cr #LinphoneChatRoom object * @deprecated Use linphone_chat_room_unref() instead. */ -LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_room_destroy(LinphoneChatRoom *cr); +LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_room_destroy(LinphoneChatRoom *cr); /** * Create a message attached to a dedicated chat room; * @param cr the chat room. @@ -1406,7 +1402,7 @@ LINPHONE_PUBLIC const LinphoneAddress* linphone_chat_room_get_peer_address(Linph * @param cr #LinphoneChatRoom object * @param msg message to be sent */ -LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg); +LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_room_send_message(LinphoneChatRoom *cr, const char *msg); /** * Send a message to peer member of this chat room. * @param cr #LinphoneChatRoom object @@ -1417,7 +1413,7 @@ LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_room_send_message(LinphoneChat * @note The LinphoneChatMessage must not be destroyed until the the callback is called. * The LinphoneChatMessage reference is transfered to the function and thus doesn't need to be unref'd by the application. */ -LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangedCb status_cb,void* ud); +LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage* msg,LinphoneChatMessageStateChangedCb status_cb,void* ud); /** * Send a message to peer member of this chat room. * @param[in] cr LinphoneChatRoom object @@ -1492,7 +1488,7 @@ LINPHONE_PUBLIC int linphone_chat_room_get_unread_messages_count(LinphoneChatRoo * Returns back pointer to LinphoneCore object. * @deprecated use linphone_chat_room_get_core() **/ -LINPHONE_PUBLIC MS2_DEPRECATED LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr); +LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneCore* linphone_chat_room_get_lc(LinphoneChatRoom *cr); /** * Returns back pointer to LinphoneCore object. **/ @@ -1601,7 +1597,7 @@ LINPHONE_PUBLIC const LinphoneContent* linphone_chat_message_get_file_transfer_i * @param status_cb LinphoneChatMessageStateChangeCb status callback invoked when file is downloaded or could not be downloaded * @deprecated Use linphone_chat_message_download_file() instead. */ -LINPHONE_PUBLIC MS2_DEPRECATED void linphone_chat_message_start_file_download(LinphoneChatMessage* message, LinphoneChatMessageStateChangedCb status_cb, void* ud); +LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_chat_message_start_file_download(LinphoneChatMessage* message, LinphoneChatMessageStateChangedCb status_cb, void* ud); /** * Start the download of the file referenced in a LinphoneChatMessage from remote server. * @param[in] message LinphoneChatMessage object. @@ -2091,15 +2087,15 @@ typedef struct _LinphoneCoreVTable{ LinphoneCoreNotifyReceivedCb notify_received; /**< Notifies a an event notification, see linphone_core_subscribe() */ LinphoneCorePublishStateChangedCb publish_state_changed;/**Notifies publish state change (only from #LinphoneEvent api)*/ LinphoneCoreConfiguringStatusCb configuring_status; /** Notifies configuring status changes */ - MS2_DEPRECATED DisplayStatusCb display_status; /**< @deprecated Callback that notifies various events with human readable text.*/ - MS2_DEPRECATED DisplayMessageCb display_message;/**< @deprecated Callback to display a message to the user */ - MS2_DEPRECATED DisplayMessageCb display_warning;/**< @deprecated Callback to display a warning to the user */ - MS2_DEPRECATED DisplayUrlCb display_url; /**< @deprecated */ - MS2_DEPRECATED ShowInterfaceCb show; /**< @deprecated Notifies the application that it should show up*/ - MS2_DEPRECATED LinphoneCoreTextMessageReceivedCb text_received; /**< @deprecated, use #message_received instead
A text message has been received */ - MS2_DEPRECATED LinphoneCoreFileTransferRecvCb file_transfer_recv; /**< @deprecated Callback to store file received attached to a #LinphoneChatMessage */ - MS2_DEPRECATED LinphoneCoreFileTransferSendCb file_transfer_send; /**< @deprecated Callback to collect file chunk to be sent for a #LinphoneChatMessage */ - MS2_DEPRECATED LinphoneCoreFileTransferProgressIndicationCb file_transfer_progress_indication; /**< @deprecated Callback to indicate file transfer progress */ + LINPHONE_DEPRECATED DisplayStatusCb display_status; /**< @deprecated Callback that notifies various events with human readable text.*/ + LINPHONE_DEPRECATED DisplayMessageCb display_message;/**< @deprecated Callback to display a message to the user */ + LINPHONE_DEPRECATED DisplayMessageCb display_warning;/**< @deprecated Callback to display a warning to the user */ + LINPHONE_DEPRECATED DisplayUrlCb display_url; /**< @deprecated */ + LINPHONE_DEPRECATED ShowInterfaceCb show; /**< @deprecated Notifies the application that it should show up*/ + LINPHONE_DEPRECATED LinphoneCoreTextMessageReceivedCb text_received; /**< @deprecated, use #message_received instead
A text message has been received */ + LINPHONE_DEPRECATED LinphoneCoreFileTransferRecvCb file_transfer_recv; /**< @deprecated Callback to store file received attached to a #LinphoneChatMessage */ + LINPHONE_DEPRECATED LinphoneCoreFileTransferSendCb file_transfer_send; /**< @deprecated Callback to collect file chunk to be sent for a #LinphoneChatMessage */ + LINPHONE_DEPRECATED LinphoneCoreFileTransferProgressIndicationCb file_transfer_progress_indication; /**< @deprecated Callback to indicate file transfer progress */ LinphoneCoreNetworkReachableCb network_reachable; /**< Callback to report IP network status (I.E up/down )*/ LinphoneCoreLogCollectionUploadStateChangedCb log_collection_upload_state_changed; /**< Callback to upload collected logs */ LinphoneCoreLogCollectionUploadProgressIndicationCb log_collection_upload_progress_indication; /**< Callback to indicate log collection upload progress */ @@ -2357,11 +2353,11 @@ LINPHONE_PUBLIC const char *linphone_core_get_user_agent(LinphoneCore *lc); /** * @deprecated Use #linphone_core_get_user_agent instead. **/ -LINPHONE_PUBLIC MS2_DEPRECATED const char *linphone_core_get_user_agent_name(void); +LINPHONE_PUBLIC LINPHONE_DEPRECATED const char *linphone_core_get_user_agent_name(void); /** * @deprecated Use #linphone_core_get_user_agent instead. **/ -LINPHONE_PUBLIC MS2_DEPRECATED const char *linphone_core_get_user_agent_version(void); +LINPHONE_PUBLIC LINPHONE_DEPRECATED const char *linphone_core_get_user_agent_version(void); /** * Instanciates a LinphoneCore object. @@ -2533,7 +2529,7 @@ LINPHONE_PUBLIC LinphoneCall *linphone_core_get_call_by_remote_address2(Linphone * @param dtmf The dtmf name specified as a char, such as '0', '#' etc... * **/ -LINPHONE_PUBLIC MS2_DEPRECATED void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf); +LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_send_dtmf(LinphoneCore *lc,char dtmf); /** * Sets the local "from" identity. @@ -2906,7 +2902,7 @@ LINPHONE_PUBLIC void linphone_core_set_default_proxy_index(LinphoneCore *lc, int * @return the default proxy configuration, that is the one used to determine the current identity. * @deprecated Use linphone_core_get_default_proxy_config() instead. **/ -LINPHONE_PUBLIC MS2_DEPRECATED int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config); +LINPHONE_PUBLIC LINPHONE_DEPRECATED int linphone_core_get_default_proxy(LinphoneCore *lc, LinphoneProxyConfig **config); /** * @return the default proxy configuration, that is the one used to determine the current identity. @@ -3271,13 +3267,13 @@ bool_t linphone_core_agc_enabled(const LinphoneCore *lc); /** * @deprecated Use #linphone_core_enable_mic instead. **/ -LINPHONE_PUBLIC MS2_DEPRECATED void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted); +LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_mute_mic(LinphoneCore *lc, bool_t muted); /** * Get mic state. * @deprecated Use #linphone_core_mic_enabled instead **/ -LINPHONE_PUBLIC MS2_DEPRECATED bool_t linphone_core_is_mic_muted(LinphoneCore *lc); +LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_core_is_mic_muted(LinphoneCore *lc); /** * Enable or disable the microphone. @@ -3405,7 +3401,7 @@ LINPHONE_PUBLIC bool_t linphone_core_video_supported(LinphoneCore *lc); * @ingroup media_parameters * @deprecated Use #linphone_core_enable_video_capture and #linphone_core_enable_video_display instead. **/ -LINPHONE_PUBLIC MS2_DEPRECATED void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled); +LINPHONE_PUBLIC LINPHONE_DEPRECATED void linphone_core_enable_video(LinphoneCore *lc, bool_t vcap_enabled, bool_t display_enabled); /** * Returns TRUE if either capture or display is enabled, FALSE otherwise. @@ -4395,7 +4391,7 @@ LINPHONE_PUBLIC LinphoneTransportType linphone_transport_parse(const char* trans * @return LinphoneCallParams * @deprecated use linphone_core_create_call_params() */ -LINPHONE_PUBLIC MS2_DEPRECATED LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc); +LINPHONE_PUBLIC LINPHONE_DEPRECATED LinphoneCallParams *linphone_core_create_default_call_parameters(LinphoneCore *lc); typedef struct _LinphoneRingtonePlayer LinphoneRingtonePlayer;