Skip to content

Commit

Permalink
Fix ssrc
Browse files Browse the repository at this point in the history
  • Loading branch information
LVala committed Apr 11, 2024
1 parent 33251d4 commit 304dc37
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/ex_webrtc/peer_connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -811,16 +811,16 @@ defmodule ExWebRTC.PeerConnection do

@impl true
def handle_cast({:send_pli, track_id}, state) do
sender =
receiver =
state.transceivers
|> Enum.find_value(fn
%{sender: %{track: %{id: ^track_id}} = sender} -> sender
%{receiver: %{track: %{id: ^track_id}} = receiver} -> receiver
_ -> nil
end)

if sender != nil and sender.ssrc != nil do
if receiver.ssrc != nil do
encoded =
%ExRTCP.Packet.PayloadFeedback.PLI{sender_ssrc: 1, media_ssrc: sender.ssrc}
%ExRTCP.Packet.PayloadFeedback.PLI{sender_ssrc: 1, media_ssrc: receiver.ssrc}
|> ExRTCP.Packet.encode()

:ok = DTLSTransport.send_rtcp(state.dtls_transport, encoded)
Expand Down

0 comments on commit 304dc37

Please sign in to comment.