Commit 2785fa9f authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Store labels early.

This avoids spurious up.complete indications.
parent 26ca4f79
......@@ -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()
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment