@@ -74,13 +74,14 @@ defmodule ExWebRTC.RTPTransceiverTest do
7474 )
7575
7676 mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
77+ ssrc_value = ssrc_value ( @ stream_id , @ track . id )
7778
7879 assert [ % ExSDP.Attribute.MSID { id: @ stream_id } ] =
7980 ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
8081
8182 assert [ ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
8283
83- assert [ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: @ stream_id } ] =
84+ assert [ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: ^ ssrc_value } ] =
8485 ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
8586 end
8687
@@ -93,16 +94,17 @@ defmodule ExWebRTC.RTPTransceiverTest do
9394 )
9495
9596 mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
97+ ssrc_value = ssrc_value ( @ stream_id , @ track . id )
9698
97- assert [ % ExSDP.Attribute.MSID { id: @ stream_id , app_data: nil } ] =
99+ assert [ % ExSDP.Attribute.MSID { id: @ stream_id , app_data: @ track . id } ] = =
98100 ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
99101
100102 assert [ % ExSDP.Attribute.SSRCGroup { semantics: "FID" , ssrcs: [ @ ssrc , @ rtx_ssrc ] } ] =
101103 ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
102104
103105 assert [
104- % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: @ stream_id } ,
105- % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: @ stream_id }
106+ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: ^ ssrc_value } ,
107+ % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: ^ ssrc_value }
106108 ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
107109 end
108110
@@ -118,16 +120,16 @@ defmodule ExWebRTC.RTPTransceiverTest do
118120
119121 mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
120122
121- assert [ % ExSDP.Attribute.MSID { id: "-" , app_data: nil } ] =
123+ assert [ % ExSDP.Attribute.MSID { id: "-" , app_data: track . id } ] = =
122124 ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
123125
124126 assert [ % ExSDP.Attribute.SSRCGroup { semantics: "FID" , ssrcs: [ @ ssrc , @ rtx_ssrc ] } ] =
125127 ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
126128
127129 assert [
128- % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: "-" } ,
129- % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: "-" }
130- ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
130+ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: "- #{ track . id } " } ,
131+ % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: "- #{ track . id } " }
132+ ] == ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
131133 end
132134
133135 test "with multiple media streams" do
@@ -145,20 +147,23 @@ defmodule ExWebRTC.RTPTransceiverTest do
145147
146148 mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
147149
150+ ssrc1_value = ssrc_value ( s1_id , track . id )
151+ ssrc2_value = ssrc_value ( s2_id , track . id )
152+
148153 assert [
149- % ExSDP.Attribute.MSID { id: ^ s1_id , app_data: nil } ,
150- % ExSDP.Attribute.MSID { id: ^ s2_id , app_data: nil }
151- ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
154+ % ExSDP.Attribute.MSID { id: s1_id , app_data: track . id } ,
155+ % ExSDP.Attribute.MSID { id: s2_id , app_data: track . id }
156+ ] == ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
152157
153158 assert [ % ExSDP.Attribute.SSRCGroup { semantics: "FID" , ssrcs: [ @ ssrc , @ rtx_ssrc ] } ] =
154159 ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
155160
156161 assert [
157- % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: ^ s1_id } ,
158- % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: ^ s2_id } ,
159- % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: ^ s1_id } ,
160- % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: ^ s2_id }
161- ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
162+ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: ssrc1_value } ,
163+ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: ssrc2_value } ,
164+ % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: ssrc1_value } ,
165+ % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: ssrc2_value }
166+ ] == ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
162167 end
163168
164169 test "without codecs" do
@@ -174,12 +179,30 @@ defmodule ExWebRTC.RTPTransceiverTest do
174179
175180 mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
176181
177- assert [ % ExSDP.Attribute.MSID { id: @ stream_id , app_data: nil } ] =
182+ assert [ % ExSDP.Attribute.MSID { id: @ stream_id , app_data: @ track . id } ] = =
178183 ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
179184
180185 assert [ ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
181186 assert [ ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
182187 end
188+
189+ test "without track" do
190+ tr =
191+ RTPTransceiver . new ( :video , nil , @ config ,
192+ ssrc: @ ssrc ,
193+ rtx_ssrc: @ rtx_ssrc ,
194+ direction: :sendrecv
195+ )
196+
197+ mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
198+
199+ assert [ ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
200+
201+ assert [
202+ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: "- -" } ,
203+ % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: "- -" }
204+ ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
205+ end
183206 end
184207
185208 defp test_sender_attrs_present ( tr ) do
@@ -201,4 +224,6 @@ defmodule ExWebRTC.RTPTransceiverTest do
201224 assert [ ] == ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
202225 assert [ ] == ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
203226 end
227+
228+ defp ssrc_value ( stream , app_data ) , do: "#{ stream } #{ app_data } "
204229end
0 commit comments