1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35: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)
}
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())
if err != nil {
return nil, err
@ -437,7 +437,7 @@ func newUpConn(c group.Client, id string) (*rtpUpConnection, error) {
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) {
up.mu.Lock()

View file

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