Skip to content

Commit

Permalink
signaling extendability
Browse files Browse the repository at this point in the history
  • Loading branch information
Quarken committed Sep 3, 2024
1 parent 86e0952 commit c7263d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class EdgeWebrtcConnectionTest {

every { mockFactory.createPeerConnection(any<PeerConnection.RTCConfiguration>(), any<PeerConnection.Observer>()) } returns(mockPc)

peerConnection = EdgeWebrtcConnectionImpl(mockFactory, mockCoap, mockStream.getStream(), mockSignaling)
peerConnection = EdgePeerConnection(mockFactory, mockCoap, mockStream.getStream(), mockSignaling)
}

@After
Expand All @@ -91,6 +91,6 @@ class EdgeWebrtcConnectionTest {
fun connectShouldSucceed() = runTest {
msgChannel.send(SignalMessage(type = SignalMessageType.TURN_RESPONSE, iceServers = listOf()))
peerConnection.connect().await()
coVerify { mockSignaling.send(SignalMessage(type = SignalMessageType.TURN_REQUEST)) }
coVerify { mockSignaling.send(SignalMessage(type = SignalMessageType.TURN_REQUEST)).await() }
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nabto.edge.client.webrtc

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.annotation.JsonValue
import kotlinx.coroutines.Deferred
Expand All @@ -12,11 +13,15 @@ enum class SignalMessageType(@get:JsonValue val num: Int) {
TURN_RESPONSE(4)
}

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class SignalingIceCandidate(
val sdpMid: String,
val candidate: String
)

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class TurnServer(
val hostname: String,
val port: Int,
Expand All @@ -25,27 +30,31 @@ data class TurnServer(
)

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class IceServer(
val urls: List<String>,
val username: String? = null,
val credential: String? = null
)

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class MetadataTrack(
val mid: String,
val trackId: String,
val error: String? = null
)

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class SignalMessageMetadata(
val tracks: List<MetadataTrack>? = null,
val noTrickle: Boolean = false,
val status: String? = null
)

@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
data class SignalMessage(
val type: SignalMessageType,
val data: String? = null,
Expand Down

0 comments on commit c7263d3

Please sign in to comment.