damencho 10 лет назад
Родитель
Сommit
09d08b034c
2 измененных файлов: 1 добавлений и 87 удалений
  1. 1
    67
      modules/statistics/RTPStatsCollector.js
  2. 0
    20
      modules/statistics/statistics.js

+ 1
- 67
modules/statistics/RTPStatsCollector.js Просмотреть файл

@@ -146,7 +146,6 @@ function StatsCollector(peerconnection, audioLevelsInterval, statsInterval, even
146 146
 {
147 147
     this.peerconnection = peerconnection;
148 148
     this.baselineAudioLevelsReport = null;
149
-    this.currentAudioLevelsReport = null;
150 149
     this.currentStatsReport = null;
151 150
     this.baselineStatsReport = null;
152 151
     this.audioLevelsIntervalId = null;
@@ -252,10 +251,7 @@ StatsCollector.prototype.start = function ()
252 251
                             results = report.result();
253 252
                         }
254 253
                         //console.error("Got interval report", results);
255
-                        self.currentAudioLevelsReport = results;
256
-                        self.processAudioLevelReport();
257
-                        self.baselineAudioLevelsReport =
258
-                            self.currentAudioLevelsReport;
254
+                        self.baselineAudioLevelsReport = results;
259 255
                     },
260 256
                     self.errorCallback
261 257
                 );
@@ -666,65 +662,3 @@ StatsCollector.prototype.processStatsReport = function () {
666 662
     PeerStats.transport = [];
667 663
 
668 664
 };
669
-
670
-/**
671
- * Stats processing logic.
672
- */
673
-StatsCollector.prototype.processAudioLevelReport = function () {
674
-    if (!this.baselineAudioLevelsReport) {
675
-        return;
676
-    }
677
-
678
-    for (var idx in this.currentAudioLevelsReport) {
679
-        var now = this.currentAudioLevelsReport[idx];
680
-
681
-        if (now.type != 'ssrc') {
682
-            continue;
683
-        }
684
-
685
-        var before = this.baselineAudioLevelsReport[idx];
686
-        if (!before) {
687
-            console.warn(getStatValue(now, 'ssrc') + ' not enough data');
688
-            continue;
689
-        }
690
-
691
-        var ssrc = getStatValue(now, 'ssrc');
692
-        var jid = APP.conference._room.room.getJidBySSRC(ssrc);
693
-        if (!jid) {
694
-            if((Date.now() - now.timestamp) < 3000)
695
-                console.warn("No jid for ssrc: " + ssrc);
696
-            continue;
697
-        }
698
-
699
-        var jidStats = this.jid2stats[jid];
700
-        if (!jidStats) {
701
-            jidStats = new PeerStats();
702
-            this.jid2stats[jid] = jidStats;
703
-        }
704
-
705
-        // Audio level
706
-        var audioLevel = null;
707
-
708
-        try {
709
-            audioLevel = getStatValue(now, 'audioInputLevel');
710
-            if (!audioLevel)
711
-                audioLevel = getStatValue(now, 'audioOutputLevel');
712
-        }
713
-        catch(e) {/*not supported*/
714
-            console.warn("Audio Levels are not available in the statistics.");
715
-            clearInterval(this.audioLevelsIntervalId);
716
-            return;
717
-        }
718
-
719
-        if (audioLevel) {
720
-            // TODO: can't find specs about what this value really is,
721
-            // but it seems to vary between 0 and around 32k.
722
-            audioLevel = audioLevel / 32767;
723
-            jidStats.setSsrcAudioLevel(ssrc, audioLevel);
724
-            if (jid != APP.conference._room.room.myroomjid) {
725
-                this.eventEmitter.emit(
726
-                    StatisticsEvents.AUDIO_LEVEL, jid, audioLevel);
727
-            }
728
-        }
729
-    }
730
-};

+ 0
- 20
modules/statistics/statistics.js Просмотреть файл

@@ -113,25 +113,5 @@ export default {
113 113
                 CallStats.sendAddIceCandidateFailed(e, pc);
114 114
             }
115 115
         );
116
-    },
117
-    /**
118
-     * FIXME:
119
-     * Currently used by torture. If we are removing this, torture needs to
120
-     * be fixed also.
121
-     *
122
-     * Obtains audio level reported in the stats for specified peer.
123
-     * @param peerJid full MUC jid of the user for whom we want to obtain last
124
-     *        audio level.
125
-     * @param ssrc the SSRC of audio stream for which we want to obtain audio
126
-     *        level.
127
-     * @returns {*} a float form 0 to 1 that represents current audio level or
128
-     *              <tt>null</tt> if for any reason the value is not available
129
-     *              at this time.
130
-     */
131
-    getPeerSSRCAudioLevel: function (peerJid, ssrc) {
132
-
133
-        var peerStats = rtpStats.jid2stats[peerJid];
134
-
135
-        return peerStats ? peerStats.ssrc2AudioLevel[ssrc] : null;
136 116
     }
137 117
 };

Загрузка…
Отмена
Сохранить