Skip to content

Commit b36e75d

Browse files
committed
Fix some typos. Don't set sender_ssrc in record_packet. Refactor test.
1 parent f5a0198 commit b36e75d

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

lib/ex_webrtc/peer_connection.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ defmodule ExWebRTC.PeerConnection do
165165
should be used for sending.
166166
167167
Once the first RTP packet is sent (via `send_rtp/4`), `set_sender_codec/3`
168-
can only be called with a codec with the clock rate.
168+
can only be called with a codec with the same clock rate.
169169
170170
Although very unlikely, keep in mind that after renegotiation,
171171
the selected codec may no longer be supported by the remote side and you might
@@ -177,6 +177,10 @@ defmodule ExWebRTC.PeerConnection do
177177
{:ok, pc} = PeerConnection.start_link()
178178
{:ok, rtp_sender} = PeerConnection.add_track(MediaStreamTrack.new(:video))
179179
180+
# exchange SDP with the remote side
181+
# {:ok, offer} = PeerConnection.create_offer(pc)
182+
# ...
183+
180184
tr =
181185
pc
182186
|> PeerConnection.get_transceivers()

lib/ex_webrtc/rtp_sender.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ defmodule ExWebRTC.RTPSender do
263263
defp rtx?(codec), do: String.ends_with?(codec.mime_type, "rtx")
264264
defp supported?(sender, codec), do: codec in sender.codecs
265265

266-
# As long as report recorder is not initialized i.e. we have not send any RTP packet
267-
# allow for codec changes. Once we start sending RTP packet, require the same clock rate.
266+
# As long as report recorder is not initialized i.e. we have not sent any RTP packet,
267+
# allow for codec changes. Once we start sending RTP packets, require the same clock rate.
268268
defp same_clock_rate?(%{report_recorder: %{clock_rate: nil}}, _codec), do: true
269269
defp same_clock_rate?(sender, codec), do: sender.report_recorder.clock_rate == codec.clock_rate
270270

lib/ex_webrtc/rtp_sender/report_recorder.ex

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ defmodule ExWebRTC.RTPSender.ReportRecorder do
5050
def record_packet(%{last_seq_no: nil} = recorder, packet, time) do
5151
%__MODULE__{
5252
recorder
53-
| sender_ssrc: packet.ssrc,
54-
last_rtp_timestamp: packet.timestamp,
53+
| last_rtp_timestamp: packet.timestamp,
5554
last_seq_no: packet.sequence_number,
5655
last_timestamp: time,
5756
packet_count: 1,

test/ex_webrtc/rtp_sender/report_recorder_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule ExWebRTC.RTPSender.ReportRecorderTest do
1010
@rtp_ts 234_444
1111
@clock_rate 90_000
1212
@packet ExRTP.Packet.new(<<>>, sequence_number: @seq_no, timestamp: @rtp_ts)
13-
@recorder %ReportRecorder{sender_ssrc: 123_467, clock_rate: @clock_rate}
13+
@recorder ReportRecorder.init(%ReportRecorder{}, 123_467, @clock_rate)
1414

1515
@ntp_offset 2_208_988_800
1616
@max_u32 0xFFFFFFFF

test/ex_webrtc/rtp_sender_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ defmodule ExWebRTC.RTPSenderTest do
4949
%{sender: sender}
5050
end
5151

52-
test "new/6" do
52+
test "new/7" do
5353
track = MediaStreamTrack.new(:video)
5454

5555
codecs = [@vp8, @av1, @av1_45khz, @rtx]

0 commit comments

Comments
 (0)