View Source ExWebRTC.PeerConnection.Configuration (ex_webrtc v0.7.0)

ExWebRTC.PeerConnection configuration.

Summary

Types

Features provided by the ExWebRTC's PeerConnection

ICE (STUN and/or TURN) server used to create the ICE connection.

Options that can be passed to ExWebRTC.PeerConnection.start_link/1.

RTCP feedbacks that are going to be added by default to all of the codecs.

RTP header extension that are going to be included in the SDP offer/answer.

Functions

Returns a list of default audio codecs.

Returns a list of PeerConnection features enabled by default.

Returns a list of default RTCP feedbacks include in SDP offer/answer.

Returns a list of default RTP header extensions to include in SDP offer/answer.

Returns a list of default video codecs.

Types

@type feature() :: :twcc | :inbound_rtx | :outbound_rtx | :rtcp_reports

Features provided by the ExWebRTC's PeerConnection:

  • :twcc - ExWebRTC's PeerConnection will generate TWCC RTCP feedbacks based on incoming packets and send them to the remote peer (implicitly adds the http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 to negotiated RTP header extensions and :twcc RTCP feedback to all of the negotiated codecs, both audio and video).
  • :inbound_rtx - ExWebRTC's PeerConnection will generate NACK RTCP feedbacks in response to missing incoming video packets and properly handle incoming retransmissions (implicitly adds the :nack RTCP feedback and a matching a=rtpmap:[id] rtx/... attribute for every negotiated video codec).
  • :outbound_rtx - ExWebRTC's PeerConnection will respond to incoming NACK RTCP feedbacks and retransmit packets accordingly (implicitly adds the same attributes as :inbound_rtx).
  • :rtcp_reports - ExWebRTC's PeerConnection will generate and send RTCP Sender/Receiver Reports based on incoming/send RTP packets.

Use default_features/0 to get the list of features enabled by default. When passing a list of features to options/0, it will override the default features.

@type ice_server() :: %{
  optional(:credential) => String.t(),
  optional(:username) => String.t(),
  urls: [String.t()] | String.t()
}

ICE (STUN and/or TURN) server used to create the ICE connection.

@type options() :: [
  controlling_process: Process.dest(),
  ice_servers: [ice_server()],
  ice_transport_policy: :relay | :all,
  ice_ip_filter: ExICE.ICEAgent.ip_filter(),
  ice_port_range: Enumerable.t(non_neg_integer()),
  audio_codecs: [ExWebRTC.RTPCodecParameters.t()],
  video_codecs: [ExWebRTC.RTPCodecParameters.t()],
  features: [feature()],
  rtp_header_extensions: [rtp_header_extension()],
  rtcp_feedbacks: [rtcp_feedback()]
]

Options that can be passed to ExWebRTC.PeerConnection.start_link/1.

  • controlling_process - a pid of a process where all messages will be sent. self() by default,
  • ice_servers - list of STUN/TURN servers to use. By default, no servers are provided.
  • ice_transport_policy - which type of ICE candidates should be used. Defaults to :all.
  • ice_ip_filter - filter applied when gathering local candidates. By default, all IP addresses are accepted.
  • ice_port_range - range of ports that ICE will use for gathering host candidates. Defaults to ephemeral ports.
  • audio_codecs and video_codecs - lists of audio and video codecs to negotiate. By default these are equal to default_audio_codecs/0 and default_video_codecs/0. To extend the list with your own codecs, do audio_codecs: Configuration.default_audio_codecs() ++ my_codecs.
  • features - feature flags for some of the ExWebRTC functinalities. Refer to feature/0 for more information.
  • rtp_header_extensions - list of RTP header extensions to negotiate. Refer to rtp_header_extension/0 for more information.
  • rtcp_feedbacks - list of RTCP feedbacks to negotiate. Refer to rtcp_feedback/0 for more information.

Instead of manually enabling an RTP header extension or an RTCP feedback, you may want to use a feature/0, which will enable necessary header extensions under the hood. If you enable RTCP feedback/RTP header extension corresponding to some feature (but not the feature itself), the functionality might not work (e.g. even if you enable TWCC RTP header extension and TWCC feedbacks, without enabling the :twcc features, TWCC feedbacks won't be sent).

ExWebRTC does not allow for configuration of some of the W3C options, but behaves as if these values were used:

  • bundle_policy - max_bundle
  • ice_candidate_pool_size - 0
  • rtcp_mux_policy - require
@type rtcp_feedback() :: %{
  type: :audio | :video | :all,
  feedback: :nack | :fir | :pli | :twcc
}

RTCP feedbacks that are going to be added by default to all of the codecs.

Use default_rtcp_feedbacks/0 to check the RTCP feedbacks included by default. When passing a list of RTPC feedbacks to options/0, it will override the default feedbacks.

Be aware that some of the features (see feature/0) can implicitly add RTCP feedbacks.

Link to this type

rtp_header_extension()

View Source
@type rtp_header_extension() :: %{type: :audio | :video | :all, uri: String.t()}

RTP header extension that are going to be included in the SDP offer/answer.

Keep in mind that you are free to pass any RTP header extension URI, but the underlying RTP parsing library (ex_rtp) might not support it. In such case, you have to parse the header extension yourself.

This header extension will be included in all of the m-lines of provided type (or for both audio and video if :all is used).

Use default_rtp_header_extensions/0 to check the RTP header extensions included by default. When passing a list of RTP header extensions to options/0, it will override the default RTP header extensions.

Be aware that some of the features (see feature/0) can implicitly add RTP header extensions).

Functions

@spec default_audio_codecs() :: [ExWebRTC.RTPCodecParameters.t()]

Returns a list of default audio codecs.

@spec default_features() :: [feature()]

Returns a list of PeerConnection features enabled by default.

Link to this function

default_rtcp_feedbacks()

View Source
@spec default_rtcp_feedbacks() :: [rtcp_feedback()]

Returns a list of default RTCP feedbacks include in SDP offer/answer.

Link to this function

default_rtp_header_extensions()

View Source
@spec default_rtp_header_extensions() :: [rtp_header_extension()]

Returns a list of default RTP header extensions to include in SDP offer/answer.

@spec default_video_codecs() :: [ExWebRTC.RTPCodecParameters.t()]

Returns a list of default video codecs.