mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Trying to prevent BT not being used automatically when it connects during a call + improved AudioUtils logs
This commit is contained in:
parent
231d75e899
commit
eceb5393e8
2 changed files with 9 additions and 4 deletions
|
|
@ -48,6 +48,8 @@ class TelecomCallControlCallback(
|
||||||
) {
|
) {
|
||||||
companion object {
|
companion object {
|
||||||
private const val TAG = "[Telecom Call Control Callback]"
|
private const val TAG = "[Telecom Call Control Callback]"
|
||||||
|
|
||||||
|
private const val DELAY_BEFORE_RELOADING_SOUND_DEVICES_MS = 100L
|
||||||
}
|
}
|
||||||
|
|
||||||
private var availableEndpoints: List<CallEndpointCompat> = arrayListOf()
|
private var availableEndpoints: List<CallEndpointCompat> = arrayListOf()
|
||||||
|
|
@ -124,12 +126,12 @@ class TelecomCallControlCallback(
|
||||||
Log.i("$TAG New available audio endpoints list")
|
Log.i("$TAG New available audio endpoints list")
|
||||||
if (availableEndpoints != list) {
|
if (availableEndpoints != list) {
|
||||||
Log.i(
|
Log.i(
|
||||||
"$TAG List size of available audio endpoints has changed, reload sound devices in SDK in 500ms"
|
"$TAG List size of available audio endpoints has changed, reload sound devices in SDK in [$DELAY_BEFORE_RELOADING_SOUND_DEVICES_MS] ms"
|
||||||
)
|
)
|
||||||
coreContext.postOnCoreThreadDelayed({ core ->
|
coreContext.postOnCoreThreadDelayed({ core ->
|
||||||
core.reloadSoundDevices()
|
core.reloadSoundDevices()
|
||||||
Log.i("$TAG Sound devices reloaded")
|
Log.i("$TAG Sound devices reloaded")
|
||||||
}, 500)
|
}, DELAY_BEFORE_RELOADING_SOUND_DEVICES_MS)
|
||||||
}
|
}
|
||||||
|
|
||||||
availableEndpoints = list
|
availableEndpoints = list
|
||||||
|
|
|
||||||
|
|
@ -92,16 +92,19 @@ class AudioUtils {
|
||||||
|
|
||||||
if (!skipTelecom) {
|
if (!skipTelecom) {
|
||||||
val callId = currentCall?.callLog?.callId.orEmpty()
|
val callId = currentCall?.callLog?.callId.orEmpty()
|
||||||
|
Log.i("$TAG Trying to change audio endpoint using Telecom Manager APIs")
|
||||||
val success = coreContext.telecomManager.applyAudioRouteToCallWithId(types, callId)
|
val success = coreContext.telecomManager.applyAudioRouteToCallWithId(types, callId)
|
||||||
if (!success) {
|
if (!success) {
|
||||||
Log.w("$TAG Failed to change audio endpoint to [$types] for call ID [$callId]")
|
Log.w("$TAG Failed to change audio endpoint to [$types] for call ID [$callId]")
|
||||||
applyAudioRouteChange(currentCall, types, output, skipTelecom = true)
|
applyAudioRouteChange(currentCall, types, output, skipTelecom = true)
|
||||||
} else {
|
} else {
|
||||||
|
Log.i("$TAG It seems audio endpoint update using Telecom Manager was successful")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Log.i("$TAG Trying to change audio endpoint directly in Linphone SDK")
|
||||||
|
applyAudioRouteChangeInLinphone(currentCall, types, output)
|
||||||
}
|
}
|
||||||
|
|
||||||
applyAudioRouteChangeInLinphone(currentCall, types, output)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun applyAudioRouteChangeInLinphone(
|
fun applyAudioRouteChangeInLinphone(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue