mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Improved logs for preferred audio device debugging
This commit is contained in:
parent
bbd34dfdcc
commit
3082c5d6ad
1 changed files with 41 additions and 15 deletions
|
|
@ -56,22 +56,48 @@ class AudioRouteUtils {
|
|||
AudioDevice.Capabilities.CapabilityPlay
|
||||
else
|
||||
AudioDevice.Capabilities.CapabilityRecord
|
||||
|
||||
for (audioDevice in coreContext.core.audioDevices) {
|
||||
if (types.contains(audioDevice.type) && audioDevice.hasCapability(capability)) {
|
||||
if (conference != null && conference.isIn) {
|
||||
Log.i("[Audio Route Helper] Found [${audioDevice.type}] ${if (output) "playback" else "recorder"} audio device [${audioDevice.deviceName}], routing conference audio to it")
|
||||
if (output) conference.outputAudioDevice = audioDevice
|
||||
else conference.inputAudioDevice = audioDevice
|
||||
} else {
|
||||
Log.i("[Audio Route Helper] Found [${audioDevice.type}] ${if (output) "playback" else "recorder"} audio device [${audioDevice.deviceName}], routing call audio to it")
|
||||
if (output) currentCall.outputAudioDevice = audioDevice
|
||||
else currentCall.inputAudioDevice = audioDevice
|
||||
}
|
||||
return
|
||||
}
|
||||
val preferredDriver = if (output) {
|
||||
coreContext.core.defaultOutputAudioDevice.driverName
|
||||
} else {
|
||||
coreContext.core.defaultInputAudioDevice.driverName
|
||||
}
|
||||
|
||||
val extendedAudioDevices = coreContext.core.extendedAudioDevices
|
||||
Log.i("[Audio Route Helper] Looking for an ${if (output) "output" else "input"} audio device with capability [$capability], driver name [$preferredDriver] and type [$types] in extended audio devices list (size ${extendedAudioDevices.size})")
|
||||
val foundAudioDevice = extendedAudioDevices.find {
|
||||
it.driverName == preferredDriver && types.contains(it.type) && it.hasCapability(capability)
|
||||
}
|
||||
val audioDevice = if (foundAudioDevice == null) {
|
||||
Log.w("[Audio Route Helper] Failed to find an audio device with capability [$capability], driver name [$preferredDriver] and type [$types]")
|
||||
extendedAudioDevices.find {
|
||||
types.contains(it.type) && it.hasCapability(capability)
|
||||
}
|
||||
} else {
|
||||
foundAudioDevice
|
||||
}
|
||||
|
||||
if (audioDevice == null) {
|
||||
Log.e("[Audio Route Helper] Couldn't find audio device with capability [$capability] and type [$types]")
|
||||
for (device in extendedAudioDevices) {
|
||||
// TODO: switch to debug?
|
||||
Log.i("[Audio Route Helper] Extended audio device: [${device.deviceName} (${device.driverName}) ${device.type} / ${device.capabilities}]")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
if (conference != null && conference.isIn) {
|
||||
Log.i("[Audio Route Helper] Found [${audioDevice.type}] ${if (output) "playback" else "recorder"} audio device [${audioDevice.deviceName} (${audioDevice.driverName})], routing conference audio to it")
|
||||
if (output) conference.outputAudioDevice = audioDevice
|
||||
else conference.inputAudioDevice = audioDevice
|
||||
} else if (currentCall != null) {
|
||||
Log.i("[Audio Route Helper] Found [${audioDevice.type}] ${if (output) "playback" else "recorder"} audio device [${audioDevice.deviceName} (${audioDevice.driverName})], routing call audio to it")
|
||||
if (output) currentCall.outputAudioDevice = audioDevice
|
||||
else currentCall.inputAudioDevice = audioDevice
|
||||
} else {
|
||||
Log.i("[Audio Route Helper] Found [${audioDevice.type}] ${if (output) "playback" else "recorder"} audio device [${audioDevice.deviceName} (${audioDevice.driverName})], changing core default audio device")
|
||||
if (output) coreContext.core.outputAudioDevice = audioDevice
|
||||
else coreContext.core.inputAudioDevice = audioDevice
|
||||
}
|
||||
Log.e("[Audio Route Helper] Couldn't find [$typesNames] audio device")
|
||||
}
|
||||
|
||||
private fun changeCaptureDeviceToMatchAudioRoute(call: Call?, types: List<AudioDevice.Type>) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue