Skip to content

Commit 425f5c6

Browse files
hpcnt-lenSean-Der
authored andcommitted
Handle implicitly created inactive transceiver
If SetRemoteDescription is called with offer SDP which has a=invalid, PeerConnection sets its transceiver direction as recvonly. Fix direction recvonly to invalid. Resolves #2050
1 parent 8c31eb9 commit 425f5c6

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

peerconnection.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1059,6 +1059,8 @@ func (pc *PeerConnection) SetRemoteDescription(desc SessionDescription) error {
10591059
localDirection := RTPTransceiverDirectionRecvonly
10601060
if direction == RTPTransceiverDirectionRecvonly {
10611061
localDirection = RTPTransceiverDirectionSendonly
1062+
} else if direction == RTPTransceiverDirectionInactive {
1063+
localDirection = RTPTransceiverDirectionInactive
10621064
}
10631065

10641066
t = newRTPTransceiver(receiver, nil, localDirection, kind, pc.api)

peerconnection_go_test.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1583,3 +1583,31 @@ a=` + sslTCPCandidate + "\n"
15831583

15841584
assert.NoError(t, peerConnection.Close())
15851585
}
1586+
1587+
func TestOfferWithInactiveDirection(t *testing.T) {
1588+
const remoteSDP = `v=0
1589+
o=- 4596489990601351948 2 IN IP4 127.0.0.1
1590+
s=-
1591+
t=0 0
1592+
a=fingerprint:sha-256 F7:BF:B4:42:5B:44:C0:B9:49:70:6D:26:D7:3E:E6:08:B1:5B:25:2E:32:88:50:B6:3C:BE:4E:18:A7:2C:85:7C
1593+
a=group:BUNDLE 0 1
1594+
a=msid-semantic:WMS *
1595+
m=video 9 UDP/TLS/RTP/SAVPF 97
1596+
c=IN IP4 0.0.0.0
1597+
a=inactive
1598+
a=ice-pwd:05d682b2902af03db90d9a9a5f2f8d7f
1599+
a=ice-ufrag:93cc7e4d
1600+
a=mid:0
1601+
a=rtpmap:97 H264/90000
1602+
a=setup:actpass
1603+
a=ssrc:1455629982 cname:{61fd3093-0326-4b12-8258-86bdc1fe677a}
1604+
`
1605+
1606+
peerConnection, err := NewPeerConnection(Configuration{})
1607+
assert.NoError(t, err)
1608+
1609+
assert.NoError(t, peerConnection.SetRemoteDescription(SessionDescription{Type: SDPTypeOffer, SDP: remoteSDP}))
1610+
assert.Equal(t, RTPTransceiverDirectionInactive, peerConnection.rtpTransceivers[0].direction.Load().(RTPTransceiverDirection))
1611+
1612+
assert.NoError(t, peerConnection.Close())
1613+
}

0 commit comments

Comments
 (0)