mirror of
https://github.com/jech/galene.git
synced 2024-11-22 08:35:57 +01:00
Avoid race in newDiskConn.
This commit is contained in:
parent
d508ae2181
commit
1fd8b92f02
1 changed files with 11 additions and 3 deletions
|
@ -251,7 +251,7 @@ type diskTrack struct {
|
||||||
// bit 32 is a boolean indicating that the origin is valid
|
// bit 32 is a boolean indicating that the origin is valid
|
||||||
origin uint64
|
origin uint64
|
||||||
|
|
||||||
lastKf uint32
|
lastKf uint32
|
||||||
savedKf *rtp.Packet
|
savedKf *rtp.Packet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,9 +309,17 @@ func newDiskConn(client *Client, directory string, up conn.Up, remoteTracks []co
|
||||||
conn: &conn,
|
conn: &conn,
|
||||||
}
|
}
|
||||||
conn.tracks = append(conn.tracks, track)
|
conn.tracks = append(conn.tracks, track)
|
||||||
remote.AddLocal(track)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only do this after all tracks have been added to conn, to avoid
|
||||||
|
// racing on hasVideo.
|
||||||
|
for _, t := range conn.tracks {
|
||||||
|
err := t.remote.AddLocal(t)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("Couldn't add disk track: %v", err)
|
||||||
|
conn.warn("Couldn't add disk track: " + err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
err := up.AddLocal(&conn)
|
err := up.AddLocal(&conn)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -383,7 +391,7 @@ func keyframeDimensions(codec string, data []byte, packet *rtp.Packet) (uint32,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, 0
|
return 0, 0
|
||||||
}
|
}
|
||||||
if(!vp9.V) {
|
if !vp9.V {
|
||||||
return 0, 0
|
return 0, 0
|
||||||
}
|
}
|
||||||
w := uint32(0)
|
w := uint32(0)
|
||||||
|
|
Loading…
Reference in a new issue