1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-26 10:35:59 +01:00

Make API a method of group.

This commit is contained in:
Juliusz Chroboczek 2020-09-13 13:01:06 +02:00
parent 22c6ad6b8c
commit 938d231b30
3 changed files with 8 additions and 4 deletions

View file

@ -47,6 +47,10 @@ var groups struct {
api *webrtc.API api *webrtc.API
} }
func (g *group) API() *webrtc.API {
return groups.api
}
func addGroup(name string, desc *groupDescription) (*group, error) { func addGroup(name string, desc *groupDescription) (*group, error) {
groups.mu.Lock() groups.mu.Lock()
defer groups.mu.Unlock() defer groups.mu.Unlock()

View file

@ -109,8 +109,8 @@ type rtpDownConnection struct {
iceCandidates []*webrtc.ICECandidateInit iceCandidates []*webrtc.ICECandidateInit
} }
func newDownConn(id string, remote upConnection) (*rtpDownConnection, error) { func newDownConn(c client, id string, remote upConnection) (*rtpDownConnection, error) {
pc, err := groups.api.NewPeerConnection(iceConfiguration()) pc, err := c.Group().API().NewPeerConnection(iceConfiguration())
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -371,7 +371,7 @@ func (up *rtpUpConnection) complete() bool {
} }
func newUpConn(c client, id string) (*rtpUpConnection, error) { func newUpConn(c client, id string) (*rtpUpConnection, error) {
pc, err := groups.api.NewPeerConnection(iceConfiguration()) pc, err := c.Group().API().NewPeerConnection(iceConfiguration())
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -302,7 +302,7 @@ func getConn(c *webClient, id string) iceConnection {
} }
func addDownConn(c *webClient, id string, remote upConnection) (*rtpDownConnection, error) { func addDownConn(c *webClient, id string, remote upConnection) (*rtpDownConnection, error) {
conn, err := newDownConn(id, remote) conn, err := newDownConn(c, id, remote)
if err != nil { if err != nil {
return nil, err return nil, err
} }