Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c7d8a73
Add analyzer for the quality of peer connections
danxuliu Jun 22, 2020
860ed63
Take round trip time into account when calculating the quality
danxuliu Jul 7, 2020
4bc4da7
Trigger events when the quality changes
danxuliu Jun 22, 2020
c64b16b
Make possible to enable and disable the analysis of audio or video
danxuliu Jul 3, 2020
4a431f1
Guard against null screen peer
danxuliu Jul 2, 2020
efb653a
Move peer and screenPeer to attributes in CallParticipantModel
danxuliu Jul 3, 2020
74f59d7
Add peer and screenPeer attributes to LocalCallParticipantModel
danxuliu Jul 3, 2020
697cd88
Add analyzer for participants
danxuliu Jul 3, 2020
a93c32b
Add analyzer for calls
danxuliu Jul 3, 2020
111d700
Show warning when the quality of the connection is bad
danxuliu Jul 3, 2020
48ad037
Add a grace period before hiding the quality warning
danxuliu Jul 3, 2020
56f743f
Show tooltip only if the quality warning has not been recently shown
danxuliu Jul 3, 2020
2bf307f
Take video and screen quality into account in the quality warning
danxuliu Jul 6, 2020
fcfe74c
Move setting class attributes to its own method
danxuliu Jul 9, 2020
363ecb0
Dimm own avatar and video when the sender connection quality is bad
danxuliu Jul 9, 2020
92d7ea5
Split tooltips for audio, video and screen quality
danxuliu Jul 9, 2020
b92a161
Replace quality warning with tooltips on the local media buttons
danxuliu Jul 9, 2020
699a4a5
Increase grace period for quality tooltip
danxuliu Jul 9, 2020
3b78a93
Show warning on the button that could solve the issue
danxuliu Jul 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add peer and screenPeer attributes to LocalCallParticipantModel
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Jul 13, 2020
commit 74f59d71529c204adac0ce5969f7ddda14918528
2 changes: 1 addition & 1 deletion src/utils/webrtc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function setupWebRtc() {

const _signaling = signaling

webRtc = initWebRtc(_signaling, callParticipantCollection)
webRtc = initWebRtc(_signaling, callParticipantCollection, localCallParticipantModel)
localCallParticipantModel.setWebRtc(webRtc)
localMediaModel.setWebRtc(webRtc)

Expand Down
24 changes: 24 additions & 0 deletions src/utils/webrtc/models/LocalCallParticipantModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export default function LocalCallParticipantModel() {

this.attributes = {
peerId: null,
peer: null,
screenPeer: null,
guestName: null,
}

Expand All @@ -36,8 +38,14 @@ export default function LocalCallParticipantModel() {

LocalCallParticipantModel.prototype = {

get: function(key) {
return this.attributes[key]
},

set: function(key, value) {
this.attributes[key] = value

this._trigger('change:' + key, [value])
},

on: function(event, handler) {
Expand Down Expand Up @@ -94,6 +102,22 @@ LocalCallParticipantModel.prototype = {
this._unwatchDisplayNameChange = store.watch(state => state.actorStore.displayName, this.setGuestName.bind(this))
},

setPeer: function(peer) {
if (peer && this.get('peerId') !== peer.id) {
console.warn('Mismatch between stored peer ID and ID of given peer: ', this.get('peerId'), peer.id)
}

this.set('peer', peer)
},

setScreenPeer: function(screenPeer) {
if (screenPeer && this.get('peerId') !== screenPeer.id) {
console.warn('Mismatch between stored peer ID and ID of given screen peer: ', this.get('peerId'), screenPeer.id)
}

this.set('screenPeer', screenPeer)
},

setGuestName: function(guestName) {
if (!this._webRtc) {
throw new Error('WebRtc not initialized yet')
Expand Down
16 changes: 15 additions & 1 deletion src/utils/webrtc/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ let ownScreenPeer = null
let selfInCall = PARTICIPANT.CALL_FLAG.DISCONNECTED
const delayedConnectionToPeer = []
let callParticipantCollection = null
let localCallParticipantModel = null
let showedTURNWarning = false

function arrayDiff(a, b) {
Expand Down Expand Up @@ -72,6 +73,8 @@ function createScreensharingPeer(signaling, sessionId) {
})
webrtc.emit('createdPeer', ownScreenPeer)
ownScreenPeer.start()

localCallParticipantModel.setScreenPeer(ownScreenPeer)
}

if (sessionId === currentSessionId) {
Expand Down Expand Up @@ -134,6 +137,8 @@ function checkStartPublishOwnPeer(signaling) {
})
webrtc.emit('createdPeer', ownPeer)
ownPeer.start()

localCallParticipantModel.setPeer(ownPeer)
}

function userHasStreams(user) {
Expand Down Expand Up @@ -308,8 +313,9 @@ function usersInCallChanged(signaling, users) {
}
}

export default function initWebRTC(signaling, _callParticipantCollection) {
export default function initWebRTC(signaling, _callParticipantCollection, _localCallParticipantModel) {
callParticipantCollection = _callParticipantCollection
localCallParticipantModel = _localCallParticipantModel

signaling.on('usersLeft', function(users) {
users.forEach(function(user) {
Expand Down Expand Up @@ -733,6 +739,8 @@ export default function initWebRTC(signaling, _callParticipantCollection) {
webrtc.removePeers(ownPeer.id)
ownPeer.end()
ownPeer = null

localCallParticipantModel.setPeer(ownPeer)
}

usersChanged(signaling, [], previousUsersInRoom)
Expand Down Expand Up @@ -931,6 +939,8 @@ export default function initWebRTC(signaling, _callParticipantCollection) {
if (ownScreenPeer) {
ownScreenPeer = null

localCallParticipantModel.setScreenPeer(ownScreenPeer)

signaling.sendRoomMessage({
roomType: 'screen',
type: 'unshareScreen',
Expand All @@ -943,11 +953,15 @@ export default function initWebRTC(signaling, _callParticipantCollection) {
webrtc.removePeers(ownPeer.id)
ownPeer.end()
ownPeer = null

localCallParticipantModel.setPeer(ownPeer)
}

if (ownScreenPeer) {
ownScreenPeer.end()
ownScreenPeer = null

localCallParticipantModel.setScreenPeer(ownScreenPeer)
}

selfInCall = PARTICIPANT.CALL_FLAG.DISCONNECTED
Expand Down