View Source Membrane.Libnice.Bin (Membrane Libnice plugin v0.9.0)
Bin used for establishing ICE connection, sending and receiving messages.
architecture-and-pad-semantic
Architecture and pad semantic
Both input and output pads are dynamic ones. One instance of Libnice Bin is responsible for handling only one ICE stream which can have multiple components. Each pad is responsible for carrying data from/to one component.
linking-using-output-pad
Linking using output pad
To receive messages after establishing ICE connection you have to link Libnice Bin to your element
via Pad.ref(:output, component_id). component_id is an id of component from which your
element will receive messages. E.g. if you passed as n_components 2 it means that there will be
two components and you can link Libnice Bin to your element via Pad.ref(:output, 1)
and Pad.ref(:output, 2).
Important: you can link to Libnice Bin using its output pad in any moment you want but if you don't want to miss any messages do it before playing your pipeline.
Important: you can't link multiple elements using the same component_id. Messages from
one component can be conveyed only to one element.
linking-using-input-pad
Linking using input pad
To send messages after establishing ICE connection you have to link to Libnice Bin via
Pad.ref(:input, component_id). component_id is an id of component which will be used to send
messages via net. To send data from multiple elements via the same component_id you have to
use membrane_funnel_plugin.
messages-api
Messages API
You can send following messages to Libnice Bin:
:gather_candidates{:set_remote_credentials, credentials}- credentials are string in form of "ufrag passwd"{:set_remote_candidate, candidate, component_id}- candidate is a string in form of SDP attribute i.e. it has prefix "a=" e.g. "a=candidate 1 "{:parse_remote_sdp, sdp}:peer_candidate_gathering_done
notifications-api
Notifications API
{:new_candidate_full, candidate}Triggered by::gather_candidates:candidate_gathering_doneTriggered by::gather_candidates{:new_remote_candidate_full, candidate}Triggered by:{:set_remote_candidate, candidate, component_id}or{:parse_remote_sdp, sdp}
sending-and-receiving-messages
Sending and receiving messages
To send or receive messages just link to Libnice Bin using relevant pads. As soon as connection is established your element will receive demands from Libnice Sink or messages from Libnice Source.
bin-options
Bin options
Passed via struct Membrane.Libnice.Bin.t/0
n_componentsinteger()Default value:
1
Number of components that will be created in the streamstream_nameString.t()Default value:
""
Name of the streamstun_servers[ExLibnice.stun_server()]Default value:
[]
List of stun serversturn_servers[ExLibnice.relay_info()]Default value:
[]
List of turn serverscontrolling_modeboolean()Default value:
false
Refer to RFC 8445 section 4 - Controlling and Controlled Agentport_rangeRange.t()Default value:
0..0
The port range to usehandshake_modulemodule()Default value:
Handshake.Default
Module implementing Handshake behaviourhandshake_optskeyword()Default value:
[]
Options for handshake module. They will be passed to init function of hsk_module
pads
Pads
input
:input
| Availability | :on_request |
| Caps | :any |
| Demand unit | :buffers |
| Direction | :input |
| Mode | :pull |
| Name | :input |
output
:output
| Availability | :on_request |
| Caps | :any |
| Direction | :output |
| Mode | :push |
| Name | :output |
Link to this section Summary
Types
Struct containing options for Membrane.Libnice.Bin
Functions
Returns pads descriptions for Membrane.Libnice.Bin
Returns description of options available for this module
Link to this section Types
@type t() :: %Membrane.Libnice.Bin{ controlling_mode: boolean(), handshake_module: module(), handshake_opts: keyword(), n_components: integer(), port_range: Range.t(), stream_name: String.t(), stun_servers: [ExLibnice.stun_server()], turn_servers: [ExLibnice.relay_info()] }
Struct containing options for Membrane.Libnice.Bin
Link to this section Functions
@spec membrane_pads() :: [{Membrane.Pad.name_t(), Membrane.Pad.description_t()}]
Returns pads descriptions for Membrane.Libnice.Bin
@spec options() :: keyword()
Returns description of options available for this module