1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-26 02:25:58 +01:00

Release lock early in newUpConn.

Otherwise recording to disk causes a deadlock.
This commit is contained in:
Juliusz Chroboczek 2020-09-13 02:26:34 +02:00
parent fa29e50f8b
commit 96dbcd9dcb

View file

@ -400,7 +400,6 @@ func newUpConn(c client, id string) (*rtpUpConnection, error) {
pc.OnTrack(func(remote *webrtc.Track, receiver *webrtc.RTPReceiver) { pc.OnTrack(func(remote *webrtc.Track, receiver *webrtc.RTPReceiver) {
conn.mu.Lock() conn.mu.Lock()
defer conn.mu.Unlock()
mid := getTrackMid(pc, remote) mid := getTrackMid(pc, remote)
if mid == "" { if mid == "" {
@ -435,11 +434,19 @@ func newUpConn(c client, id string) (*rtpUpConnection, error) {
go rtcpUpListener(conn, track, receiver) go rtcpUpListener(conn, track, receiver)
if conn.complete() { complete := conn.complete()
tracks := make([]upTrack, len(conn.tracks)) var tracks []upTrack
if(complete) {
tracks = make([]upTrack, len(conn.tracks))
for i, t := range conn.tracks { for i, t := range conn.tracks {
tracks[i] = t tracks[i] = t
} }
}
// pushConn might need to take the lock
conn.mu.Unlock()
if complete {
clients := c.Group().getClients(c) clients := c.Group().getClients(c)
for _, cc := range clients { for _, cc := range clients {
cc.pushConn(conn.id, conn, tracks, conn.label) cc.pushConn(conn.id, conn, tracks, conn.label)