Commit 0b0bb804 authored by DanmeiChen's avatar DanmeiChen
Browse files

notify ms2 to update resampler to fix lost of sound when audio route changed

parent 6f64132d
......@@ -17,6 +17,7 @@ This changelog file was started on October 2019. Previous changes were more or l
- Handling push notifications, activity monitor and Core iterate automatically in Core for Android.
- Auto acquire and release of audio focus for Android.
- Added API to play user's ringtone instead of default ringtone for Android.
- New method linphone_core_audio_route_changed(), to fix audio issues when switching audio to some low sample rate Bluetooth devices.
### Changed
- Improved Android network manager.
......
......@@ -7033,8 +7033,12 @@ void linphone_core_enable_callkit (LinphoneCore *lc, bool_t enabled) {
linphone_config_set_int(lc->config, "app", "use_callkit", (int)enabled);
}
bool_t linphone_core_callkit_enabled (const LinphoneCore *lc) {
return (bool_t)linphone_config_get_int(lc->config, "app", "use_callkit", 0);
void linphone_core_audio_route_changed (LinphoneCore *core) {
L_GET_CPP_PTR_FROM_C_OBJECT(core)->soundcardAudioRouteChanged();
}
bool_t linphone_core_callkit_enabled (const LinphoneCore *core) {
return (bool_t)linphone_config_get_int(core->config, "app", "use_callkit", 0);
}
void linphone_core_set_remote_ringback_tone(LinphoneCore *lc, const char *file){
......
......@@ -146,13 +146,20 @@ LINPHONE_PUBLIC void linphone_core_activate_audio_session(LinphoneCore* core, bo
*/
LINPHONE_PUBLIC void linphone_core_enable_callkit (LinphoneCore* core, bool_t enabled);
/**
* Special function to indicate if the audio route is changed. Must be called in the callback of AVAudioSessionRouteChangeNotification.
* @param core The #LinphoneCore object. @notnil
* @ingroup IOS
*/
LINPHONE_PUBLIC void linphone_core_audio_route_changed (LinphoneCore *core);
/**
* Special function to check if the callkit is enabled, False by default.
* @param core The #LinphoneCore object. @notnil
* @return TRUE if callkit is enabled, FALSE otherwise.
* @ingroup IOS
*/
LINPHONE_PUBLIC bool_t linphone_core_callkit_enabled (const LinphoneCore *lc);
LINPHONE_PUBLIC bool_t linphone_core_callkit_enabled (const LinphoneCore *core);
typedef bool_t (*LinphoneCoreIterateHook)(void *data);
......
......@@ -265,6 +265,13 @@ void Core::soundcardEnableCallkit (bool enabled) {
}
}
void Core::soundcardAudioRouteChanged () {
MSSndCard *card = getCCore()->sound_conf.capt_sndcard;
if (card) {
ms_snd_card_notify_audio_route_changed(card);
}
}
LinphoneStatus Core::terminateAllCalls () {
L_D();
auto calls = d->calls;
......
......@@ -127,6 +127,7 @@ public:
void soundcardHintCheck ();
void soundcardActivateAudioSession (bool active);
void soundcardEnableCallkit (bool enabled);
void soundcardAudioRouteChanged ();
LinphoneStatus terminateAllCalls ();
// ---------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment