Skip to content

Commit

Permalink
Fix ICECandidate types
Browse files Browse the repository at this point in the history
  • Loading branch information
roznawsk committed Nov 19, 2024
1 parent f13a6b4 commit 5a3fb74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/ex_webrtc/ice_candidate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ defmodule ExWebRTC.ICECandidate do

@type t() :: %__MODULE__{
candidate: binary(),
sdp_mid: non_neg_integer() | nil,
sdp_mid: binary() | nil,
sdp_m_line_index: non_neg_integer() | nil,
username_fragment: binary() | nil
}

defstruct [:candidate, :username_fragment, :sdp_mid, :sdp_m_line_index]

@spec to_json(t()) :: %{String.t() => String.t()}
@spec to_json(t()) :: %{String.t() => String.t() | non_neg_integer() | nil}
def to_json(%__MODULE__{} = c) do
%{
"candidate" => c.candidate,
Expand All @@ -22,7 +22,7 @@ defmodule ExWebRTC.ICECandidate do
}
end

@spec from_json(%{String.t() => String.t()}) :: t()
@spec from_json(%{String.t() => String.t() | non_neg_integer() | nil}) :: t()
def from_json(%{
"candidate" => c,
"sdpMid" => mid,
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_webrtc/peer_connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,7 @@ defmodule ExWebRTC.PeerConnection do
def handle_info({:ex_ice, _from, {:new_candidate, candidate}}, state) do
candidate = %ICECandidate{
candidate: "candidate:" <> candidate,
sdp_mid: 0,
sdp_mid: "0",
sdp_m_line_index: 0
# username_fragment: "vx/1"
}
Expand Down

0 comments on commit 5a3fb74

Please sign in to comment.