Reduce limit of attempts to change audio device in Android framework + return correct value if it failed

This commit is contained in:
Sylvain Berfini 2025-09-22 14:58:44 +02:00
parent ae7a3c5bce
commit 8f3415f6fa

View file

@ -260,13 +260,14 @@ class TelecomCallControlCallback(
continue
}
var success = false
scope.launch {
Log.i("$TAG Requesting audio endpoint change to [${endpoint.name}] with type [${endpointTypeToString(endpoint.type)}]")
endpointUpdateRequestFromLinphone = true
latestLinphoneRequestedEndpoint = endpoint
var result: CallControlResult = callControl.requestEndpointChange(endpoint)
var attempts = 1
while (result is CallControlResult.Error && attempts <= 10) {
while (result is CallControlResult.Error && attempts <= 2) {
delay(100)
Log.i(
"$TAG Previous attempt failed [$result], requesting again audio endpoint change to [${endpoint.name}] with type [${endpointTypeToString(endpoint.type)}]"
@ -282,10 +283,11 @@ class TelecomCallControlCallback(
"$TAG It took [$attempts] attempt(s) to change endpoint audio device..."
)
currentEndpoint = endpoint.type
success = true
}
}
return true
return success
}
}