Skip to content

Commit

Permalink
Merge pull request #7511 from nextcloud/adjust-logs-during-calls
Browse files Browse the repository at this point in the history
Adjust logs during calls
  • Loading branch information
nickvergessen authored Jul 5, 2022
2 parents a6782f2 + b8df345 commit d9b7a3f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
3 changes: 1 addition & 2 deletions src/utils/webrtc/simplewebrtc/peer.js
Original file line number Diff line number Diff line change
Expand Up @@ -510,11 +510,10 @@ Peer.prototype.handleAnswer = function(answer) {

Peer.prototype.selectSimulcastStream = function(substream, temporal) {
if (this.substream === substream && this.temporal === temporal) {
console.debug('Simulcast stream not changed', this, substream, temporal)
return
}

console.debug('Changing simulcast stream', this, substream, temporal)
console.debug('Changing simulcast stream', this.id, this, substream, temporal)
this.send('selectStream', {
substream,
temporal,
Expand Down
50 changes: 25 additions & 25 deletions src/utils/webrtc/webrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ function checkStartPublishOwnPeer(signaling) {
}

if (currentSessionId !== signaling.getSessionId()) {
console.debug('No answer received for own peer but current session id changed, not sending offer again')
console.debug('No answer received for own peer but current session id changed, not sending offer again', currentSessionId, signaling.getSessionId())

clearInterval(delayedConnectionToPeer[currentSessionId])
delete delayedConnectionToPeer[currentSessionId]

return
}

console.debug('No answer received for own peer, sending offer again')
console.debug('No answer received for own peer, sending offer again', currentSessionId)
createPeer()
}, 10000)
}
Expand Down Expand Up @@ -372,15 +372,15 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) {
clearInterval(delayedConnectionToPeer[user.sessionId])

delayedConnectionToPeer[user.sessionId] = setInterval(function() {
console.debug('No offer received for new peer, request offer again')
console.debug('No offer received for new peer, request offer again', sessionId)

signaling.requestOffer(user, 'video')
}, 10000)
} else if (!useMcu && userHasStreams(selfInCall) && (!userHasStreams(user) || sessionId < currentSessionId)) {
// To avoid overloading the user joining a room (who previously called
// all the other participants), we decide who calls who by comparing
// the session ids of the users: "larger" ids call "smaller" ones.
console.debug('Starting call with', user)
console.debug('Starting call with', user, sessionId)
createPeer()
} else if (!useMcu && userHasStreams(selfInCall) && userHasStreams(user) && sessionId > currentSessionId) {
// If the remote peer is not aware that it was disconnected
Expand All @@ -398,11 +398,11 @@ function usersChanged(signaling, newUsers, disconnectedSessionIds) {
peer.end()
})

console.debug('No offer nor answer received, sending offer again')
console.debug('No offer nor answer received, sending offer again', sessionId)
createPeer()
}, 10000)
} else {
console.debug('User has no streams, not sending another offer')
console.debug('User has no streams, not sending another offer', sessionId)
}
}

Expand Down Expand Up @@ -748,7 +748,7 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local
if (peer.pc.localDescription.type === 'offer'
&& peer.pc.signalingState === 'stable') {
spreedPeerConnectionTable[peer.id]++
console.debug('ICE restart after disconnect.', peer)
console.debug('ICE restart after disconnect.', peer.id, peer)
peer.icerestart()
}
}
Expand Down Expand Up @@ -778,25 +778,25 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local
if (peer.pc.localDescription.type === 'offer'
&& peer.pc.signalingState === 'stable') {
spreedPeerConnectionTable[peer.id]++
console.debug('ICE restart after failure.', peer)
console.debug('ICE restart after failure.', peer.id, peer)
peer.icerestart()
}
} else {
console.error('ICE failed after 5 tries.', peer)
console.error('ICE failed after 5 tries.', peer.id, peer)

peer.emit('extendedIceConnectionStateChange', 'failed-no-restart')
}
} else {
// This handles ICE failures of a receiver peer; ICE failures of
// the sender peer are handled in the "iceFailed" event.
console.debug('Request offer again', peer)
console.debug('Request offer again', peer.id, peer)

signaling.requestOffer(peer.id, 'video')

clearInterval(delayedConnectionToPeer[peer.id])

delayedConnectionToPeer[peer.id] = setInterval(function() {
console.debug('No offer received, request offer again', peer)
console.debug('No offer received, request offer again', peer.id, peer)

signaling.requestOffer(peer.id, 'video')
}, 10000)
Expand All @@ -815,27 +815,27 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local

switch (peer.pc.iceConnectionState) {
case 'checking':
console.debug('Connecting to peer...', peer)
console.debug('Connecting to peer...', peer.id, peer)

break
case 'connected':
case 'completed': // on caller side
console.debug('Connection established.', peer)
console.debug('Connection established.', peer.id, peer)

handleIceConnectionStateConnected(peer)
break
case 'disconnected':
console.debug('Disconnected.', peer)
console.debug('Disconnected.', peer.id, peer)

handleIceConnectionStateDisconnected(peer)
break
case 'failed':
console.debug('Connection failed.', peer)
console.debug('Connection failed.', peer.id, peer)

handleIceConnectionStateFailed(peer)
break
case 'closed':
console.debug('Connection closed.', peer)
console.debug('Connection closed.', peer.id, peer)

break
}
Expand Down Expand Up @@ -884,16 +884,16 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local

switch (peer.pc.iceConnectionState) {
case 'checking':
console.debug('Connecting own peer...', peer)
console.debug('Connecting own peer...', peer.id, peer)

break
case 'connected':
case 'completed':
console.debug('Connection established (own peer).', peer)
console.debug('Connection established (own peer).', peer.id, peer)

break
case 'disconnected':
console.debug('Disconnected (own peer).', peer)
console.debug('Disconnected (own peer).', peer.id, peer)

setTimeout(function() {
if (peer.pc.iceConnectionState !== 'disconnected') {
Expand All @@ -904,11 +904,11 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local
}, 5000)
break
case 'failed':
console.debug('Connection failed (own peer).', peer)
console.debug('Connection failed (own peer).', peer.id, peer)

break
case 'closed':
console.debug('Connection closed (own peer).', peer)
console.debug('Connection closed (own peer).', peer.id, peer)

break
}
Expand Down Expand Up @@ -967,7 +967,7 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local
clearInterval(delayedConnectionToPeer[peer.id])

delayedConnectionToPeer[peer.id] = setInterval(function() {
console.debug('No offer received, request offer again' + update ? '(update)' : '', peer)
console.debug('No offer received, request offer again' + update ? '(update)' : '', peer.id, peer)

signaling.requestOffer(peer.id, 'video', update ? peer.sid : undefined)
}, 10000)
Expand Down Expand Up @@ -1159,7 +1159,7 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local
})

webrtc.on('createdPeer', function(peer) {
console.debug('Peer created', peer)
console.debug('Peer created', peer.id, peer)

if (peer.id !== signaling.getSessionId() && !peer.sharemyscreen) {
// In some strange cases a Peer can be added before its
Expand Down Expand Up @@ -1575,10 +1575,10 @@ export default function initWebRtc(signaling, _callParticipantCollection, _local
} else if (data.type === 'speaking' || data.type === 'stoppedSpeaking') {
// Valid known messages, but handled elsewhere
} else {
console.debug('Unknown message type %s from %s datachannel', data.type, label, data)
console.debug('Unknown message type %s from %s datachannel', data.type, label, data, peer.id, peer)
}
} else {
console.debug('Unknown message from %s datachannel', label, data)
console.debug('Unknown message from %s datachannel', label, data, peer.id, peer)
}
})

Expand Down

0 comments on commit d9b7a3f

Please sign in to comment.