View Source Membrane.WebRTC.Track (Membrane WebRTC plugin v0.18.1)

Module representing a WebRTC track.

Summary

Functions

Creates t/0 from SDP m-line with random track id and stream id.

Creates t/0 from SDP m-line with specific track id and stream id.

Creates a new track.

Modifies track properties according to provided constraints.

Determines if the track is using simulcast

Generates stream id, that can be used to mark tracks belonging to the same stream.

Types

@type encoding_key() :: :OPUS | :H264 | :VP8
@type id() :: String.t()
@type rid() :: String.t()
@type status() :: :pending | :ready | :linked | :disabled
@type t() :: %Membrane.WebRTC.Track{
  extmaps: [ExSDP.Attribute.Extmap],
  id: id(),
  mid: binary(),
  name: String.t(),
  offered_encodings: [Membrane.WebRTC.Track.Encoding.t()],
  rid_to_ssrc: %{},
  rids: [rid()] | nil,
  rtx_ssrc: Membrane.RTP.ssrc_t() | [Membrane.RTP.ssrc_t()] | nil,
  selected_encoding: term(),
  selected_encoding_key: encoding_key(),
  ssrc: Membrane.RTP.ssrc_t() | [Membrane.RTP.ssrc_t()],
  status: status(),
  stream_id: String.t(),
  type: :audio | :video
}

Functions

Link to this function

from_sdp_media(sdp_media)

View Source
@spec from_sdp_media(ExSDP.Media.t()) :: t()

Creates t/0 from SDP m-line with random track id and stream id.

Link to this function

from_sdp_media(sdp_media, id, stream_id)

View Source
@spec from_sdp_media(ExSDP.Media.t(), id(), String.t()) :: t()

Creates t/0 from SDP m-line with specific track id and stream id.

Link to this function

new(type, stream_id, opts \\ [])

View Source
@spec new(:audio | :video, stream_id :: String.t(),
  id: String.t(),
  name: String.t(),
  ssrc: Membrane.RTP.ssrc_t() | [Membrane.RTP.ssrc_t()] | nil,
  rtx_ssrc: Membrane.RTP.ssrc_t() | nil,
  selected_encoding_key: encoding_key(),
  offered_encodings: [Membrane.WebRTC.Track.Encoding.t()],
  mid: non_neg_integer(),
  rids: [String.t()] | nil,
  status: status(),
  extmaps: [ExSDP.Attribute.Extmap]
) :: t()

Creates a new track.

Tracks belonging to the same stream should have the same stream_id, that can be generated with stream_id/0.

Link to this function

set_constraints(track, track_type, constraints)

View Source
@spec set_constraints(t(), :inbound | :outbound, map()) :: t()

Modifies track properties according to provided constraints.

In particular, after setting constraints, track can be disabled.

@spec simulcast?(t()) :: boolean()

Determines if the track is using simulcast

@spec stream_id() :: String.t()

Generates stream id, that can be used to mark tracks belonging to the same stream.

@spec to_otel_data(t()) :: String.t()