@@ -238,7 +238,8 @@ defmodule ExWebRTC.PeerConnectionTest do
238
238
describe "get_local_description/1" do
239
239
test "includes ICE candidates" do
240
240
{ :ok , pc } = PeerConnection . start ( )
241
- { :ok , _sender } = PeerConnection . add_transceiver ( pc , :audio )
241
+ { :ok , _tr } = PeerConnection . add_transceiver ( pc , :audio )
242
+ { :ok , _tr } = PeerConnection . add_transceiver ( pc , :video )
242
243
{ :ok , offer } = PeerConnection . create_offer ( pc )
243
244
:ok = PeerConnection . set_local_description ( pc , offer )
244
245
@@ -247,12 +248,13 @@ defmodule ExWebRTC.PeerConnectionTest do
247
248
248
249
assert desc != nil
249
250
250
- desc_cands =
251
- desc . sdp
252
- |> String . split ( "\r \n " )
253
- |> Enum . filter ( & String . starts_with? ( & 1 , "a=candidate:" ) )
251
+ sdp = ExSDP . parse! ( desc . sdp )
252
+ [ audio_mline , video_mline ] = sdp . media
253
+ "candidate:" <> candidate = cand . candidate
254
254
255
- assert ( "a=" <> cand . candidate ) in desc_cands
255
+ assert { "candidate" , candidate } in ExSDP . get_attributes ( audio_mline , "candidate" )
256
+ # candidates should only be present in the first m-line
257
+ assert [ ] == ExSDP . get_attributes ( video_mline , "candidate" )
256
258
end
257
259
end
258
260
0 commit comments