membraneframework-labs / membrane_libnice_plugin

Membrane plugin for ICE protocol
Apache License 2.0
11 stars 1 forks source link

Handle TURN servers properly #4

Closed mickel8 closed 3 years ago

mickel8 commented 4 years ago

At this moment TURN servers are passed at the beginning. This is problematic because setting TURN server in libnice is done per pair stream_id component_id. At start we don't have any streams with any components so we cannot set any TURN servers.

One way to resolve this is to save TURN servers in state struct and then each time new stream is added set for its components TURN servers saved at the beginning.

Another way is to allow user to pass TURN servers in message {:add_stream, n_components, name, turn_servers}

One more possibility is to expose libnice function nice_agent_set_relay_info and force user to call it if he wants to use TURN servers.

EDIT After merging #10 one instance of Sink/Source will be associated with one stream with multiple components. This makes adding support for TURN server trivial but it has to be done at first in ExLibnice membraneframework/ex_libnice#2