mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 03:18:06 +00:00
Fixed audio not routed to connected bluetooth device during call
This commit is contained in:
parent
83df46ca8b
commit
e85488cf65
3 changed files with 20 additions and 16 deletions
|
|
@ -111,14 +111,7 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
"$TAG Added device [${device.productName}] with ID [${device.id}] and type [${device.type}]"
|
||||
)
|
||||
}
|
||||
if (telecomManager.getCurrentlyFollowedCalls() <= 0) {
|
||||
Log.i("$TAG No call found in Telecom's CallsManager, reloading sound devices")
|
||||
core.reloadSoundDevices()
|
||||
} else {
|
||||
Log.i(
|
||||
"$TAG At least one active call in Telecom's CallsManager, let it handle the added device"
|
||||
)
|
||||
}
|
||||
core.reloadSoundDevices()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -512,6 +505,16 @@ class CoreContext @UiThread constructor(val context: Context) : HandlerThread("C
|
|||
}
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
fun postOnCoreThreadDelayed(
|
||||
@WorkerThread lambda: (core: Core) -> Unit,
|
||||
delay: Long
|
||||
) {
|
||||
coreThread.postDelayed({
|
||||
lambda.invoke(core)
|
||||
}, delay)
|
||||
}
|
||||
|
||||
@AnyThread
|
||||
fun postOnMainThread(
|
||||
@UiThread lambda: () -> Unit
|
||||
|
|
|
|||
|
|
@ -138,7 +138,12 @@ class TelecomCallControlCallback(
|
|||
}
|
||||
if (route.isNotEmpty()) {
|
||||
coreContext.postOnCoreThread {
|
||||
AudioUtils.applyAudioRouteChangeInLinphone(call, route)
|
||||
if (!AudioUtils.applyAudioRouteChangeInLinphone(call, route)) {
|
||||
Log.w("$TAG Failed to apply audio route change, trying again in 200ms")
|
||||
coreContext.postOnCoreThreadDelayed({
|
||||
AudioUtils.applyAudioRouteChangeInLinphone(call, route)
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.launchIn(scope)
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ class AudioUtils {
|
|||
call: Call?,
|
||||
types: List<AudioDevice.Type>,
|
||||
output: Boolean = true
|
||||
) {
|
||||
): Boolean {
|
||||
val capability = if (output) {
|
||||
AudioDevice.Capabilities.CapabilityPlay
|
||||
} else {
|
||||
|
|
@ -139,12 +139,7 @@ class AudioUtils {
|
|||
Log.e(
|
||||
"$TAG Couldn't find audio device with capability [$capability] and type [$types]"
|
||||
)
|
||||
for (device in extendedAudioDevices) {
|
||||
Log.i(
|
||||
"$TAG Extended audio device: [${device.deviceName} (${device.driverName}) ${device.type} / ${device.capabilities}]"
|
||||
)
|
||||
}
|
||||
return
|
||||
return false
|
||||
}
|
||||
if (call != null) {
|
||||
Log.i(
|
||||
|
|
@ -165,6 +160,7 @@ class AudioUtils {
|
|||
coreContext.core.inputAudioDevice = audioDevice
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue