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

Implement ICECandidatePoolSize (gathering before SetLocalDescription/SetRemoteDescription) #2892

Open
om26er opened this issue Aug 29, 2024 · 4 comments

Comments

@om26er
Copy link

om26er commented Aug 29, 2024

Here is the code

	// Prepare the configuration
	config := webrtc.Configuration{
		ICEServers:           r.iceServers,
		ICECandidatePoolSize: 10,
	}

	// Create a new RTCPeerConnection
	connection, err := webrtc.NewPeerConnection(config)
	if err != nil {
		panic(err)
	}

	connection.OnICECandidate(func(candidate *webrtc.ICECandidate) {
		log.Println(candidate)
	})

It doesn't do anything unless description is set

@om26er
Copy link
Author

om26er commented Aug 29, 2024

What I expect is the candidates gathering to start even before setting the description.

@nils-ohlmeier
Copy link

I'm not sure if Pion has a special mode for your expectation. But your expectation is certainly not true for browser implementations. The reason is that before you set any description the implementation doesn't know for how many streams it needs to provide ICE candidates and if bundle is going to be used or not.

I think the more reasonable expectation would be to say that with pools activated there should be a lot less delay in gathering candidates after setting a description, compared to without using an ICE candidate pool.

@Sean-Der Sean-Der changed the title ICECandidatePoolSize has no effect Implement ICECandidatePoolSize (gathering before SetLocalDescription) Oct 7, 2024
@Sean-Der Sean-Der changed the title Implement ICECandidatePoolSize (gathering before SetLocalDescription) Implement ICECandidatePoolSize (gathering before SetLocalDescription/SetRemoteDescription) Oct 7, 2024
@Sean-Der
Copy link
Member

Sean-Der commented Oct 7, 2024

This could be a great optimization! All for adding this @nils-ohlmeier @om26er

To keep things simple we could treate ICECandidatePoolSize as a bool. If != 0 then gather before signaling.

Great first issue for someone to work on!

@nils-ohlmeier
Copy link

I didn't realize that Pion doesn't have support for ICE candidate pool yet.

Yes having the default pool size be 0 and meaning no gathering before set(Local|Remote)Description makes perfect sense to me. And then an API to set it to some positive number if pooling is desired.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants