VoIP: make some clean up and update CHANGES

This commit is contained in:
ganfra 2021-02-01 19:19:46 +01:00
parent f4fd8af3b4
commit 9c9c1fa79c
8 changed files with 43 additions and 9 deletions

View file

@ -1,3 +1,30 @@
Changes in Element 1.0.16 (2020-XX-XX)
===================================================
Features ✨:
- VoIP : support for VoIP V1 protocol, transfer call and dial-pad
Improvements 🙌:
- VoIP : new tiles in timeline
Bugfix 🐛:
- VoIP : fix audio devices output
Translations 🗣:
-
SDK API changes ⚠️:
-
Build 🧱:
-
Test:
-
Other changes:
-
Changes in Element 1.0.15 (2020-XX-XX)
===================================================

View file

@ -80,9 +80,9 @@ interface MxCall : MxCallDetail {
fun offerSdp(sdpString: String)
/**
* Send Ice candidate to the other participant.
* Send Call candidate to the other participant.
*/
fun sendLocalIceCandidates(candidates: List<CallCandidate>)
fun sendLocalCallCandidates(candidates: List<CallCandidate>)
/**
* Send removed ICE candidates to the other participant.

View file

@ -37,4 +37,4 @@ data class CallRejectContent(
* Required. The version of the VoIP specification this message adheres to.
*/
@Json(name = "version") override val version: String?
):CallSignallingContent
) : CallSignallingContent

View file

@ -30,7 +30,7 @@ import org.matrix.android.sdk.api.session.room.model.call.CallSelectAnswerConten
/**
* Dispatch each method safely to all listeners.
*/
class CallListenersDispatcher(private val listeners: Set<CallListener>) : CallListener {
internal class CallListenersDispatcher(private val listeners: Set<CallListener>) : CallListener {
override fun onCallInviteReceived(mxCall: MxCall, callInviteContent: CallInviteContent) = dispatch {
it.onCallInviteReceived(mxCall, callInviteContent)

View file

@ -114,8 +114,8 @@ internal class MxCallImpl(
.also { eventSenderProcessor.postEvent(it) }
}
override fun sendLocalIceCandidates(candidates: List<CallCandidate>) {
Timber.v("Send local ice canditates $callId: $candidates")
override fun sendLocalCallCandidates(candidates: List<CallCandidate>) {
Timber.v("Send local call canditates $callId: $candidates")
CallCandidatesContent(
callId = callId,
partyId = ourPartyId,

View file

@ -177,7 +177,7 @@ class WebRtcCall(val mxCall: MxCall,
if (it.isNotEmpty()) {
Timber.v("## Sending local ice candidates to call")
// it.forEach { peerConnection?.addIceCandidate(it) }
mxCall.sendLocalIceCandidates(it.mapToCallCandidate())
mxCall.sendLocalCallCandidates(it.mapToCallCandidate())
}
}

View file

@ -147,6 +147,7 @@ class WebRtcCallManager @Inject constructor(
}
}
private val advertisedCalls = HashSet<String>()
private val callsByCallId = ConcurrentHashMap<String, WebRtcCall>()
private val callsByRoomId = ConcurrentHashMap<String, MutableList<WebRtcCall>>()
@ -166,6 +167,11 @@ class WebRtcCallManager @Inject constructor(
return callsByCallId.values.toList()
}
/**
* @return a set of all advertised call during the lifetime of the app.
*/
fun getAdvertisedCalls() = advertisedCalls
fun headSetButtonTapped() {
Timber.v("## VOIP headSetButtonTapped")
val call = getCurrentCall() ?: return
@ -299,6 +305,7 @@ class WebRtcCallManager @Inject constructor(
onCallBecomeActive = this::onCallActive,
onCallEnded = this::onCallEnded
)
advertisedCalls.add(mxCall.callId)
callsByCallId[mxCall.callId] = webRtcCall
callsByRoomId.getOrPut(mxCall.roomId) { ArrayList(1) }
.add(webRtcCall)

View file

@ -210,10 +210,10 @@ class TimelineEventController @Inject constructor(private val dateFormatter: Vec
val epoxyModel = it.value
if (epoxyModel is CallTileTimelineItem) {
val callId = epoxyModel.attributes.callId
val call = callManager.getCallById(callId)
// We should remove the call tile if we already have one for this call or
// if this is an active call tile without an actual call (which can happen with permalink)
val shouldRemoveCallItem = callIds.contains(callId) || (call == null && epoxyModel.attributes.callStatus.isActive())
val shouldRemoveCallItem = callIds.contains(callId)
|| (!callManager.getAdvertisedCalls().contains(callId) && epoxyModel.attributes.callStatus.isActive())
if (shouldRemoveCallItem && !showHiddenEvents) {
modelsIterator.remove()
return@forEach