VoIP: fix call candidate parsing

This commit is contained in:
ganfra 2020-12-01 19:38:09 +01:00
parent 4a3f0c8898
commit 7af82af935
3 changed files with 7 additions and 3 deletions

View File

@ -24,13 +24,13 @@ data class CallCandidate(
/** /**
* Required. The SDP media type this candidate is intended for. * Required. The SDP media type this candidate is intended for.
*/ */
@Json(name = "sdpMid") val sdpMid: String, @Json(name = "sdpMid") val sdpMid: String? = null,
/** /**
* Required. The index of the SDP 'm' line this candidate is intended for. * Required. The index of the SDP 'm' line this candidate is intended for.
*/ */
@Json(name = "sdpMLineIndex") val sdpMLineIndex: Int, @Json(name = "sdpMLineIndex") val sdpMLineIndex: Int = 0,
/** /**
* Required. The SDP 'a' line of the candidate. * Required. The SDP 'a' line of the candidate.
*/ */
@Json(name = "candidate") val candidate: String @Json(name = "candidate") val candidate: String? = null
) )

View File

@ -105,6 +105,7 @@ internal class MxCallImpl(
} }
override fun sendLocalIceCandidates(candidates: List<CallCandidate>) { override fun sendLocalIceCandidates(candidates: List<CallCandidate>) {
Timber.v("Send local ice canditates $callId: $candidates")
CallCandidatesContent( CallCandidatesContent(
callId = callId, callId = callId,
partyId = ourPartyId, partyId = ourPartyId,

View File

@ -729,6 +729,9 @@ class WebRtcCall(val mxCall: MxCall,
fun onCallIceCandidateReceived(iceCandidatesContent: CallCandidatesContent) { fun onCallIceCandidateReceived(iceCandidatesContent: CallCandidatesContent) {
GlobalScope.launch(dispatcher) { GlobalScope.launch(dispatcher) {
iceCandidatesContent.candidates.forEach { iceCandidatesContent.candidates.forEach {
if (it.sdpMid.isNullOrEmpty() || it.candidate.isNullOrEmpty()) {
return@forEach
}
Timber.v("## VOIP onCallIceCandidateReceived for call ${mxCall.callId} sdp: ${it.candidate}") Timber.v("## VOIP onCallIceCandidateReceived for call ${mxCall.callId} sdp: ${it.candidate}")
val iceCandidate = IceCandidate(it.sdpMid, it.sdpMLineIndex, it.candidate) val iceCandidate = IceCandidate(it.sdpMid, it.sdpMLineIndex, it.candidate)
remoteCandidateSource.onNext(iceCandidate) remoteCandidateSource.onNext(iceCandidate)