Skip to content

Commit

Permalink
Fix senderReceiver array usage
Browse files Browse the repository at this point in the history
  • Loading branch information
soareschen committed Nov 20, 2018
1 parent 339c433 commit 1d0a0f3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
13 changes: 5 additions & 8 deletions webrtc/RTCDtlsTransport-getRemoteCertificates.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,12 @@
await doSignalingHandshake(pc1, pc2);

const dtlsTransports = [
pc1.getSenders().transport,
pc1.getReceivers().transport,
pc1.getSenders().rtcpTransport,
pc1.getReceivers().rtcpTransport,
pc2.getSenders().transport,
pc2.getReceivers().transport,
pc2.getSenders().rtcpTransport,
pc2.getReceivers().rtcpTransport,
...pc1.getSenders(),
...pc1.getReceivers(),
...pc2.getSenders(),
...pc2.getReceivers()
]
.map(senderReceiver => senderReceiver.transport)
.filter(dtlsTransport => dtlsTransport); // filter null/undefined

assert_greater_than(dtlsTransports.length, 2, 'expect to find at least 2 RTCDtlsTransports');
Expand Down
22 changes: 9 additions & 13 deletions webrtc/RTCIceTransport.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,12 @@
await doSignalingHandshake(pc1, pc2);

const iceTransports = [
pc1.getSenders().transport,
pc1.getReceivers().transport,
pc1.getSenders().rtcpTransport,
pc1.getReceivers().rtcpTransport,
pc2.getSenders().transport,
pc2.getReceivers().transport,
pc2.getSenders().rtcpTransport,
pc2.getReceivers().rtcpTransport,
...pc1.getSenders(),
...pc1.getReceivers(),
...pc2.getSenders(),
...pc2.getReceivers()
]
.map(senderReceiver => senderReceiver.transport)
.filter(dtlsTransport => dtlsTransport) // filter null/undefined
.map(dtlsTransport => dtlsTransport.iceTransport)
.filter(iceTransport => iceTransport); // filter null/undefined
Expand All @@ -155,12 +152,11 @@
const offer = await pc.createOffer();
await pc.setLocalDescription(offer);

const iceTransports = [
pc.getSenders().transport,
pc.getReceivers().transport,
pc.getSenders().rtcpTransport,
pc.getReceivers().rtcpTransport
const iceTransports =[
...pc.getSenders(),
...pc.getReceivers()
]
.map(senderReceiver => senderReceiver.transport)
.filter(dtlsTransport => dtlsTransport) // filter null/undefined
.map(dtlsTransport => dtlsTransport.iceTransport)
.filter(iceTransport => iceTransport); // filter null/undefined
Expand Down

0 comments on commit 1d0a0f3

Please sign in to comment.