mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-21 05:28:08 +00:00
Fixed crash in audio route utils
This commit is contained in:
parent
2d220dd01a
commit
9b934f8f15
1 changed files with 7 additions and 8 deletions
|
|
@ -96,11 +96,10 @@ class AudioRouteUtils {
|
|||
types: List<AudioDevice.Type>,
|
||||
skipTelecom: Boolean = false
|
||||
) {
|
||||
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls[0]
|
||||
if ((call != null || currentCall != null) && !skipTelecom && TelecomHelper.exists()) {
|
||||
val callToUse = call ?: currentCall
|
||||
val currentCall = call ?: coreContext.core.currentCall ?: coreContext.core.calls.firstOrNull()
|
||||
if (currentCall != null && !skipTelecom && TelecomHelper.exists()) {
|
||||
Log.i("[Audio Route Helper] Call provided & Telecom Helper exists, trying to dispatch audio route change through Telecom API")
|
||||
val connection = TelecomHelper.get().findConnectionForCallId(callToUse.callLog.callId)
|
||||
val connection = TelecomHelper.get().findConnectionForCallId(currentCall.callLog.callId)
|
||||
if (connection != null) {
|
||||
val route = when (types.first()) {
|
||||
AudioDevice.Type.Earpiece -> CallAudioState.ROUTE_EARPIECE
|
||||
|
|
@ -114,13 +113,13 @@ class AudioRouteUtils {
|
|||
// but this time with skipTelecom = true
|
||||
if (!Compatibility.changeAudioRouteForTelecomManager(connection, route)) {
|
||||
Log.w("[Audio Route Helper] Connection is already using this route internally, make the change!")
|
||||
applyAudioRouteChange(callToUse, types)
|
||||
changeCaptureDeviceToMatchAudioRoute(callToUse, types)
|
||||
applyAudioRouteChange(currentCall, types)
|
||||
changeCaptureDeviceToMatchAudioRoute(currentCall, types)
|
||||
}
|
||||
} else {
|
||||
Log.w("[Audio Route Helper] Telecom Helper found but no matching connection!")
|
||||
applyAudioRouteChange(callToUse, types)
|
||||
changeCaptureDeviceToMatchAudioRoute(callToUse, types)
|
||||
applyAudioRouteChange(currentCall, types)
|
||||
changeCaptureDeviceToMatchAudioRoute(currentCall, types)
|
||||
}
|
||||
} else {
|
||||
applyAudioRouteChange(call, types)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue