mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
Return an error when adding a duplicate down track.
This commit is contained in:
parent
73f72c45fc
commit
d9e72f4fd0
1 changed files with 14 additions and 2 deletions
|
@ -403,6 +403,20 @@ func addDownTrack(c *webClient, conn *rtpDownConnection, remoteTrack conn.UpTrac
|
||||||
return nil, errors.New("unexpected up track type")
|
return nil, errors.New("unexpected up track type")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conn.mu.Lock()
|
||||||
|
defer conn.mu.Unlock()
|
||||||
|
|
||||||
|
remoteSSRC := rt.track.SSRC()
|
||||||
|
for _, t := range conn.tracks {
|
||||||
|
tt, ok := t.remote.(*rtpUpTrack)
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("unexpected up track type")
|
||||||
|
}
|
||||||
|
if tt.track.SSRC() == remoteSSRC {
|
||||||
|
return nil, os.ErrExist
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
local, err := webrtc.NewTrackLocalStaticRTP(
|
local, err := webrtc.NewTrackLocalStaticRTP(
|
||||||
remoteTrack.Codec(),
|
remoteTrack.Codec(),
|
||||||
rt.track.ID(), rt.track.StreamID(),
|
rt.track.ID(), rt.track.StreamID(),
|
||||||
|
@ -431,9 +445,7 @@ func addDownTrack(c *webClient, conn *rtpDownConnection, remoteTrack conn.UpTrac
|
||||||
atomics: &downTrackAtomics{},
|
atomics: &downTrackAtomics{},
|
||||||
}
|
}
|
||||||
|
|
||||||
conn.mu.Lock()
|
|
||||||
conn.tracks = append(conn.tracks, track)
|
conn.tracks = append(conn.tracks, track)
|
||||||
conn.mu.Unlock()
|
|
||||||
|
|
||||||
go rtcpDownListener(conn, track, sender)
|
go rtcpDownListener(conn, track, sender)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue