|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 |
| -// Last time updated: 2018-12-10 7:33:37 AM UTC |
| 3 | +// Last time updated: 2018-12-10 9:49:44 AM UTC |
4 | 4 |
|
5 | 5 | // _______________
|
6 | 6 | // getStats v1.0.10
|
@@ -144,7 +144,7 @@ window.getStats = function(mediaStreamTrack, callback, interval) {
|
144 | 144 | * @param {*} userFiled - default paramName
|
145 | 145 | * @returns {NULL}
|
146 | 146 | */
|
147 |
| - function creatVideoCounter(paramName, type, op, scale, userFiled) { |
| 147 | + function creatVideoCounter(result, paramName, type, op, scale, userFiled) { |
148 | 148 | // 当参数合并后,根据 googNacksSent 来判断recv/send Kb Mb Gb
|
149 | 149 | if (!!result[paramName] && result[paramName] !== '0') {
|
150 | 150 | var Count = 0;
|
@@ -681,27 +681,27 @@ window.getStats = function(mediaStreamTrack, callback, interval) {
|
681 | 681 | if (SSRC[result.mediaType][sendrecvType].indexOf(result.ssrc) === -1) {
|
682 | 682 | SSRC[result.mediaType][sendrecvType].push(result.ssrc)
|
683 | 683 | }
|
684 |
| - creatVideoCounter('googNacksSent', 'send'); |
685 |
| - creatVideoCounter('googPlisSent', 'send'); |
686 |
| - creatVideoCounter('googFirsSent', 'send'); |
687 |
| - creatVideoCounter('googNacksReceived', 'recv'); |
688 |
| - creatVideoCounter('googPlisReceived', 'recv'); |
689 |
| - creatVideoCounter('googFirsReceived', 'recv'); |
| 684 | + creatVideoCounter(result, 'googNacksSent', 'send'); |
| 685 | + creatVideoCounter(result, 'googPlisSent', 'send'); |
| 686 | + creatVideoCounter(result, 'googFirsSent', 'send'); |
| 687 | + creatVideoCounter(result, 'googNacksReceived', 'recv'); |
| 688 | + creatVideoCounter(result, 'googPlisReceived', 'recv'); |
| 689 | + creatVideoCounter(result, 'googFirsReceived', 'recv'); |
690 | 690 | getStatsResult[result.mediaType][sendrecvType].streams = SSRC[result.mediaType][sendrecvType].length;
|
691 | 691 | };
|
692 | 692 |
|
693 | 693 | getStatsParser.boundRtp = function(result) {
|
694 | 694 |
|
695 | 695 | if (result.type == 'inbound-rtp') {
|
696 |
| - creatVideoCounter('nackCount', 'recv', '+', 1, 'googNacksReceived'); |
697 |
| - creatVideoCounter('pliCount', 'recv', '+', 1, 'googPlisReceived'); |
698 |
| - creatVideoCounter('firCount', 'recv', '+', 1, 'googFirsReceived'); |
| 696 | + creatVideoCounter(result, 'nackCount', 'recv', '+', 1, 'googNacksReceived'); |
| 697 | + creatVideoCounter(result, 'pliCount', 'recv', '+', 1, 'googPlisReceived'); |
| 698 | + creatVideoCounter(result, 'firCount', 'recv', '+', 1, 'googFirsReceived'); |
699 | 699 | }
|
700 | 700 |
|
701 | 701 | if (result.type == 'outbound-rtp') {
|
702 |
| - creatVideoCounter('nackCount', 'send', '+', 1, 'googNacksSent'); |
703 |
| - creatVideoCounter('pliCount', 'send', '+', 1, 'googPlisSent'); |
704 |
| - creatVideoCounter('firCount', 'send', '+', 1, 'googFirsSent'); |
| 702 | + creatVideoCounter(result, 'nackCount', 'send', '+', 1, 'googNacksSent'); |
| 703 | + creatVideoCounter(result, 'pliCount', 'send', '+', 1, 'googPlisSent'); |
| 704 | + creatVideoCounter(result, 'firCount', 'send', '+', 1, 'googFirsSent'); |
705 | 705 | }
|
706 | 706 | }
|
707 | 707 |
|
|
0 commit comments