Split ICE candidate queue. (#2885)
Shared ICE candidate queue meant only one of PUBLISHER/SUBSCRIBER pc got final candidate notification. Split the queue.
This commit is contained in:
@@ -191,7 +191,7 @@ type ParticipantImpl struct {
|
||||
*UpTrackManager
|
||||
*SubscriptionManager
|
||||
|
||||
icQueue atomic.Pointer[webrtc.ICECandidate]
|
||||
icQueue [2]atomic.Pointer[webrtc.ICECandidate]
|
||||
|
||||
// keeps track of unpublished tracks in order to reuse trackID
|
||||
unpublishedTracks []*livekit.TrackInfo
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
"go.uber.org/atomic"
|
||||
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
@@ -265,7 +266,13 @@ func (p *ParticipantImpl) sendDisconnectUpdatesForReconnect() error {
|
||||
}
|
||||
|
||||
func (p *ParticipantImpl) sendICECandidate(ic *webrtc.ICECandidate, target livekit.SignalTarget) error {
|
||||
prevIC := p.icQueue.Swap(ic)
|
||||
var icQueue *atomic.Pointer[webrtc.ICECandidate]
|
||||
if target == livekit.SignalTarget_PUBLISHER {
|
||||
icQueue = &p.icQueue[0]
|
||||
} else {
|
||||
icQueue = &p.icQueue[1]
|
||||
}
|
||||
prevIC := icQueue.Swap(ic)
|
||||
if prevIC == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user