Removed from AudioRouteUtils code that was changing microphone sound device when changing the playback sound card, SDK is doing that automatically now

This commit is contained in:
Sylvain Berfini 2023-12-20 08:50:28 +01:00
parent e1714934b4
commit b438090092

View file

@ -114,40 +114,6 @@ class AudioRouteUtils {
} }
} }
private fun changeCaptureDeviceToMatchAudioRoute(call: Call?, types: List<AudioDevice.Type>) {
when (types.first()) {
AudioDevice.Type.Bluetooth, AudioDevice.Type.HearingAid -> {
if (isBluetoothAudioRecorderAvailable()) {
Log.i(
"[Audio Route Helper] Bluetooth device is able to record audio, also change input audio device"
)
applyAudioRouteChange(call, arrayListOf(AudioDevice.Type.Bluetooth), false)
}
}
AudioDevice.Type.Headset, AudioDevice.Type.Headphones -> {
if (isHeadsetAudioRecorderAvailable()) {
Log.i(
"[Audio Route Helper] Headphones/Headset device is able to record audio, also change input audio device"
)
applyAudioRouteChange(
call,
(arrayListOf(AudioDevice.Type.Headphones, AudioDevice.Type.Headset)),
false
)
}
}
AudioDevice.Type.Earpiece, AudioDevice.Type.Speaker -> {
Log.i(
"[Audio Route Helper] Audio route requested to Earpiece or Speaker, setting input to Microphone"
)
applyAudioRouteChange(call, (arrayListOf(AudioDevice.Type.Microphone)), false)
}
else -> {
Log.w("[Audio Route Helper] Unexpected audio device type: ${types.first()}")
}
}
}
private fun routeAudioTo( private fun routeAudioTo(
call: Call?, call: Call?,
types: List<AudioDevice.Type>, types: List<AudioDevice.Type>,
@ -179,16 +145,13 @@ class AudioRouteUtils {
"[Audio Route Helper] Connection is already using this route internally, make the change!" "[Audio Route Helper] Connection is already using this route internally, make the change!"
) )
applyAudioRouteChange(currentCall, types) applyAudioRouteChange(currentCall, types)
changeCaptureDeviceToMatchAudioRoute(currentCall, types)
} }
} else { } else {
Log.w("[Audio Route Helper] Telecom Helper found but no matching connection!") Log.w("[Audio Route Helper] Telecom Helper found but no matching connection!")
applyAudioRouteChange(currentCall, types) applyAudioRouteChange(currentCall, types)
changeCaptureDeviceToMatchAudioRoute(currentCall, types)
} }
} else { } else {
applyAudioRouteChange(call, types) applyAudioRouteChange(call, types)
changeCaptureDeviceToMatchAudioRoute(call, types)
} }
} }