Skip to content

Commit

Permalink
Add a test case for the Janus issue
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeTurki committed Jan 4, 2025
1 parent 30bfffa commit 7dd5928
Showing 1 changed file with 100 additions and 0 deletions.
100 changes: 100 additions & 0 deletions peerconnection_go_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1665,3 +1665,103 @@ func TestPeerConnectionNoNULLCipherDefault(t *testing.T) {
<-peerConnectionClosed
closePairNow(t, offerPC, answerPC)
}

// https://github.com/pion/webrtc/issues/2690
func TestPeerConnectionTrickleMediaStreamIdentification(t *testing.T) {
const remoteSdp = `v=0
o=- 1735985477255306 1 IN IP4 127.0.0.1
s=VideoRoom 1234
t=0 0
a=group:BUNDLE 0 1
a=ice-options:trickle
a=fingerprint:sha-256 61:BF:17:29:C0:EF:B2:77:75:79:64:F9:D8:D0:03:6C:5A:D3:9A:BC:E5:F4:5A:05:4C:3C:3B:A0:B4:2B:CF:A8
a=extmap-allow-mixed
a=msid-semantic: WMS *
m=audio 9 UDP/TLS/RTP/SAVPF 111
c=IN IP4 127.0.0.1
a=sendonly
a=mid:0
a=rtcp-mux
a=ice-ufrag:xv3r
a=ice-pwd:NT22yM6JeOsahq00U9ZJS/
a=ice-options:trickle
a=setup:actpass
a=rtpmap:111 opus/48000/2
a=rtcp-fb:111 transport-cc
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=fmtp:111 useinbandfec=1
a=msid:janus janus0
a=ssrc:2280306597 cname:janus
m=video 9 UDP/TLS/RTP/SAVPF 96 97
c=IN IP4 127.0.0.1
a=sendonly
a=mid:1
a=rtcp-mux
a=ice-ufrag:xv3r
a=ice-pwd:NT22yM6JeOsahq00U9ZJS/
a=ice-options:trickle
a=setup:actpass
a=rtpmap:96 VP8/90000
a=rtcp-fb:96 ccm fir
a=rtcp-fb:96 nack
a=rtcp-fb:96 nack pli
a=rtcp-fb:96 goog-remb
a=rtcp-fb:96 transport-cc
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
a=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid
a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
a=extmap:13 urn:3gpp:video-orientation
a=rtpmap:97 rtx/90000
a=fmtp:97 apt=96
a=ssrc-group:FID 4099488402 29586368
a=msid:janus janus1
a=ssrc:4099488402 cname:janus
a=ssrc:29586368 cname:janus
`

mediaEngine := &MediaEngine{}

assert.NoError(t, mediaEngine.RegisterCodec(RTPCodecParameters{
RTPCodecCapability: RTPCodecCapability{MimeType: MimeTypeVP8, ClockRate: 90000, Channels: 0, SDPFmtpLine: "", RTCPFeedback: nil},
PayloadType: 96,
}, RTPCodecTypeVideo))
assert.NoError(t, mediaEngine.RegisterCodec(RTPCodecParameters{
RTPCodecCapability: RTPCodecCapability{MimeType: MimeTypeOpus, ClockRate: 48000, Channels: 0, SDPFmtpLine: "", RTCPFeedback: nil},
PayloadType: 111,
}, RTPCodecTypeAudio))

api := NewAPI(WithMediaEngine(mediaEngine))
pc, err := api.NewPeerConnection(Configuration{
ICEServers: []ICEServer{
{
URLs: []string{"stun:stun.l.google.com:19302"},
},
},
})
assert.NoError(t, err)

pc.OnICECandidate(func(candidate *ICECandidate) {
if candidate == nil {
return
}

// 0 or 1 mid assert that
// ice candidates have the correct mid and mLineIndex
assert.NotEmpty(t, candidate.SDPMid)
})

assert.NoError(t, pc.SetRemoteDescription(SessionDescription{
Type: SDPTypeOffer,
SDP: remoteSdp,
}))

gatherComplete := GatheringCompletePromise(pc)
ans, _ := pc.CreateAnswer(nil)
assert.NoError(t, pc.SetLocalDescription(ans))

<-gatherComplete
}

0 comments on commit 7dd5928

Please sign in to comment.