File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -434,7 +434,11 @@ defmodule ExWebRTC.RTPTransceiver do
434434 mline = to_mline ( transceiver , opts )
435435 % ExSDP.Media { mline | port: 0 }
436436
437- transceiver . stopping == true or transceiver . stopped == true ->
437+ transceiver . stopping == true ->
438+ opts = Keyword . put ( opts , :direction , :inactive )
439+ to_mline ( transceiver , opts )
440+
441+ transceiver . stopped == true ->
438442 opts = Keyword . put ( opts , :direction , :inactive )
439443 mline = to_mline ( transceiver , opts )
440444 % ExSDP.Media { mline | port: 0 }
Original file line number Diff line number Diff line change @@ -651,6 +651,32 @@ defmodule ExWebRTC.PeerConnectionTest do
651651 assert sdp . media == [ ]
652652 end
653653
654+ test "after remote offer" do
655+ { :ok , pc1 } = PeerConnection . start_link ( )
656+ { :ok , pc2 } = PeerConnection . start_link ( )
657+
658+ PeerConnection . add_transceiver ( pc1 , :video )
659+ { :ok , offer } = PeerConnection . create_offer ( pc1 )
660+ :ok = PeerConnection . set_local_description ( pc1 , offer )
661+
662+ :ok = PeerConnection . set_remote_description ( pc2 , offer )
663+ [ tr ] = PeerConnection . get_transceivers ( pc2 )
664+ :ok = PeerConnection . stop_transceiver ( pc2 , tr . id )
665+ assert [
666+ % RTPTransceiver {
667+ current_direction: nil ,
668+ direction: :inactive ,
669+ stopping: true ,
670+ stopped: false
671+ }
672+ ] = PeerConnection . get_transceivers ( pc2 )
673+
674+ { :ok , answer } = PeerConnection . create_answer ( pc2 )
675+ [ video ] = ExSDP . parse! ( answer . sdp ) . media
676+
677+ assert video . port == 9
678+ end
679+
654680 test "with renegotiation" do
655681 { :ok , pc1 } = PeerConnection . start_link ( )
656682 { :ok , pc2 } = PeerConnection . start_link ( )
You can’t perform that action at this time.
0 commit comments