瀏覽代碼

fix(stats) fix parsing codec in new stats

dev1
Saúl Ibarra Corretgé 4 年之前
父節點
當前提交
310983c5b0
共有 1 個檔案被更改,包括 10 行新增8 行删除
  1. 10
    8
      modules/statistics/RTPStatsCollector.js

+ 10
- 8
modules/statistics/RTPStatsCollector.js 查看文件

@@ -1243,14 +1243,16 @@ StatsCollector.prototype.processNewStatsReport = function() {
1243 1243
                 codec = this.currentStatsReport.get(now.codecId);
1244 1244
             } catch (e) { /* not supported*/ }
1245 1245
 
1246
-            /*
1247
-               The mime type has the following form: video/VP8 or audio/ISAC,
1248
-               so we what to keep just the type after the '/', audio and video
1249
-               keys will be added on the processing side.
1250
-            */
1251
-            const codecShortType = codec.mimeType.split('/')[1];
1252
-
1253
-            ssrcStats.setCodec(codecShortType);
1246
+            if (codec) {
1247
+                /**
1248
+                 * The mime type has the following form: video/VP8 or audio/ISAC,
1249
+                 * so we what to keep just the type after the '/', audio and video
1250
+                 * keys will be added on the processing side.
1251
+                 */
1252
+                const codecShortType = codec.mimeType.split('/')[1];
1253
+
1254
+                codecShortType && ssrcStats.setCodec(codecShortType);
1255
+            }
1254 1256
 
1255 1257
         // track for resolution
1256 1258
         // RTCVideoHandlerStats

Loading…
取消
儲存