diff --git a/lib/ex_webrtc/peer_connection.ex b/lib/ex_webrtc/peer_connection.ex index 9f1f615..ab9f4ed 100644 --- a/lib/ex_webrtc/peer_connection.ex +++ b/lib/ex_webrtc/peer_connection.ex @@ -198,6 +198,9 @@ defmodule ExWebRTC.PeerConnection do @doc """ Send an RTP packet to the remote peer using specified track or its id. + + Options: + * `rtx?` - send the packet as it was retransmited (use SSRC and payload type specific to RTX) """ @spec send_rtp( peer_connection(), @@ -1625,6 +1628,8 @@ defmodule ExWebRTC.PeerConnection do nil -> state + # in case NACK was received, but RTX was not negotiated + # as NACK and RTX are negotited independently {%RTPTransceiver{sender: %RTPSender{rtx_pt: nil}}, _idx} -> state diff --git a/test/ex_webrtc/rtp_sender/nack_responder_test.exs b/test/ex_webrtc/rtp_sender/nack_responder_test.exs index 516ef1f..194b016 100644 --- a/test/ex_webrtc/rtp_sender/nack_responder_test.exs +++ b/test/ex_webrtc/rtp_sender/nack_responder_test.exs @@ -24,7 +24,7 @@ defmodule ExWebRTC.RTPReceiver.NACKResponderTest do |> NACKResponder.record_packet(%{@packet | sequence_number: 39}) |> NACKResponder.record_packet(%{@packet | sequence_number: 40}) - nack = NACK.from_sequence_numbers(@media_ssrc, @sender_ssrc, [38, 39]) + nack = NACK.from_sequence_numbers(@media_ssrc, @sender_ssrc, [38, 39, 237]) {rtx_packets, nack_responder} = NACKResponder.get_rtx(nack_responder, nack) assert nack_responder.seq_no == @responder.seq_no + 2