Membrane.ICE.Bin (Membrane ICE plugin v0.3.1) 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:

  • {: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 " #TODO

  • {:parse_remote_sdp, sdp}

  • :peer_candidate_gathering_done

Notifications API

  • {:new_candidate_full, candidate} Triggered by: starting pipeline i.e. YourPipeline.play(pid)

  • :candidate_gathering_done Triggered by: starting pipeline i.e. YourPipeline.play(pid)

  • {: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

    any

    Default value: 1

    Number of components that will be created in the stream

  • stream_name

    String.t()

    Default value: ""

    Name of the stream

  • stun_servers

    any

    Default value: []

    List of stun servers in form of ip:port

  • controlling_mode

    any

    Default value: false

    Refer to RFC 8445 section 4 - Controlling and Controlled Agent

  • port_range

    any

    Default value: 0..0

    The port range to use

  • handshake_module

    any

    Default value: Handshake.Default

    Module implementing Handshake behaviour

  • handshake_opts

    any

    Default value: []

    Options for handshake module. They will be passed to init function of

                handshake_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

t()

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: any(),
  handshake_module: any(),
  handshake_opts: any(),
  n_components: any(),
  port_range: any(),
  stream_name: String.t(),
  stun_servers: any()
}

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