From e47e1658c226f5b4c4cc1768261b27d51f9ff083 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Mon, 23 Jun 2025 16:04:14 +0200 Subject: [PATCH 1/6] Add track to MSID --- lib/ex_webrtc/rtp_transceiver.ex | 61 +++++++++++++++---------- test/ex_webrtc/rtp_transceiver_test.exs | 59 +++++++++++++++++------- 2 files changed, 78 insertions(+), 42 deletions(-) diff --git a/lib/ex_webrtc/rtp_transceiver.ex b/lib/ex_webrtc/rtp_transceiver.ex index 20478572..19b407c3 100644 --- a/lib/ex_webrtc/rtp_transceiver.ex +++ b/lib/ex_webrtc/rtp_transceiver.ex @@ -578,16 +578,20 @@ defmodule ExWebRTC.RTPTransceiver do @doc false defp get_sender_attrs(track, codecs, ssrc, rtx_ssrc) do - # Don't include track id. See RFC 8829 sec. 5.2.1 + # According to RFC 8829 sec. 5.2.1, track IDs should not be included. + # However, most browsers support track IDs in MSID. We will follow this practice. msid_attrs = case track do - %MediaStreamTrack{streams: streams} when streams != [] -> - Enum.map(streams, &ExSDP.Attribute.MSID.new(&1, nil)) + %MediaStreamTrack{streams: streams, id: id} when streams != [] -> + Enum.map(streams, &ExSDP.Attribute.MSID.new(&1, id)) - _other -> + %MediaStreamTrack{id: id} -> # In theory, we should do this "for each MediaStream that was associated with the transceiver", # but web browsers (chrome, ff) include MSID even when there aren't any MediaStreams - [ExSDP.Attribute.MSID.new("-", nil)] + [ExSDP.Attribute.MSID.new("-", id)] + + nil -> + [] end ssrc_attrs = get_ssrc_attrs(codecs, ssrc, rtx_ssrc, track) @@ -609,43 +613,38 @@ defmodule ExWebRTC.RTPTransceiver do # we have a codec but not rtx codec defp do_get_ssrc_attrs(_codec, false, ssrc, _rtx_ssrc, track) do - streams = (track && track.streams) || [] - - case streams do - [] -> - [%ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "-"}] - - streams -> + case track do + %MediaStreamTrack{streams: streams, id: id} when streams != [] -> Enum.map(streams, fn stream -> - %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: stream} + %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "#{stream} #{id}"} end) + + %MediaStreamTrack{id: id} -> + [%ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- #{id}"}] + + nil -> + [%ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- -"}] end end # we have both codec and rtx codec defp do_get_ssrc_attrs(_codec, _rtx_codec, ssrc, rtx_ssrc, track) do - streams = (track && track.streams) || [] - fid = %ExSDP.Attribute.SSRCGroup{semantics: "FID", ssrcs: [ssrc, rtx_ssrc]} ssrc_attrs = - case streams do - [] -> - [ - %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "-"}, - %ExSDP.Attribute.SSRC{id: rtx_ssrc, attribute: "msid", value: "-"} - ] - - streams -> + case track do + %MediaStreamTrack{streams: streams, id: id} when streams != [] -> {ssrc_attrs, rtx_ssrc_attrs} = Enum.reduce(streams, {[], []}, fn stream, {ssrc_attrs, rtx_ssrc_attrs} -> - ssrc_attr = %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: stream} + ssrc_value = "#{stream} #{id}" + + ssrc_attr = %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: ssrc_value} ssrc_attrs = [ssrc_attr | ssrc_attrs] rtx_ssrc_attr = %ExSDP.Attribute.SSRC{ id: rtx_ssrc, attribute: "msid", - value: stream + value: ssrc_value } rtx_ssrc_attrs = [rtx_ssrc_attr | rtx_ssrc_attrs] @@ -654,6 +653,18 @@ defmodule ExWebRTC.RTPTransceiver do end) Enum.reverse(ssrc_attrs) ++ Enum.reverse(rtx_ssrc_attrs) + + %MediaStreamTrack{id: id} -> + [ + %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- #{id}"}, + %ExSDP.Attribute.SSRC{id: rtx_ssrc, attribute: "msid", value: "- #{id}"} + ] + + nil -> + [ + %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- -"}, + %ExSDP.Attribute.SSRC{id: rtx_ssrc, attribute: "msid", value: "- -"} + ] end [fid | ssrc_attrs] diff --git a/test/ex_webrtc/rtp_transceiver_test.exs b/test/ex_webrtc/rtp_transceiver_test.exs index c9fc58c7..19d736bb 100644 --- a/test/ex_webrtc/rtp_transceiver_test.exs +++ b/test/ex_webrtc/rtp_transceiver_test.exs @@ -74,13 +74,14 @@ defmodule ExWebRTC.RTPTransceiverTest do ) mline = RTPTransceiver.to_offer_mline(tr, @opts) + ssrc_value = ssrc_value(@stream_id, @track.id) assert [%ExSDP.Attribute.MSID{id: @stream_id}] = ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) assert [] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRCGroup) - assert [%ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: @stream_id}] = + assert [%ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: ^ssrc_value}] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) end @@ -93,16 +94,17 @@ defmodule ExWebRTC.RTPTransceiverTest do ) mline = RTPTransceiver.to_offer_mline(tr, @opts) + ssrc_value = ssrc_value(@stream_id, @track.id) - assert [%ExSDP.Attribute.MSID{id: @stream_id, app_data: nil}] = + assert [%ExSDP.Attribute.MSID{id: @stream_id, app_data: @track.id}] == ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) assert [%ExSDP.Attribute.SSRCGroup{semantics: "FID", ssrcs: [@ssrc, @rtx_ssrc]}] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRCGroup) assert [ - %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: @stream_id}, - %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: @stream_id} + %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: ^ssrc_value}, + %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: ^ssrc_value} ] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) end @@ -118,16 +120,16 @@ defmodule ExWebRTC.RTPTransceiverTest do mline = RTPTransceiver.to_offer_mline(tr, @opts) - assert [%ExSDP.Attribute.MSID{id: "-", app_data: nil}] = + assert [%ExSDP.Attribute.MSID{id: "-", app_data: track.id}] == ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) assert [%ExSDP.Attribute.SSRCGroup{semantics: "FID", ssrcs: [@ssrc, @rtx_ssrc]}] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRCGroup) assert [ - %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: "-"}, - %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: "-"} - ] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) + %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: "- #{track.id}"}, + %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: "- #{track.id}"} + ] == ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) end test "with multiple media streams" do @@ -145,20 +147,23 @@ defmodule ExWebRTC.RTPTransceiverTest do mline = RTPTransceiver.to_offer_mline(tr, @opts) + ssrc1_value = ssrc_value(s1_id, track.id) + ssrc2_value = ssrc_value(s2_id, track.id) + assert [ - %ExSDP.Attribute.MSID{id: ^s1_id, app_data: nil}, - %ExSDP.Attribute.MSID{id: ^s2_id, app_data: nil} - ] = ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) + %ExSDP.Attribute.MSID{id: s1_id, app_data: track.id}, + %ExSDP.Attribute.MSID{id: s2_id, app_data: track.id} + ] == ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) assert [%ExSDP.Attribute.SSRCGroup{semantics: "FID", ssrcs: [@ssrc, @rtx_ssrc]}] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRCGroup) assert [ - %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: ^s1_id}, - %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: ^s2_id}, - %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: ^s1_id}, - %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: ^s2_id} - ] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) + %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: ssrc1_value}, + %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: ssrc2_value}, + %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: ssrc1_value}, + %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: ssrc2_value} + ] == ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) end test "without codecs" do @@ -174,12 +179,30 @@ defmodule ExWebRTC.RTPTransceiverTest do mline = RTPTransceiver.to_offer_mline(tr, @opts) - assert [%ExSDP.Attribute.MSID{id: @stream_id, app_data: nil}] = + assert [%ExSDP.Attribute.MSID{id: @stream_id, app_data: @track.id}] == ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) assert [] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRCGroup) assert [] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) end + + test "without track" do + tr = + RTPTransceiver.new(:video, nil, @config, + ssrc: @ssrc, + rtx_ssrc: @rtx_ssrc, + direction: :sendrecv + ) + + mline = RTPTransceiver.to_offer_mline(tr, @opts) + + assert [] = ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) + + assert [ + %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: "- -"}, + %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: "- -"} + ] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) + end end defp test_sender_attrs_present(tr) do @@ -201,4 +224,6 @@ defmodule ExWebRTC.RTPTransceiverTest do assert [] == ExSDP.get_attributes(mline, ExSDP.Attribute.SSRCGroup) assert [] == ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) end + + defp ssrc_value(stream, app_data), do: "#{stream} #{app_data}" end From b22d21c147fb1e2b2ccdd6ece9305d0d5124061a Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Wed, 25 Jun 2025 11:09:44 +0200 Subject: [PATCH 2/6] Rename ssrc_value to ssrc_msid_value --- .tool-versions | 2 ++ test/ex_webrtc/rtp_transceiver_test.exs | 10 +++++----- 2 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 00000000..c1339684 --- /dev/null +++ b/.tool-versions @@ -0,0 +1,2 @@ +elixir 1.18.3-otp-27 +erlang 27.3.1 diff --git a/test/ex_webrtc/rtp_transceiver_test.exs b/test/ex_webrtc/rtp_transceiver_test.exs index 19d736bb..33433b54 100644 --- a/test/ex_webrtc/rtp_transceiver_test.exs +++ b/test/ex_webrtc/rtp_transceiver_test.exs @@ -74,7 +74,7 @@ defmodule ExWebRTC.RTPTransceiverTest do ) mline = RTPTransceiver.to_offer_mline(tr, @opts) - ssrc_value = ssrc_value(@stream_id, @track.id) + ssrc_value = ssrc_msid_value(@stream_id, @track.id) assert [%ExSDP.Attribute.MSID{id: @stream_id}] = ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) @@ -94,7 +94,7 @@ defmodule ExWebRTC.RTPTransceiverTest do ) mline = RTPTransceiver.to_offer_mline(tr, @opts) - ssrc_value = ssrc_value(@stream_id, @track.id) + ssrc_value = ssrc_msid_value(@stream_id, @track.id) assert [%ExSDP.Attribute.MSID{id: @stream_id, app_data: @track.id}] == ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) @@ -147,8 +147,8 @@ defmodule ExWebRTC.RTPTransceiverTest do mline = RTPTransceiver.to_offer_mline(tr, @opts) - ssrc1_value = ssrc_value(s1_id, track.id) - ssrc2_value = ssrc_value(s2_id, track.id) + ssrc1_value = ssrc_msid_value(s1_id, track.id) + ssrc2_value = ssrc_msid_value(s2_id, track.id) assert [ %ExSDP.Attribute.MSID{id: s1_id, app_data: track.id}, @@ -225,5 +225,5 @@ defmodule ExWebRTC.RTPTransceiverTest do assert [] == ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) end - defp ssrc_value(stream, app_data), do: "#{stream} #{app_data}" + defp ssrc_msid_value(stream, app_data), do: "#{stream} #{app_data}" end From 1f6ec0c107363d29f7e890cfd6ad0b4922e91b7f Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Wed, 25 Jun 2025 20:02:13 +0200 Subject: [PATCH 3/6] Use sender_id as default msid app_data --- lib/ex_webrtc/rtp_transceiver.ex | 30 +++++++++++++------------ test/ex_webrtc/rtp_transceiver_test.exs | 6 ++--- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/lib/ex_webrtc/rtp_transceiver.ex b/lib/ex_webrtc/rtp_transceiver.ex index 19b407c3..81792423 100644 --- a/lib/ex_webrtc/rtp_transceiver.ex +++ b/lib/ex_webrtc/rtp_transceiver.ex @@ -558,7 +558,7 @@ defmodule ExWebRTC.RTPTransceiver do else: transceiver.sender.codecs get_sender_attrs( - transceiver.sender.track, + transceiver.sender, codecs, transceiver.sender.ssrc, transceiver.sender.rtx_ssrc @@ -577,11 +577,11 @@ defmodule ExWebRTC.RTPTransceiver do end @doc false - defp get_sender_attrs(track, codecs, ssrc, rtx_ssrc) do + defp get_sender_attrs(sender, codecs, ssrc, rtx_ssrc) do # According to RFC 8829 sec. 5.2.1, track IDs should not be included. # However, most browsers support track IDs in MSID. We will follow this practice. msid_attrs = - case track do + case sender.track do %MediaStreamTrack{streams: streams, id: id} when streams != [] -> Enum.map(streams, &ExSDP.Attribute.MSID.new(&1, id)) @@ -594,26 +594,26 @@ defmodule ExWebRTC.RTPTransceiver do [] end - ssrc_attrs = get_ssrc_attrs(codecs, ssrc, rtx_ssrc, track) + ssrc_attrs = get_ssrc_attrs(codecs, ssrc, rtx_ssrc, sender) msid_attrs ++ ssrc_attrs end - defp get_ssrc_attrs(codecs, ssrc, rtx_ssrc, track) do + defp get_ssrc_attrs(codecs, ssrc, rtx_ssrc, sender) do codec = Enum.any?(codecs, fn codec -> not String.ends_with?(codec.mime_type, "/rtx") end) rtx_codec = Enum.any?(codecs, fn codec -> String.ends_with?(codec.mime_type, "/rtx") end) - do_get_ssrc_attrs(codec, rtx_codec, ssrc, rtx_ssrc, track) + do_get_ssrc_attrs(codec, rtx_codec, ssrc, rtx_ssrc, sender) end # we didn't manage to negotiate any codec - defp do_get_ssrc_attrs(false, _rtx_codec, _ssrc, _rtx_ssrc, _track) do + defp do_get_ssrc_attrs(false, _rtx_codec, _ssrc, _rtx_ssrc, _sender) do [] end # we have a codec but not rtx codec - defp do_get_ssrc_attrs(_codec, false, ssrc, _rtx_ssrc, track) do - case track do + defp do_get_ssrc_attrs(_codec, false, ssrc, _rtx_ssrc, sender) do + case sender.track do %MediaStreamTrack{streams: streams, id: id} when streams != [] -> Enum.map(streams, fn stream -> %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "#{stream} #{id}"} @@ -623,16 +623,18 @@ defmodule ExWebRTC.RTPTransceiver do [%ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- #{id}"}] nil -> - [%ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- -"}] + # If the track_id is missing, we will default to using the sender_id, following Chromium's approach: + # See: https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/pc/sdp_offer_answer.cc;l=739;drc=b8b5768e5d0d1c2a84fe4896eae884d97fd1131e;bpv=1;bpt=1 + [%ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- #{sender.id}"}] end end # we have both codec and rtx codec - defp do_get_ssrc_attrs(_codec, _rtx_codec, ssrc, rtx_ssrc, track) do + defp do_get_ssrc_attrs(_codec, _rtx_codec, ssrc, rtx_ssrc, sender) do fid = %ExSDP.Attribute.SSRCGroup{semantics: "FID", ssrcs: [ssrc, rtx_ssrc]} ssrc_attrs = - case track do + case sender.track do %MediaStreamTrack{streams: streams, id: id} when streams != [] -> {ssrc_attrs, rtx_ssrc_attrs} = Enum.reduce(streams, {[], []}, fn stream, {ssrc_attrs, rtx_ssrc_attrs} -> @@ -662,8 +664,8 @@ defmodule ExWebRTC.RTPTransceiver do nil -> [ - %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- -"}, - %ExSDP.Attribute.SSRC{id: rtx_ssrc, attribute: "msid", value: "- -"} + %ExSDP.Attribute.SSRC{id: ssrc, attribute: "msid", value: "- #{sender.id}"}, + %ExSDP.Attribute.SSRC{id: rtx_ssrc, attribute: "msid", value: "- #{sender.id}"} ] end diff --git a/test/ex_webrtc/rtp_transceiver_test.exs b/test/ex_webrtc/rtp_transceiver_test.exs index 33433b54..a08121d3 100644 --- a/test/ex_webrtc/rtp_transceiver_test.exs +++ b/test/ex_webrtc/rtp_transceiver_test.exs @@ -199,9 +199,9 @@ defmodule ExWebRTC.RTPTransceiverTest do assert [] = ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) assert [ - %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: "- -"}, - %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: "- -"} - ] = ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) + %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: "- #{tr.sender.id}"}, + %ExSDP.Attribute.SSRC{id: @rtx_ssrc, attribute: "msid", value: "- #{tr.sender.id}"} + ] == ExSDP.get_attributes(mline, ExSDP.Attribute.SSRC) end end From f4a4ab4a59dda7fe7182ef6fb13ee7173172969e Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Thu, 26 Jun 2025 13:24:57 +0200 Subject: [PATCH 4/6] Requested changes --- lib/ex_webrtc/rtp_transceiver.ex | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/ex_webrtc/rtp_transceiver.ex b/lib/ex_webrtc/rtp_transceiver.ex index 81792423..9b43f912 100644 --- a/lib/ex_webrtc/rtp_transceiver.ex +++ b/lib/ex_webrtc/rtp_transceiver.ex @@ -559,9 +559,7 @@ defmodule ExWebRTC.RTPTransceiver do get_sender_attrs( transceiver.sender, - codecs, - transceiver.sender.ssrc, - transceiver.sender.rtx_ssrc + codecs ) else [] @@ -577,7 +575,7 @@ defmodule ExWebRTC.RTPTransceiver do end @doc false - defp get_sender_attrs(sender, codecs, ssrc, rtx_ssrc) do + defp get_sender_attrs(sender, codecs) do # According to RFC 8829 sec. 5.2.1, track IDs should not be included. # However, most browsers support track IDs in MSID. We will follow this practice. msid_attrs = @@ -594,25 +592,25 @@ defmodule ExWebRTC.RTPTransceiver do [] end - ssrc_attrs = get_ssrc_attrs(codecs, ssrc, rtx_ssrc, sender) + ssrc_attrs = get_ssrc_attrs(sender, codecs) msid_attrs ++ ssrc_attrs end - defp get_ssrc_attrs(codecs, ssrc, rtx_ssrc, sender) do + defp get_ssrc_attrs(sender, codecs) do codec = Enum.any?(codecs, fn codec -> not String.ends_with?(codec.mime_type, "/rtx") end) rtx_codec = Enum.any?(codecs, fn codec -> String.ends_with?(codec.mime_type, "/rtx") end) - do_get_ssrc_attrs(codec, rtx_codec, ssrc, rtx_ssrc, sender) + do_get_ssrc_attrs(sender, codec, rtx_codec) end # we didn't manage to negotiate any codec - defp do_get_ssrc_attrs(false, _rtx_codec, _ssrc, _rtx_ssrc, _sender) do + defp do_get_ssrc_attrs(_sender, false, _rtx_codec) do [] end # we have a codec but not rtx codec - defp do_get_ssrc_attrs(_codec, false, ssrc, _rtx_ssrc, sender) do + defp do_get_ssrc_attrs(%{ssrc: ssrc} = sender, _codec, false) do case sender.track do %MediaStreamTrack{streams: streams, id: id} when streams != [] -> Enum.map(streams, fn stream -> @@ -630,7 +628,7 @@ defmodule ExWebRTC.RTPTransceiver do end # we have both codec and rtx codec - defp do_get_ssrc_attrs(_codec, _rtx_codec, ssrc, rtx_ssrc, sender) do + defp do_get_ssrc_attrs(%{ssrc: ssrc, rtx_ssrc: rtx_ssrc} = sender, _codec, _rtx_codec) do fid = %ExSDP.Attribute.SSRCGroup{semantics: "FID", ssrcs: [ssrc, rtx_ssrc]} ssrc_attrs = From 00ac212a3f96affdf6d478e6f7c6c8570352a471 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Thu, 26 Jun 2025 14:13:08 +0200 Subject: [PATCH 5/6] Add MSID event if there is no track --- lib/ex_webrtc/rtp_transceiver.ex | 2 +- test/ex_webrtc/rtp_transceiver_test.exs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/ex_webrtc/rtp_transceiver.ex b/lib/ex_webrtc/rtp_transceiver.ex index 9b43f912..08fc1fc6 100644 --- a/lib/ex_webrtc/rtp_transceiver.ex +++ b/lib/ex_webrtc/rtp_transceiver.ex @@ -589,7 +589,7 @@ defmodule ExWebRTC.RTPTransceiver do [ExSDP.Attribute.MSID.new("-", id)] nil -> - [] + [ExSDP.Attribute.MSID.new("-", sender.id)] end ssrc_attrs = get_ssrc_attrs(sender, codecs) diff --git a/test/ex_webrtc/rtp_transceiver_test.exs b/test/ex_webrtc/rtp_transceiver_test.exs index a08121d3..585ef3ed 100644 --- a/test/ex_webrtc/rtp_transceiver_test.exs +++ b/test/ex_webrtc/rtp_transceiver_test.exs @@ -196,7 +196,8 @@ defmodule ExWebRTC.RTPTransceiverTest do mline = RTPTransceiver.to_offer_mline(tr, @opts) - assert [] = ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) + assert [%ExSDP.Attribute.MSID{id: "-", app_data: tr.sender.id}] == + ExSDP.get_attributes(mline, ExSDP.Attribute.MSID) assert [ %ExSDP.Attribute.SSRC{id: @ssrc, attribute: "msid", value: "- #{tr.sender.id}"}, From a62d3504e8eb95bc8bb37113ce8479eb85a4d2c1 Mon Sep 17 00:00:00 2001 From: Karol Konkol Date: Thu, 26 Jun 2025 14:40:13 +0200 Subject: [PATCH 6/6] Remove tool versions --- .tool-versions | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .tool-versions diff --git a/.tool-versions b/.tool-versions deleted file mode 100644 index c1339684..00000000 --- a/.tool-versions +++ /dev/null @@ -1,2 +0,0 @@ -elixir 1.18.3-otp-27 -erlang 27.3.1