Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Trickle for Sub or Pub only Peers #684

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion pkg/sfu/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,22 @@ func (p *PeerLocal) SetRemoteDescription(sdp webrtc.SessionDescription) error {

// Trickle candidates available for this peer
func (p *PeerLocal) Trickle(candidate webrtc.ICECandidateInit, target int) error {
if p.subscriber == nil || p.publisher == nil {
if p.subscriber == nil && p.publisher == nil {
return ErrNoTransportEstablished
}
Logger.V(0).Info("PeerLocal trickle", "peer_id", p.id)
switch target {
case publisher:
if p.publisher == nil {
return ErrNoTransportEstablished
}
if err := p.publisher.AddICECandidate(candidate); err != nil {
return fmt.Errorf("setting ice candidate: %w", err)
}
case subscriber:
if p.subscriber == nil {
return ErrNoTransportEstablished
}
if err := p.subscriber.AddICECandidate(candidate); err != nil {
return fmt.Errorf("setting ice candidate: %w", err)
}
Expand Down