libnice doesn't send out UDP packets before a selected pair is established
We're encountering some issues when using libnice's GStreamer plugins.
We use the following type of transfer pipeline to send encrypted RTP data using ICE to establish a connection:
{media src} ! dtlssrtpenc ! nicesink
However, when dtlssrtpenc
attempts to send any data downstream before the NiceAgent selects a candidate pair, the NiceAgent doesn't try to send this data to any of the remote ICE candidates, and the nicesink just ends up dropping the data. This ends up causing a fairly significant delay as dtlssrtpenc
waits around until it times out, before re-sending that data downstream.
Ideally, it seems like the NiceAgent/nicesink would try to send this data to these remote candidates, or even maybe just queue up this data and send it across the wire when a selected pair has been chosen.
According to RFC 8445, sending data is allowed prior to a selected pair being chosen:
An ICE agent MAY send data on any valid pair before selected pairs have been produced for the data stream. (https://datatracker.ietf.org/doc/html/rfc8445#section-12.1)