Skip to content
Merged
Prev Previous commit
Next Next commit
Fix stats being reset when enabling the analysis twice
The stats were reset whenever "setAnalysisEnabledXXX(true)" was called.
Due to this, if the analysis for audio or video was already enabled and
the method was called again the stats were wrongly reset. The stats
should be reset only when the analysis is really started again.

Signed-off-by: Daniel Calviño Sánchez <[email protected]>
  • Loading branch information
danxuliu committed Jul 2, 2021
commit f8f40a615fa4a3bdd0386bab6f2d94529e75852f
8 changes: 8 additions & 0 deletions src/utils/webrtc/analyzers/PeerConnectionAnalyzer.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ PeerConnectionAnalyzer.prototype = {
},

setAnalysisEnabledAudio: function(analysisEnabledAudio) {
if (this._analysisEnabled['audio'] === analysisEnabledAudio) {
return
}

this._analysisEnabled['audio'] = analysisEnabledAudio

if (!analysisEnabledAudio) {
Expand All @@ -213,6 +217,10 @@ PeerConnectionAnalyzer.prototype = {
},

setAnalysisEnabledVideo: function(analysisEnabledVideo) {
if (this._analysisEnabled['video'] === analysisEnabledVideo) {
return
}

this._analysisEnabled['video'] = analysisEnabledVideo

if (!analysisEnabledVideo) {
Expand Down