From 63a16edcadc7b11cd2941ae476586a91b318cbb0 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini <sylvain.berfini@belledonne-communications.com> Date: Thu, 18 Jan 2018 19:01:18 +0100 Subject: [PATCH] Fixed Android video devices --- coreapi/linphonecore.c | 7 +++++-- src/sal/sal.h | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index f87fe9cbf2..d2aada0622 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -2235,8 +2235,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig // We need the Sal on the Android platform helper init msplugins_dir = linphone_factory_get_msplugins_dir(lfactory); image_resources_dir = linphone_factory_get_image_resources_dir(lfactory); - lc->factory = ms_factory_new_with_voip_and_directories(msplugins_dir, image_resources_dir); - lc->sal=new Sal(lc->factory); + lc->sal=new Sal(NULL); lc->sal->set_http_proxy_host(linphone_core_get_http_proxy_host(lc)); lc->sal->set_http_proxy_port(linphone_core_get_http_proxy_port(lc)); @@ -2250,6 +2249,10 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig if (lc->platform_helper == NULL) lc->platform_helper = new LinphonePrivate::StubbedPlatformHelpers(lc); + // MS Factory MUST be created after Android has been set, otherwise no camera will be detected ! + lc->factory = ms_factory_new_with_voip_and_directories(msplugins_dir, image_resources_dir); + lc->sal->set_factory(lc->factory); + belr::GrammarLoader::get().addPath(getPlatformHelpers(lc)->getDataPath()); linphone_task_list_init(&lc->hooks); diff --git a/src/sal/sal.h b/src/sal/sal.h index 9d41b04b7e..bf9322d484 100644 --- a/src/sal/sal.h +++ b/src/sal/sal.h @@ -114,6 +114,10 @@ public: Sal(MSFactory *factory); ~Sal(); + void set_factory(MSFactory *factory) { + this->factory = factory; + } + void set_user_pointer(void *user_data) {this->up=user_data;} void *get_user_pointer() const {return this->up;} -- GitLab