Need guidance for implementing ice candidate pool

Olivier Crête olivier.crete at
Mon May 3 19:42:59 UTC 2021


With my libnice maintainer hat on, it's definitely something I would

The tricky part is the implementation. At first, I though we'd want to
create a new object separate from the ICE agent to do the gathering,
but it gets quite tricky quickly as the gathering and especially TURN
code is quite tied to the ICE agent code.

And looking at the spec, I think the implementation is mostly a webrtc
level issue. All that you need to do is to add a new API to
GstWebRTCICE to create GstWebRTCICEStream objects ahead of time and
"cache" them, then when gst_webrtc_ice_add_stream() is called, you can
just return one of the pre-allocated streams. The only issue is that we
need to add an API to libnice to mark a stream "unallocated" so that it
gets ignored when doing the freezing/unfreezing dance, and the same
thing needs to happen inside webrtcbin so they get ignored when trying
to compute the overall agent state.


On Mon, 2021-05-03 at 21:21 +0200, Mathieu Duponchelle via gstreamer-
devel wrote:
> Hey, this seems interesting, perhaps open an issue in libnice's
> gitlab to discuss this?
> On 5/2/21 5:29 AM, Sherrill Lam via gstreamer-devel wrote:
> > 
> > Hi there!
> > 
> > My team is interested to implement a prefetch ice candidate pool
> > and add an ice-candidate-pool-size property ( [rtc
> > spec](
> > ) ) for webrtcbin element. We think it will help accelerate the SDP
> > generation at startup process. We’d like to get more guidance on
> > what would be the best way to do it.
> > 
> > Although ice candidate pool is a webrtc concept, I think it might
> > make more sense if the pool itself is implemented within NiceAgent
> > in Libnice. We could add an API in Libnice to create such a pool
> > with a specified pool size and start generating ice candidates.
> > When nice_agent_gather_candidates() is called, it will first check
> > if there are candidates in the pool before generating new ones.
> > 
> > Any thoughts or suggestions?
> > 
> > Thanks!
> > Sherrill
> > 
> > 
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at
> >
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at

Olivier Crête
olivier.crete at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list