in release/connect-rtc.js [9721:9814]
impl = function () {
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(stream, streamType) {
var tracks;
return _regenerator2.default.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
tracks = [];
if (stream) {
_context2.next = 3;
break;
}
return _context2.abrupt('return', []);
case 3:
_context2.t0 = streamType;
_context2.next = _context2.t0 === 'audio_input' ? 6 : _context2.t0 === 'audio_output' ? 6 : _context2.t0 === 'video_input' ? 8 : _context2.t0 === 'video_output' ? 8 : 10;
break;
case 6:
tracks = stream.getAudioTracks();
return _context2.abrupt('break', 11);
case 8:
tracks = stream.getVideoTracks();
return _context2.abrupt('break', 11);
case 10:
throw new Error('Unsupported stream type while trying to get stats: ' + streamType);
case 11:
_context2.next = 13;
return Promise.all(tracks.map(function () {
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(track) {
var self;
return _regenerator2.default.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
if (!_this11._legacyStatsReportSupport) {
_context.next = 5;
break;
}
self = _this11;
return _context.abrupt('return', new Promise(function (resolve) {
self._pc.getStats(function (rawStats) {
var digestedStats = (0, _rtpStats.extractMediaStatsFromStats)(timestamp, rawStats.result(), streamType);
if (!digestedStats) {
throw new Error('Failed to extract MediaRtpStats from RTCStatsReport for stream type ' + streamType);
}
resolve(digestedStats);
}, track);
}));
case 5:
return _context.abrupt('return', _this11._pc.getStats().then(function (rawStats) {
var digestedStats = (0, _rtpStats.extractMediaStatsFromStats)(timestamp, rawStats, streamType);
if (!digestedStats) {
throw new Error('Failed to extract MediaRtpStats from RTCStatsReport for stream type ' + streamType);
}
return digestedStats;
}));
case 6:
case 'end':
return _context.stop();
}
}
}, _callee, _this11);
}));
return function (_x3) {
return _ref3.apply(this, arguments);
};
}()));
case 13:
return _context2.abrupt('return', _context2.sent);
case 14:
case 'end':
return _context2.stop();
}
}
}, _callee2, _this11);
}));
return function impl(_x, _x2) {
return _ref2.apply(this, arguments);
};
}();