Skip to content

Commit fc68977

Browse files
committed
Minor docs improvements
1 parent 1f3e6ae commit fc68977

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

lib/ex_webrtc/peer_connection.ex

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ defmodule ExWebRTC.PeerConnection do
5454
:new | :checking | :connected | :completed | :failed | :disconnected | :closed
5555

5656
@typedoc """
57-
Possible DTLS transport state.
57+
Possible DTLS transport states.
5858
5959
For the exact meaning, refer to the [RTCDtlsTransport: state property](https://developer.mozilla.org/en-US/docs/Web/API/RTCDtlsTransport/state)
6060
"""
@@ -73,10 +73,10 @@ defmodule ExWebRTC.PeerConnection do
7373
Most of the messages match the [RTCPeerConnection events](https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection#events),
7474
except for:
7575
* `:dtls_transport_state_change` - traditional WebRTC implementation does not emit such event.
76-
Instead, developer can read DTLS transport state by iterating over RTP receiver/senders, and checking their
76+
Instead, developer can read DTLS transport state by iterating over RTP receivers/senders, and checking their
7777
DTLS transports states. See https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpSender/transport.
7878
However, because Elixir WebRTC creates a single DTLS transport for all receivers and senders, there is one generic
79-
notification informing about DTLS transport state.
79+
notification for convenience and parity with other events informing about ice/signaling/connection state changes.
8080
* `:track_muted`, `:track_ended` - these match the [MediaStreamTrack events](https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack#events).
8181
* `:data` - data received from DataChannel identified by its `ref`.
8282
* `:rtp` and `:rtcp` - these contain packets received by the PeerConnection. The third element of `:rtp` tuple is a simulcast RID and is set to `nil` if simulcast
@@ -1748,9 +1748,7 @@ defmodule ExWebRTC.PeerConnection do
17481748
:ok <- check_altered(type, raw_sdp, state),
17491749
{:ok, sdp} <- parse_sdp(raw_sdp),
17501750
ice_lite <- SDPUtils.get_ice_lite(sdp) do
1751-
# See: https://www.w3.org/TR/webrtc/#ref-for-dfn-icerole-1
1752-
# Also, this has to be before gathering candidates.
1753-
# Note: If we add support for ice-lite, this code needs to be adjusted.
1751+
# This has to be called before gathering candidates.
17541752
if state.ice_transport.get_role(state.ice_pid) == nil do
17551753
set_ice_role(state, :local, type, ice_lite)
17561754
end
@@ -1798,8 +1796,6 @@ defmodule ExWebRTC.PeerConnection do
17981796
{:ok, dtls_role} <- SDPUtils.get_dtls_role(sdp) do
17991797
config = Configuration.update(state.config, sdp)
18001798

1801-
# See: https://www.w3.org/TR/webrtc/#ref-for-dfn-icerole-1
1802-
# Note: If we add support for ice-lite, this code needs to be adjusted.
18031799
if state.ice_transport.get_role(state.ice_pid) == nil do
18041800
set_ice_role(state, :remote, type, ice_lite)
18051801
end
@@ -1967,10 +1963,15 @@ defmodule ExWebRTC.PeerConnection do
19671963
%{state | pending_remote_desc: {type, sdp}}
19681964
end
19691965

1970-
defp set_ice_role(state, :local, :offer, _ice_lite) do
1966+
# See: https://www.w3.org/TR/webrtc/#ref-for-dfn-icerole-1
1967+
defp set_ice_role(state, :local, :offer, false) do
19711968
:ok = state.ice_transport.set_role(state.ice_pid, :controlling)
19721969
end
19731970

1971+
defp set_ice_role(state, :local, :offer, true) do
1972+
:ok = state.ice_transport.set_role(state.ice_pid, :controlled)
1973+
end
1974+
19741975
defp set_ice_role(state, :remote, :offer, true) do
19751976
:ok = state.ice_transport.set_role(state.ice_pid, :controlling)
19761977
end

lib/ex_webrtc/peer_connection/configuration.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ defmodule ExWebRTC.PeerConnection.Configuration do
199199
ice_servers: [],
200200
ice_transport_policy: :all,
201201
ice_port_range: [0],
202-
ice_role: :controlled,
203202
audio_codecs: @default_audio_codecs,
204203
video_codecs: @default_video_codecs,
205204
features: @default_features

0 commit comments

Comments
 (0)