@@ -74,13 +74,14 @@ defmodule ExWebRTC.RTPTransceiverTest do
74
74
)
75
75
76
76
mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
77
+ ssrc_value = ssrc_msid_value ( @ stream_id , @ track . id )
77
78
78
79
assert [ % ExSDP.Attribute.MSID { id: @ stream_id } ] =
79
80
ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
80
81
81
82
assert [ ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
82
83
83
- assert [ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: @ stream_id } ] =
84
+ assert [ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: ^ ssrc_value } ] =
84
85
ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
85
86
end
86
87
@@ -93,16 +94,17 @@ defmodule ExWebRTC.RTPTransceiverTest do
93
94
)
94
95
95
96
mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
97
+ ssrc_value = ssrc_msid_value ( @ stream_id , @ track . id )
96
98
97
- assert [ % ExSDP.Attribute.MSID { id: @ stream_id , app_data: nil } ] =
99
+ assert [ % ExSDP.Attribute.MSID { id: @ stream_id , app_data: @ track . id } ] = =
98
100
ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
99
101
100
102
assert [ % ExSDP.Attribute.SSRCGroup { semantics: "FID" , ssrcs: [ @ ssrc , @ rtx_ssrc ] } ] =
101
103
ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
102
104
103
105
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 }
106
108
] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
107
109
end
108
110
@@ -118,16 +120,16 @@ defmodule ExWebRTC.RTPTransceiverTest do
118
120
119
121
mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
120
122
121
- assert [ % ExSDP.Attribute.MSID { id: "-" , app_data: nil } ] =
123
+ assert [ % ExSDP.Attribute.MSID { id: "-" , app_data: track . id } ] = =
122
124
ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
123
125
124
126
assert [ % ExSDP.Attribute.SSRCGroup { semantics: "FID" , ssrcs: [ @ ssrc , @ rtx_ssrc ] } ] =
125
127
ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
126
128
127
129
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 )
131
133
end
132
134
133
135
test "with multiple media streams" do
@@ -145,20 +147,23 @@ defmodule ExWebRTC.RTPTransceiverTest do
145
147
146
148
mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
147
149
150
+ ssrc1_value = ssrc_msid_value ( s1_id , track . id )
151
+ ssrc2_value = ssrc_msid_value ( s2_id , track . id )
152
+
148
153
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 )
152
157
153
158
assert [ % ExSDP.Attribute.SSRCGroup { semantics: "FID" , ssrcs: [ @ ssrc , @ rtx_ssrc ] } ] =
154
159
ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
155
160
156
161
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 )
162
167
end
163
168
164
169
test "without codecs" do
@@ -174,12 +179,31 @@ defmodule ExWebRTC.RTPTransceiverTest do
174
179
175
180
mline = RTPTransceiver . to_offer_mline ( tr , @ opts )
176
181
177
- assert [ % ExSDP.Attribute.MSID { id: @ stream_id , app_data: nil } ] =
182
+ assert [ % ExSDP.Attribute.MSID { id: @ stream_id , app_data: @ track . id } ] = =
178
183
ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
179
184
180
185
assert [ ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
181
186
assert [ ] = ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
182
187
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.Attribute.MSID { id: "-" , app_data: tr . sender . id } ] ==
200
+ ExSDP . get_attributes ( mline , ExSDP.Attribute.MSID )
201
+
202
+ assert [
203
+ % ExSDP.Attribute.SSRC { id: @ ssrc , attribute: "msid" , value: "- #{ tr . sender . id } " } ,
204
+ % ExSDP.Attribute.SSRC { id: @ rtx_ssrc , attribute: "msid" , value: "- #{ tr . sender . id } " }
205
+ ] == ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
206
+ end
183
207
end
184
208
185
209
defp test_sender_attrs_present ( tr ) do
@@ -201,4 +225,6 @@ defmodule ExWebRTC.RTPTransceiverTest do
201
225
assert [ ] == ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRCGroup )
202
226
assert [ ] == ExSDP . get_attributes ( mline , ExSDP.Attribute.SSRC )
203
227
end
228
+
229
+ defp ssrc_msid_value ( stream , app_data ) , do: "#{ stream } #{ app_data } "
204
230
end
0 commit comments