mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-02 20:26:47 +01:00
Rename member for code clarity (we also have an AudioManager)
This commit is contained in:
parent
2c96a79a08
commit
ab2a55d417
@ -146,7 +146,7 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||
}
|
||||
|
||||
override fun onAudioDevicesChange(mgr: WebRtcPeerConnectionManager) {
|
||||
val currentSoundDevice = mgr.audioManager.getCurrentSoundDevice()
|
||||
val currentSoundDevice = mgr.callAudioManager.getCurrentSoundDevice()
|
||||
if (currentSoundDevice == CallAudioManager.SoundDevice.PHONE) {
|
||||
proximityManager.start()
|
||||
} else {
|
||||
@ -155,7 +155,7 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||
|
||||
setState {
|
||||
copy(
|
||||
availableSoundDevices = mgr.audioManager.getAvailableSoundDevices(),
|
||||
availableSoundDevices = mgr.callAudioManager.getAvailableSoundDevices(),
|
||||
soundDevice = currentSoundDevice
|
||||
)
|
||||
}
|
||||
@ -182,7 +182,7 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||
|
||||
mxCall.addListener(callStateListener)
|
||||
|
||||
val currentSoundDevice = webRtcPeerConnectionManager.audioManager.getCurrentSoundDevice()
|
||||
val currentSoundDevice = webRtcPeerConnectionManager.callAudioManager.getCurrentSoundDevice()
|
||||
if (currentSoundDevice == CallAudioManager.SoundDevice.PHONE) {
|
||||
proximityManager.start()
|
||||
}
|
||||
@ -193,7 +193,7 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||
callState = Success(mxCall.state),
|
||||
otherUserMatrixItem = item?.let { Success(it) } ?: Uninitialized,
|
||||
soundDevice = currentSoundDevice,
|
||||
availableSoundDevices = webRtcPeerConnectionManager.audioManager.getAvailableSoundDevices(),
|
||||
availableSoundDevices = webRtcPeerConnectionManager.callAudioManager.getAvailableSoundDevices(),
|
||||
isFrontCamera = webRtcPeerConnectionManager.currentCameraType() == CameraType.FRONT,
|
||||
canSwitchCamera = webRtcPeerConnectionManager.canSwitchCamera(),
|
||||
isHD = mxCall.isVideoCall && webRtcPeerConnectionManager.currentCaptureFormat() is CaptureFormat.HD
|
||||
@ -250,10 +250,10 @@ class VectorCallViewModel @AssistedInject constructor(
|
||||
Unit
|
||||
}
|
||||
is VectorCallViewActions.ChangeAudioDevice -> {
|
||||
webRtcPeerConnectionManager.audioManager.setCurrentSoundDevice(action.device)
|
||||
webRtcPeerConnectionManager.callAudioManager.setCurrentSoundDevice(action.device)
|
||||
setState {
|
||||
copy(
|
||||
soundDevice = webRtcPeerConnectionManager.audioManager.getCurrentSoundDevice()
|
||||
soundDevice = webRtcPeerConnectionManager.callAudioManager.getCurrentSoundDevice()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,9 @@ import im.vector.app.ActiveSessionDataSource
|
||||
import im.vector.app.core.services.BluetoothHeadsetReceiver
|
||||
import im.vector.app.core.services.CallService
|
||||
import im.vector.app.core.services.WiredHeadsetStateReceiver
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.ReplaySubject
|
||||
import org.matrix.android.sdk.api.MatrixCallback
|
||||
import org.matrix.android.sdk.api.extensions.tryThis
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
@ -35,9 +38,6 @@ import org.matrix.android.sdk.api.session.room.model.call.CallAnswerContent
|
||||
import org.matrix.android.sdk.api.session.room.model.call.CallCandidatesContent
|
||||
import org.matrix.android.sdk.api.session.room.model.call.CallHangupContent
|
||||
import org.matrix.android.sdk.api.session.room.model.call.CallInviteContent
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.ReplaySubject
|
||||
import org.webrtc.AudioSource
|
||||
import org.webrtc.AudioTrack
|
||||
import org.webrtc.Camera1Enumerator
|
||||
@ -93,7 +93,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
currentCallsListeners.remove(listener)
|
||||
}
|
||||
|
||||
val audioManager = CallAudioManager(context.applicationContext) {
|
||||
val callAudioManager = CallAudioManager(context.applicationContext) {
|
||||
currentCallsListeners.forEach {
|
||||
tryThis { it.onAudioDevicesChange(this) }
|
||||
}
|
||||
@ -577,7 +577,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
fun close() {
|
||||
Timber.v("## VOIP WebRtcPeerConnectionManager close() >")
|
||||
CallService.onNoActiveCall(context)
|
||||
audioManager.stop()
|
||||
callAudioManager.stop()
|
||||
val callToEnd = currentCall
|
||||
currentCall = null
|
||||
// This must be done in this thread
|
||||
@ -631,7 +631,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
val createdCall = currentSession?.callSignalingService()?.createOutgoingCall(signalingRoomId, otherUserId, isVideoCall) ?: return
|
||||
val callContext = CallContext(createdCall)
|
||||
|
||||
audioManager.startForCall(createdCall)
|
||||
callAudioManager.startForCall(createdCall)
|
||||
currentCall = callContext
|
||||
|
||||
val name = currentSession?.getUser(createdCall.otherUserId)?.getBestName()
|
||||
@ -684,7 +684,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
|
||||
val callContext = CallContext(mxCall)
|
||||
currentCall = callContext
|
||||
audioManager.startForCall(mxCall)
|
||||
callAudioManager.startForCall(mxCall)
|
||||
executor.execute {
|
||||
callContext.remoteCandidateSource = ReplaySubject.create()
|
||||
}
|
||||
@ -798,12 +798,12 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
Timber.v("## VOIP onWiredDeviceEvent $event")
|
||||
currentCall ?: return
|
||||
// sometimes we received un-wanted unplugged...
|
||||
audioManager.wiredStateChange(event)
|
||||
callAudioManager.wiredStateChange(event)
|
||||
}
|
||||
|
||||
fun onWirelessDeviceEvent(event: BluetoothHeadsetReceiver.BTHeadsetPlugEvent) {
|
||||
Timber.v("## VOIP onWirelessDeviceEvent $event")
|
||||
audioManager.bluetoothStateChange(event.plugged)
|
||||
callAudioManager.bluetoothStateChange(event.plugged)
|
||||
}
|
||||
|
||||
override fun onCallAnswerReceived(callAnswerContent: CallAnswerContent) {
|
||||
@ -858,7 +858,7 @@ class WebRtcPeerConnectionManager @Inject constructor(
|
||||
*/
|
||||
PeerConnection.PeerConnectionState.CONNECTED -> {
|
||||
callContext.mxCall.state = CallState.Connected(newState)
|
||||
audioManager.onCallConnected(callContext.mxCall)
|
||||
callAudioManager.onCallConnected(callContext.mxCall)
|
||||
}
|
||||
/**
|
||||
* One or more of the ICE transports on the connection is in the "failed" state.
|
||||
|
Loading…
x
Reference in New Issue
Block a user