Membrane.UDP.Endpoint (Membrane UDP plugin v0.14.3)

View Source

Element that sends buffers received on the input pad over a UDP socket and reads packets from a UDP socket and sends their payloads through the output pad.

The local and destination addresses are provided at init via the element's options; the destination can additionally be changed at runtime by returning a :notify_child action with a set_destination_notification/0 from the parents callback:

{[notify_child: {:endpoint, {:set_destination, peer_ip, peer_port}}], state}

With latch?: true, the outbound destination automatically follows the source of the most recent inbound packet. This is useful for talking to peers whose source address may differ from the initially configured destination (e.g. peers behind NAT) or change over time (e.g. mobile peers roaming networks).

Element options

Passed via struct Membrane.UDP.Endpoint.t/0

  • destination_address

    :inet.ip_address()

    Required
    An IP Address that the packets will be sent to.

  • destination_port_no

    destination_port()

    Required
    A UDP port number of a target.

  • local_address

    :inet.socket_address()

    Default value: :any
    This address is used in two cases:

    • An IP Address set for a UDP socket used to sent packets.
    • An IP Address on which the socket will listen. In both cases, it allows to choose which network interface to use if there's more than one.
  • local_port_no

    :inet.port_number()

    Default value: 0
    A UDP port number used when opening a receiving socket and for sending packets.

  • recv_buffer_size

    pos_integer()

    Default value: 1048576
    Size of the receive buffer. Packages of size greater than this buffer will be truncated

  • latch?

    boolean()

    Default value: false
    When true, the outbound destination follows the source of the most recent inbound packet. Until the first inbound packet arrives, outbound goes to the configured destination (the destination_* options, possibly overridden via :set_destination).

Pads

:input

Accepted formats:

_any
Direction::input
Availability::always
Flow control::auto

:output

Accepted formats:

%RemoteStream{type: :packetized}
Direction::output
Availability::always
Flow control::push

Summary

Functions

Returns description of options available for this module

Types

destination_port()

@type destination_port() :: 1..65535

set_destination_notification()

@type set_destination_notification() ::
  {:set_destination, :inet.ip_address(), destination_port()}

t()

@type t() :: %Membrane.UDP.Endpoint{
  destination_address: :inet.ip_address(),
  destination_port_no: destination_port(),
  latch?: boolean(),
  local_address: :inet.socket_address(),
  local_port_no: :inet.port_number(),
  recv_buffer_size: pos_integer()
}

Struct containing options for Membrane.UDP.Endpoint

Functions

options()

@spec options() :: keyword()

Returns description of options available for this module