Fixed mute microphone in waiting room not applied once conference has been joined

This commit is contained in:
Sylvain Berfini 2024-04-22 15:46:40 +02:00
parent 1aeb917d62
commit aa36129053
2 changed files with 13 additions and 4 deletions

View file

@ -36,6 +36,7 @@ import org.linphone.core.Call
import org.linphone.core.CallListenerStub
import org.linphone.core.tools.Log
import org.linphone.utils.AudioUtils
import org.linphone.utils.LinphoneUtils
class TelecomCallControlCallback(
private val call: Call,
@ -143,9 +144,16 @@ class TelecomCallControlCallback(
}.launchIn(scope)
callControl.isMuted.onEach { muted ->
Log.i("$TAG We're asked to ${if (muted) "mute" else "unmute"} the call")
coreContext.postOnCoreThread {
call.microphoneMuted = muted
val callState = call.state
Log.i(
"$TAG We're asked to [${if (muted) "mute" else "unmute"}] the call in state [$callState]"
)
if (muted || !LinphoneUtils.isCallOutgoing(callState, false)) {
call.microphoneMuted = muted
} else {
Log.w("$TAG Not following unmute request because call is in state [$callState]")
}
}
}.launchIn(scope)
}

View file

@ -100,9 +100,10 @@ class LinphoneUtils {
}
@AnyThread
fun isCallOutgoing(callState: Call.State): Boolean {
fun isCallOutgoing(callState: Call.State, considerEarlyMedia: Boolean = true): Boolean {
return when (callState) {
Call.State.OutgoingInit, Call.State.OutgoingProgress, Call.State.OutgoingRinging, Call.State.OutgoingEarlyMedia -> true
Call.State.OutgoingInit, Call.State.OutgoingProgress, Call.State.OutgoingRinging -> true
Call.State.OutgoingEarlyMedia -> considerEarlyMedia
else -> false
}
}