Membrane.ICE.Bin (Membrane ICE plugin v0.5.0) View Source
Bin used for establishing ICE connection, sending and receiving messages.
Architecture and pad semantic
Both input and output pads are dynamic ones. One instance of ICE 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
To receive messages after establishing ICE connection you have to link ICE 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 ICE Bin to your element via Pad.ref(:output, 1)
and Pad.ref(:output, 2)
.
Important: you can link to ICE 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
To send messages after establishing ICE connection you have to link to ICE 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
You can send following messages to ICE 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
{:new_candidate_full, candidate}
Triggered by::gather_candidates
:candidate_gathering_done
Triggered 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
To send or receive messages just link to ICE Bin using relevant pads. As soon as connection is established your element will receive demands from ICE Sink or messages from ICE Source.
Bin options
Passed via struct Membrane.ICE.Bin.t/0
n_components
integer()
Default value:
1
Number of components that will be created in the streamstream_name
String.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_mode
boolean()
Default value:
false
Refer to RFC 8445 section 4 - Controlling and Controlled Agentport_range
Range.t()
Default value:
0..0
The port range to usehandshake_module
module()
Default value:
Handshake.Default
Module implementing Handshake behaviourhandshake_opts
keyword()
Default value:
[]
Options for handshake module. They will be passed to init function of hsk_module
Pads
:input
Availability | :on_request |
Caps | :any |
Demand unit | :buffers |
Direction | :input |
Mode | :pull |
Name | :input |
:output
Availability | :on_request |
Caps | :any |
Direction | :output |
Mode | :push |
Name | :output |
Link to this section Summary
Types
Struct containing options for Membrane.ICE.Bin
Functions
Returns pads descriptions for Membrane.ICE.Bin
Returns description of options available for this module
Link to this section Types
Specs
t() :: %Membrane.ICE.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.ICE.Bin
Link to this section Functions
Specs
membrane_pads() :: [{Membrane.Pad.name_t(), Membrane.Pad.description_t()}]
Returns pads descriptions for Membrane.ICE.Bin
Specs
options() :: keyword()
Returns description of options available for this module