mirror of
https://github.com/jech/galene.git
synced 2024-11-09 18:25:58 +01:00
Delay adding tracks until connection is complete.
This avoids losing packets at the beginning of a connection.
This commit is contained in:
parent
aa65164edd
commit
0eb1593bb8
1 changed files with 14 additions and 2 deletions
|
@ -520,9 +520,21 @@ func gotAnswer(c *webClient, id string, answer webrtc.SessionDescription) error
|
|||
log.Printf("ICE: %v", err)
|
||||
}
|
||||
|
||||
for _, t := range down.tracks {
|
||||
t.remote.AddLocal(t)
|
||||
add := func() {
|
||||
down.pc.OnConnectionStateChange(nil)
|
||||
for _, t := range down.tracks {
|
||||
t.remote.AddLocal(t)
|
||||
}
|
||||
}
|
||||
down.pc.OnConnectionStateChange(func(state webrtc.PeerConnectionState) {
|
||||
if state == webrtc.PeerConnectionStateConnected {
|
||||
add()
|
||||
}
|
||||
})
|
||||
if down.pc.ConnectionState() == webrtc.PeerConnectionStateConnected {
|
||||
add()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue