From 93d57e992639d193e86447806902935b18b66f8b Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Mon, 16 Oct 2017 11:21:47 +0200 Subject: [PATCH] Added methods in core required for Android --- coreapi/ec-calibrator.c | 19 +++++++++++++++++++ coreapi/linphonecore.c | 9 +++++++++ include/linphone/core_utils.h | 26 ++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) diff --git a/coreapi/ec-calibrator.c b/coreapi/ec-calibrator.c index 4a8ee1282..0c1ce7212 100644 --- a/coreapi/ec-calibrator.c +++ b/coreapi/ec-calibrator.c @@ -324,3 +324,22 @@ int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibration ec_calibrator_start(lc->ecc); return 0; } + +bool_t linphone_core_has_builtin_echo_canceller(LinphoneCore *lc) { + MSFactory * factory = linphone_core_get_ms_factory(lc); + MSDevicesInfo *devices = ms_factory_get_devices_info(factory); + SoundDeviceDescription *sound_description = ms_devices_info_get_sound_device_description(devices); + if (sound_description == NULL) return FALSE; + if (sound_description->flags & DEVICE_HAS_BUILTIN_AEC) return TRUE; + return FALSE; +} + +bool_t linphone_core_is_echo_canceller_calibration_required(LinphoneCore *lc) { + MSFactory * factory = linphone_core_get_ms_factory(lc); + MSDevicesInfo *devices = ms_factory_get_devices_info(factory); + SoundDeviceDescription *sound_description = ms_devices_info_get_sound_device_description(devices); + if (sound_description == NULL) return TRUE; + if (sound_description->flags & DEVICE_HAS_BUILTIN_AEC) return FALSE; + if (sound_description->delay != 0) return FALSE; + return TRUE; +} diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index dbe706d4c..ea0417a84 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -7371,3 +7371,12 @@ void linphone_core_check_for_update(LinphoneCore *lc, const char *current_versio } #endif } + +bool_t linphone_core_has_crappy_opengl(LinphoneCore *lc) { + MSFactory * factory = linphone_core_get_ms_factory(lc); + MSDevicesInfo *devices = ms_factory_get_devices_info(factory); + SoundDeviceDescription *sound_description = ms_devices_info_get_sound_device_description(devices); + if (sound_description == NULL) return FALSE; + if (sound_description->flags & DEVICE_HAS_CRAPPY_OPENGL) return TRUE; + return FALSE; +} \ No newline at end of file diff --git a/include/linphone/core_utils.h b/include/linphone/core_utils.h index 52cd791bd..d72f41ded 100644 --- a/include/linphone/core_utils.h +++ b/include/linphone/core_utils.h @@ -59,16 +59,42 @@ typedef void (*LinphoneEcCalibrationAudioUninit)(void *data); **/ LINPHONE_PUBLIC int linphone_core_start_echo_calibration(LinphoneCore *lc, LinphoneEcCalibrationCallback cb, LinphoneEcCalibrationAudioInit audio_init_cb, LinphoneEcCalibrationAudioUninit audio_uninit_cb, void *cb_data); + /** * Start the simulation of call to test the latency with an external device * @param lc The core. * @param rate Sound sample rate. + * @ingroup misc **/ LINPHONE_PUBLIC LinphoneStatus linphone_core_start_echo_tester(LinphoneCore *lc, unsigned int rate); + /** * Stop the simulation of call + * @ingroup misc **/ LINPHONE_PUBLIC LinphoneStatus linphone_core_stop_echo_tester(LinphoneCore *lc); + +/** + * Check whether the device is flagged has crappy opengl + * @returns TRUE if crappy opengl flag is set, FALSE otherwise + * @ingroup misc +**/ +LINPHONE_PUBLIC bool_t linphone_core_has_crappy_opengl(LinphoneCore *lc); + +/** + * Check whether the device has a hardware echo canceller + * @returns TRUE if it does, FALSE otherwise + * @ingroup misc +**/ +LINPHONE_PUBLIC bool_t linphone_core_has_builtin_echo_canceller(LinphoneCore *lc); + +/** + * Check whether the device is echo canceller calibration is required + * @returns TRUE if it is required, FALSE otherwise + * @ingroup misc +**/ +LINPHONE_PUBLIC bool_t linphone_core_is_echo_canceller_calibration_required(LinphoneCore *lc); + /** * @ingroup IOS * Special function to warm up dtmf feeback stream. #linphone_core_stop_dtmf_stream must() be called before entering FG mode