Membrane.RTP.Demuxer (Membrane RTP plugin v0.31.0)

View Source

Element capable of receiving a raw RTP stream and demuxing it into individual parsed streams based on packet ssrcs.

Output pads can be linked either before or after a corresponding stream has been recognized. In the first case the demuxer will start sending buffers on the pad once a stream with payload type or SSRC matching the identification provided via the pad's options is recognized. In the second case, whenever a new stream is recognized and no waiting pad has matching identification, a new_rtp_stream_notification/0 is sent to the element's parent. In turn it should link an output pad of this element, passing the SSRC received in the notification as an option, to receive the stream.

Element options

Passed via struct Membrane.RTP.Demuxer.t/0

  • payload_type_mapping

    RTP.PayloadFormat.payload_type_mapping()

    Default value: %{}
    Mapping of the custom RTP payload types ( > 95).

  • not_linked_pad_handling

    %{action: :raise | :ignore | :warn, timeout: Membrane.Time.t()}

    Default value: %{timeout: 2000000000, action: :warn}
    This option determines the action to be taken after a stream has been announced with a new_rtp_stream_notification/0 notification but the corresponding pad has not been connected within the specified timeout period.

  • srtp

    false | [ExLibSRTP.Policy.t()]

    Default value: false
    Specifies whether to use SRTP to decrypt the input streams. Requires adding srtp dependency to work. If true takes a list of SRTP policies to use for decrypting packets. See ExLibSRTP.Policy.t/0 for details.

Pads

:input

Accepted formats:

%RemoteStream{type: :packetized, content_format: cf} when cf in [RTP, RTCP, nil]
Direction::input
Availability::always
Flow control::auto

:output

Accepted formats:

RTP
Direction::output
Availability::on_request
Flow control::auto

Pad options:

  • stream_id

    stream_id()

    Required
    Specifies what stream will be sent on this pad. If ssrc of the stream is known (for example from new_rtp_stream_notification/0), then most likely it should be used, since it's unique for each stream. If it's not known (for example when the pad is being linked upfront), encoding or payload type should be provided, and the first identified stream of given encoding or payload type will be sent on this pad.

  • clock_rate

    RTP.clock_rate() | nil

    Default value: nil
    Clock rate of the stream. If not provided the demuxer will attempt to resolve it from payload type.

  • jitter_buffer_latency

    Membrane.Time.non_neg()

    Default value: 200000000
    Jitter buffer ensures that incoming packets are reordered based on their sequence numbers. This option specifies maximum latency introduced by the jitter buffer, that is how long the element will wait for out-of-order packets if there are any gaps in sequence numbers. If the order of the packets is ensured by some other means, the latency can be set to 0.

Summary

Types

Notification sent by this element to it's parent when a new stream is received. Receiving a packet with previously unseen ssrc is treated as receiving a new stream.

Metadata present in each output buffer. The ExRTP.Packet.t() struct contains parsed fields of the packet's header. The payload field of this struct will be set to <<>>, and the payload will be present in payload field of the buffer.

Options for pad :output

t()

Struct containing options for Membrane.RTP.Demuxer

Functions

Returns description of options available for this module

Types

new_rtp_stream_notification()

@type new_rtp_stream_notification() ::
  {:new_rtp_stream,
   %{
     ssrc: Membrane.RTP.ssrc(),
     payload_type: Membrane.RTP.payload_type(),
     extensions: [ExRTP.Packet.Extension.t()]
   }}

Notification sent by this element to it's parent when a new stream is received. Receiving a packet with previously unseen ssrc is treated as receiving a new stream.

output_metadata()

@type output_metadata() :: %{rtp: ExRTP.Packet.t()}

Metadata present in each output buffer. The ExRTP.Packet.t() struct contains parsed fields of the packet's header. The payload field of this struct will be set to <<>>, and the payload will be present in payload field of the buffer.

output_pad_options()

@type output_pad_options() :: %{
  stream_id: stream_id(),
  clock_rate: Membrane.RTP.clock_rate(),
  jitter_buffer_latency: Membrane.Time.t()
}

output_pad_opts()

@type output_pad_opts() :: [
  stream_id: stream_id(),
  clock_rate: Membrane.RTP.clock_rate() | nil,
  jitter_buffer_latency: Membrane.Time.non_neg()
]

Options for pad :output

stream_id()

@type stream_id() ::
  {:ssrc, Membrane.RTP.ssrc()}
  | {:encoding_name, Membrane.RTP.encoding_name()}
  | {:payload_type, Membrane.RTP.payload_type()}

stream_phase()

@type stream_phase() :: :waiting_for_matching_pad | :bound_with_pad | :timed_out

t()

@type t() :: %Membrane.RTP.Demuxer{
  not_linked_pad_handling: %{
    action: :raise | :ignore | :warn,
    timeout: Membrane.Time.t()
  },
  payload_type_mapping: Membrane.RTP.PayloadFormat.payload_type_mapping(),
  srtp: false | [ExLibSRTP.Policy.t()]
}

Struct containing options for Membrane.RTP.Demuxer

Functions

options()

@spec options() :: keyword()

Returns description of options available for this module