1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

Store labels early.

This avoids spurious up.complete indications.
This commit is contained in:
Juliusz Chroboczek 2020-12-25 22:32:30 +01:00
parent 26ca4f7969
commit 2785fa9f77
2 changed files with 5 additions and 7 deletions

View file

@ -411,7 +411,7 @@ func pushConn(up *rtpUpConnection, g *group.Group, cs []group.Client) {
}(g, cs) }(g, cs)
} }
func newUpConn(c group.Client, id string) (*rtpUpConnection, error) { 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(group.IceConfiguration())
if err != nil { if err != nil {
return nil, err return nil, err
@ -437,7 +437,7 @@ func newUpConn(c group.Client, id string) (*rtpUpConnection, error) {
return nil, err return nil, err
} }
up := &rtpUpConnection{id: id, pc: pc} up := &rtpUpConnection{id: id, pc: pc, labels: labels}
pc.OnTrack(func(remote *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) { pc.OnTrack(func(remote *webrtc.TrackRemote, receiver *webrtc.RTPReceiver) {
up.mu.Lock() up.mu.Lock()

View file

@ -204,7 +204,7 @@ func getUpConns(c *webClient) []*rtpUpConnection {
return up return up
} }
func addUpConn(c *webClient, id string) (*rtpUpConnection, bool, error) { func addUpConn(c *webClient, id string, labels map[string]string) (*rtpUpConnection, bool, error) {
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()
@ -220,7 +220,7 @@ func addUpConn(c *webClient, id string) (*rtpUpConnection, bool, error) {
return old, false, nil return old, false, nil
} }
conn, err := newUpConn(c, id) conn, err := newUpConn(c, id, labels)
if err != nil { if err != nil {
return nil, false, err return nil, false, err
} }
@ -481,7 +481,7 @@ func gotOffer(c *webClient, id string, offer webrtc.SessionDescription, renegoti
delUpConn(c, id) delUpConn(c, id)
} }
up, isnew, err := addUpConn(c, id) up, isnew, err := addUpConn(c, id, labels)
if err != nil { if err != nil {
return err return err
} }
@ -509,8 +509,6 @@ func gotOffer(c *webClient, id string, offer webrtc.SessionDescription, renegoti
return err return err
} }
up.labels = labels
err = up.flushICECandidates() err = up.flushICECandidates()
if err != nil { if err != nil {
log.Printf("ICE: %v", err) log.Printf("ICE: %v", err)