mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-04-28 13:46:21 +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
|
AudioDevice.Capabilities.CapabilityPlay
|
||||||
else
|
else
|
||||||
AudioDevice.Capabilities.CapabilityRecord
|
AudioDevice.Capabilities.CapabilityRecord
|
||||||
|
val preferredDriver = if (output) {
|
||||||
for (audioDevice in coreContext.core.audioDevices) {
|
coreContext.core.defaultOutputAudioDevice.driverName
|
||||||
if (types.contains(audioDevice.type) && audioDevice.hasCapability(capability)) {
|
} else {
|
||||||
if (conference != null && conference.isIn) {
|
coreContext.core.defaultInputAudioDevice.driverName
|
||||||
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
|
val extendedAudioDevices = coreContext.core.extendedAudioDevices
|
||||||
} else {
|
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})")
|
||||||
Log.i("[Audio Route Helper] Found [${audioDevice.type}] ${if (output) "playback" else "recorder"} audio device [${audioDevice.deviceName}], routing call audio to it")
|
val foundAudioDevice = extendedAudioDevices.find {
|
||||||
if (output) currentCall.outputAudioDevice = audioDevice
|
it.driverName == preferredDriver && types.contains(it.type) && it.hasCapability(capability)
|
||||||
else currentCall.inputAudioDevice = audioDevice
|
}
|
||||||
}
|
val audioDevice = if (foundAudioDevice == null) {
|
||||||
return
|
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>) {
|
private fun changeCaptureDeviceToMatchAudioRoute(call: Call?, types: List<AudioDevice.Type>) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue