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

Module representing a WebRTC track.

Link to this section Summary

Functions

Given a list of new tracks and a list of already added tracks, adds ssrcs to the new tracks.

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.

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

Link to this section Types

@type encoding() :: :OPUS | :H264 | :VP8
@type id() :: String.t()
@type t() :: %Membrane.WebRTC.Track{
  encoding: encoding(),
  extmaps: [ExSDP.Attribute.Extmap],
  fmtp: ExSDP.Attribute.FMTP.t() | [ExSDP.Attribute.FMTP.t()],
  id: id(),
  mid: binary(),
  name: String.t(),
  rid_to_ssrc: %{},
  rids: [String.t()] | nil,
  rtp_mapping:
    ExSDP.Attribute.RTPMapping.t() | [ExSDP.Attribute.RTPMapping.t()],
  ssrc: RTP.ssrc_t() | [RTP.ssrc_t()],
  status: :pending | :ready | :linked | :disabled,
  stream_id: String.t(),
  type: :audio | :video
}

Link to this section Functions

Link to this function

add_ssrc(tracks, present_tracks)

View Source
@spec add_ssrc(t() | [t()], [t()]) :: [t()]

Given a list of new tracks and a list of already added tracks, adds ssrcs to the new tracks.

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: RTP.ssrc_t() | [RTP.ssrc_t()] | nil,
  encoding: encoding(),
  mid: non_neg_integer(),
  rids: [String.t()] | nil,
  rtp_mapping: ExSDP.Attribute.RTPMapping.t(),
  status: :pending | :ready | :linked | :disabled,
  fmtp: ExSDP.Attribute.FMTP.t(),
  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 stream_id() :: String.t()

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