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; }