Move ICE code into own module, add tests.

This commit is contained in:
Juliusz Chroboczek
2021-01-02 00:20:47 +01:00
parent 845dccc2bb
commit 450601f0e8
5 changed files with 89 additions and 21 deletions
+3 -2
View File
@@ -16,6 +16,7 @@ import (
"github.com/jech/galene/conn"
"github.com/jech/galene/estimator"
"github.com/jech/galene/group"
"github.com/jech/galene/ice"
"github.com/jech/galene/jitter"
"github.com/jech/galene/packetcache"
"github.com/jech/galene/rtptime"
@@ -138,7 +139,7 @@ type rtpDownConnection struct {
func newDownConn(c group.Client, id string, remote conn.Up) (*rtpDownConnection, error) {
api := group.APIFromCodecs(remote.Codecs())
pc, err := api.NewPeerConnection(*group.ICEConfiguration())
pc, err := api.NewPeerConnection(*ice.ICEConfiguration())
if err != nil {
return nil, err
}
@@ -457,7 +458,7 @@ func pushConn(up *rtpUpConnection, g *group.Group, cs []group.Client) {
}
func newUpConn(c group.Client, id string, labels map[string]string) (*rtpUpConnection, error) {
pc, err := c.Group().API().NewPeerConnection(*group.ICEConfiguration())
pc, err := c.Group().API().NewPeerConnection(*ice.ICEConfiguration())
if err != nil {
return nil, err
}
+3 -2
View File
@@ -16,6 +16,7 @@ import (
"github.com/jech/galene/diskwriter"
"github.com/jech/galene/estimator"
"github.com/jech/galene/group"
"github.com/jech/galene/ice"
)
func errorToWSCloseMessage(id string, err error) (*clientMessage, []byte) {
@@ -877,7 +878,7 @@ func clientLoop(c *webClient, ws *websocket.Conn) error {
Kind: "change",
Group: g.Name(),
Permissions: &perms,
RTCConfiguration: group.ICEConfiguration(),
RTCConfiguration: ice.ICEConfiguration(),
})
if !c.permissions.Present {
up := getUpConns(c)
@@ -1084,7 +1085,7 @@ func handleClientMessage(c *webClient, m clientMessage) error {
Kind: "join",
Group: m.Group,
Permissions: &perms,
RTCConfiguration: group.ICEConfiguration(),
RTCConfiguration: ice.ICEConfiguration(),
})
if err != nil {
return err