Skip to content
Merged
Prev Previous commit
Next Next commit
Get attributes based on kind instead of explictly pass them
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Jul 2, 2021
commit 1352f12ceb6bdf74994eaffcb87d07b631574762
10 changes: 7 additions & 3 deletions src/utils/webrtc/analyzers/PeerConnectionAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,14 +524,18 @@ PeerConnectionAnalyzer.prototype = {
},

_calculateConnectionQualityAudio: function() {
return this._calculateConnectionQuality(this._packetsLostRatio['audio'], this._packetsPerSecond['audio'], this._roundTripTime['audio'], 'audio')
return this._calculateConnectionQuality('audio')
},

_calculateConnectionQualityVideo: function() {
return this._calculateConnectionQuality(this._packetsLostRatio['video'], this._packetsPerSecond['video'], this._roundTripTime['video'], 'video')
return this._calculateConnectionQuality('video')
},

_calculateConnectionQuality: function(packetsLostRatio, packetsPerSecond, roundTripTime, kind) {
_calculateConnectionQuality: function(kind) {
const packetsLostRatio = this._packetsLostRatio[kind]
const packetsPerSecond = this._packetsPerSecond[kind]
const roundTripTime = this._roundTripTime[kind]

if (!packetsLostRatio.hasEnoughData() || !packetsPerSecond.hasEnoughData()) {
return CONNECTION_QUALITY.UNKNOWN
}
Expand Down