Skip to content

Commit

Permalink
Allow for sending RTCP in dtls_transport.ex
Browse files Browse the repository at this point in the history
  • Loading branch information
LVala committed Jan 31, 2024
1 parent 72d5783 commit a199e0c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/ex_webrtc/dtls_transport.ex
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,12 @@ defmodule ExWebRTC.DTLSTransport do
end

@impl true
def handle_cast({:send_rtcp, _data}, state) do
# TODO: implement
def handle_cast({:send_rtcp, data}, state) do
case ExLibSRTP.protect_rtcp(state.out_srtp, data) do
{:ok, protected} -> state.ice_transport.send_data(state.ice_pid, protected)
{:error, reason} -> Logger.error("Unable to protect RTCP: #{inspect(reason)}")
end

{:noreply, state}
end

Expand Down Expand Up @@ -293,7 +297,8 @@ defmodule ExWebRTC.DTLSTransport do
notify(state.owner, {type, payload})

{:error, reason} ->
Logger.error("Failed to decrypt SRTP/SRTCP, reason: #{inspect(reason)}")
type = type |> Atom.to_string() |> String.upcase()
Logger.error("Failed to decrypt #{type}, reason: #{inspect(reason)}")
end

{:ok, state}
Expand Down

0 comments on commit a199e0c

Please sign in to comment.