Stay in communication mode in order to avoid audio delay when changing mode

This commit is contained in:
Juha Heinanen
2021-11-02 08:56:53 +02:00
parent efab0f2fc3
commit 00a0779b0b
3 changed files with 5 additions and 2 deletions

View File

@ -520,7 +520,8 @@ class BaresipService: Service() {
}
"call outgoing" -> {
stopMediaPlayer()
am.mode = AudioManager.MODE_IN_COMMUNICATION
if (am.mode != AudioManager.MODE_IN_COMMUNICATION)
am.mode = AudioManager.MODE_IN_COMMUNICATION
requestAudioFocus(AudioAttributes.USAGE_VOICE_COMMUNICATION,
AudioAttributes.CONTENT_TYPE_SPEECH)
setCallVolume()
@ -757,7 +758,6 @@ class BaresipService: Service() {
am.isSpeakerphoneOn = false
am.stopBluetoothSco()
abandonAudioFocus()
am.mode = AudioManager.MODE_NORMAL
proximitySensing(false)
}
if (ua.account.callHistory && !call.hasHistory) {

View File

@ -792,6 +792,9 @@ class MainActivity : AppCompatActivity() {
super.onResume()
Log.d(TAG, "Main onResume with action '$resumeAction'")
nm.cancelAll()
// Keep the app in communication mode in order to avoid audio delay when the mode changes
if (am.mode != AudioManager.MODE_RINGTONE && am.mode != AudioManager.MODE_IN_COMMUNICATION)
am.mode = AudioManager.MODE_IN_COMMUNICATION
visible = true
when (resumeAction) {
"call show" ->

Binary file not shown.