Commit c6c84e06 authored by Andrea Gianarda's avatar Andrea Gianarda
Browse files

If the audio focus is lost, then:

- pause all calls if core is not in conference
- leave conference if core is in
parent 3476c05a
......@@ -774,6 +774,7 @@ void LocalConference::removeLocalEndpoint () {
void LocalConference::leave () {
if (isIn()) {
lInfo() << getMe()->getAddress() << " is leaving conference " << getConferenceAddress();
confParams->enableLocalParticipant(false);
removeLocalEndpoint();
}
......@@ -1162,13 +1163,14 @@ void RemoteConference::leave () {
LinphoneCallState callState = static_cast<LinphoneCallState>(m_focusCall->getState());
switch (callState) {
case LinphoneCallPaused:
lInfo() << getMe()->getAddress() << " is leaving conference " << getConferenceAddress() << " while focus call is paused.";
break;
case LinphoneCallStreamsRunning:
lInfo() << getMe()->getAddress() << " is leaving conference " << getConferenceAddress() << ". Focus call is going to be paused.";
m_focusCall->pause();
break;
default:
ms_error("Could not leave the conference: bad focus call state (%s)",
linphone_call_state_to_string(callState));
lError() << getMe()->getAddress() << " cannot leave conference " << getConferenceAddress() << " because focus call is in state " << linphone_call_state_to_string(callState);
}
}
......
......@@ -403,8 +403,6 @@ LinphoneEcCalibratorStatus ec_calibrator_get_status(EcCalibrator *ecc);
void ec_calibrator_destroy(EcCalibrator *ecc);
int linphone_core_preempt_sound_resources(LinphoneCore *lc);
/*conferencing subsystem*/
void _post_configure_audio_stream(AudioStream *st, LinphoneCore *lc, bool_t muted);
bool_t linphone_core_sound_resources_available(LinphoneCore *lc);
......
......@@ -3936,6 +3936,14 @@ LINPHONE_PUBLIC void linphone_core_enable_conference_server (LinphoneCore *core,
*/
LINPHONE_PUBLIC bool_t linphone_core_conference_server_enabled (const LinphoneCore *core);
/**
* Empties sound resources to allow a new call to be accepted.
* This function is autyomatically called by the core if the media resource mode is set to unique.
* @param core A #LinphoneCore object @notnil
* @return An integer returning the exit value. If it is 0, sound resources have been emptied. Otherwise, sound resources are busy and cannot be freed immediately.
*/
LINPHONE_PUBLIC int linphone_core_preempt_sound_resources(LinphoneCore *core);
/**
* Sets the media resources mode. Value values are: unique and shared.
* When the mode is set to unique, then only one call in the state StreamsRunning is allowed. While acepting a call, the core will try to free media resource used by the current call. If it is unsuccessful, then the call is not accepted.
......
......@@ -254,9 +254,14 @@ public class CoreManager {
}
public void onAudioFocusLost() {
Log.i("[Core Manager] App has lost audio focus, pausing all calls");
if (mCore != null) {
mCore.pauseAllCalls();
if (mCore.isInConference()) {
Log.i("[Core Manager] App has lost audio focus, leaving conference");
mCore.leaveConference();
} else {
Log.i("[Core Manager] App has lost audio focus, pausing all calls");
mCore.pauseAllCalls();
}
}
}
......
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