@rongcloud/plugin-rtc 5.5.5-beem.2 → 5.5.5-beem.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +89 -10
- package/dist/index.esm.js +389 -175
- package/dist/index.js +389 -175
- package/dist/index.umd.js +389 -175
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* RCRTC - v5.5.5-beem.
|
|
3
|
-
* CommitId -
|
|
4
|
-
*
|
|
2
|
+
* RCRTC - v5.5.5-beem.4
|
|
3
|
+
* CommitId - 1c464fa58c20897be94d3d50ee25c52729284323
|
|
4
|
+
* Tue Nov 08 2022 19:35:07 GMT+0800 (China Standard Time)
|
|
5
5
|
* ©2020 RongCloud, Inc. All rights reserved.
|
|
6
6
|
*/
|
|
7
7
|
import { EventEmitter, isNumber, validate, isObject as isObject$1, ErrorCode, HttpMethod, isArray, ConnectionStatus, notEmptyObject, notEmptyArray, notEmptyString, isString, RTCMode as RTCMode$1, assert, ConversationType, isHttpUrl, isBoolean, isUndefined, forEach, VersionManage, LogL } from '@rongcloud/engine';
|
|
@@ -6822,7 +6822,7 @@ class RCTrack extends EventEmitter {
|
|
|
6822
6822
|
}));
|
|
6823
6823
|
return { code: RCRTCCode.VIDEO_TRACK_MISS_MEDIA_ELEMENT };
|
|
6824
6824
|
}
|
|
6825
|
-
this._element = isVideoTrack ? element :
|
|
6825
|
+
this._element = isVideoTrack ? element : new Audio();
|
|
6826
6826
|
// 若本地静音,则恢复本地播放
|
|
6827
6827
|
if (this._localMuted) {
|
|
6828
6828
|
this._setLocalMuted(false);
|
|
@@ -6878,10 +6878,10 @@ class RCTrack extends EventEmitter {
|
|
|
6878
6878
|
msg: `HTMLMediaElement oncanplay -> id: ${(_k = evt.target) === null || _k === void 0 ? void 0 : _k.id}, trackId: ${this._id}`,
|
|
6879
6879
|
}));
|
|
6880
6880
|
try {
|
|
6881
|
-
yield ((_l = this._element) === null || _l === void 0 ? void 0 : _l.play());
|
|
6882
6881
|
if ((options === null || options === void 0 ? void 0 : options.audioDeviceId) && !isVideoTrack) {
|
|
6883
6882
|
yield this._element.setSinkId(options.audioDeviceId);
|
|
6884
6883
|
}
|
|
6884
|
+
yield ((_l = this._element) === null || _l === void 0 ? void 0 : _l.play());
|
|
6885
6885
|
}
|
|
6886
6886
|
catch (error) {
|
|
6887
6887
|
/**
|
|
@@ -6919,9 +6919,9 @@ class RCTrack extends EventEmitter {
|
|
|
6919
6919
|
this._element.x5PlaysInline = true;
|
|
6920
6920
|
this._element.webkitPlaysInline = true;
|
|
6921
6921
|
}
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6922
|
+
if ((options === null || options === void 0 ? void 0 : options.audioDeviceId) && !isVideoTrack) {
|
|
6923
|
+
yield this._element.setSinkId(options.audioDeviceId);
|
|
6924
|
+
}
|
|
6925
6925
|
// audio 标签设置音量
|
|
6926
6926
|
if (!isVideoTrack && ((options === null || options === void 0 ? void 0 : options.volume) || (options === null || options === void 0 ? void 0 : options.volume) === 0)) {
|
|
6927
6927
|
this._element.volume = (options === null || options === void 0 ? void 0 : options.volume) / 100;
|
|
@@ -7981,6 +7981,13 @@ const PING_TIMEOUT = 5 * 1000;
|
|
|
7981
7981
|
* RTCPing 类,在下发的 ping 超时时间 _offlineKickTime 内,未能 Ping 成功则认为 ping 失败
|
|
7982
7982
|
*/
|
|
7983
7983
|
class Pinger {
|
|
7984
|
+
/**
|
|
7985
|
+
* 一个构造函数。
|
|
7986
|
+
* @param {ReadableStore} _store - ReadableStore:包含房间信息的商店。
|
|
7987
|
+
* @param {RTCContext} _context - RTC上下文
|
|
7988
|
+
* @param {number} _gap - ping 之间的时间间隔。
|
|
7989
|
+
* @param {number} _offlineKickTime - 用户离线时被踢出房间的时间。
|
|
7990
|
+
*/
|
|
7984
7991
|
constructor(_store, _context, _gap = PING_GAP, _offlineKickTime = 60 * 1000) {
|
|
7985
7992
|
this._store = _store;
|
|
7986
7993
|
this._context = _context;
|
|
@@ -7996,6 +8003,10 @@ class Pinger {
|
|
|
7996
8003
|
const { roomId, roomMode } = this._store;
|
|
7997
8004
|
this._roomId = roomId;
|
|
7998
8005
|
this._roomMode = roomMode;
|
|
8006
|
+
// 设置最小 offlineKickTime 值
|
|
8007
|
+
if (this._offlineKickTime < 15 * 1000) {
|
|
8008
|
+
this._offlineKickTime = 15000;
|
|
8009
|
+
}
|
|
7999
8010
|
}
|
|
8000
8011
|
/**
|
|
8001
8012
|
* 启动 Ping
|
|
@@ -14738,7 +14749,7 @@ const getCommonHeader$1 = () => ({
|
|
|
14738
14749
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
14739
14750
|
'Cache-Control': 'no-cache',
|
|
14740
14751
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
14741
|
-
ClientVersion: "5.5.5-beem.
|
|
14752
|
+
ClientVersion: "5.5.5-beem.4",
|
|
14742
14753
|
'Client-Session-Id': getUUID(),
|
|
14743
14754
|
'Request-Id': Date.now().toString(),
|
|
14744
14755
|
});
|
|
@@ -14988,7 +14999,7 @@ const reportQualitySubscribeAndUnsubscribeData = (attrs, code) => {
|
|
|
14988
14999
|
rsid: item.reqId,
|
|
14989
15000
|
rsdur: item.end - item.start,
|
|
14990
15001
|
msa: item.url,
|
|
14991
|
-
rscod: item.
|
|
15002
|
+
rscod: item.status,
|
|
14992
15003
|
});
|
|
14993
15004
|
});
|
|
14994
15005
|
if (memo.subscribeCommand) {
|
|
@@ -15107,7 +15118,7 @@ const reportQualityPublishData = (localTracks, code) => {
|
|
|
15107
15118
|
rsid: item.reqId,
|
|
15108
15119
|
rsdur: item.end - item.start,
|
|
15109
15120
|
msa: item.url,
|
|
15110
|
-
rscod: item.
|
|
15121
|
+
rscod: item.status,
|
|
15111
15122
|
});
|
|
15112
15123
|
});
|
|
15113
15124
|
localTracks.forEach((track) => {
|
|
@@ -15126,7 +15137,7 @@ const reportQualityPublishSignalTotalData = (allPublishList, code) => {
|
|
|
15126
15137
|
rsid: item.reqId,
|
|
15127
15138
|
rsdur: item.end - item.start,
|
|
15128
15139
|
msa: item.url,
|
|
15129
|
-
rscod: item.
|
|
15140
|
+
rscod: item.status,
|
|
15130
15141
|
});
|
|
15131
15142
|
});
|
|
15132
15143
|
const sigs = [];
|
|
@@ -15182,7 +15193,7 @@ const reportQualityUnpublishData = (tracks, code) => {
|
|
|
15182
15193
|
rsid: item.reqId,
|
|
15183
15194
|
rsdur: item.end - item.start,
|
|
15184
15195
|
msa: item.url,
|
|
15185
|
-
rscod: item.
|
|
15196
|
+
rscod: item.status,
|
|
15186
15197
|
});
|
|
15187
15198
|
});
|
|
15188
15199
|
const sigs = [];
|
|
@@ -15208,7 +15219,7 @@ const reportQualityUnpublishSignalTotalData = (unpublishList, code) => {
|
|
|
15208
15219
|
rsid: item.reqId,
|
|
15209
15220
|
rsdur: item.end - item.start,
|
|
15210
15221
|
msa: item.url,
|
|
15211
|
-
rscod: item.
|
|
15222
|
+
rscod: item.status,
|
|
15212
15223
|
});
|
|
15213
15224
|
});
|
|
15214
15225
|
const sigs = [];
|
|
@@ -15277,7 +15288,7 @@ const reportQualityIceStatusData = () => {
|
|
|
15277
15288
|
var _a, _b, _c, _d;
|
|
15278
15289
|
const memo = Memo.getMemo();
|
|
15279
15290
|
const reportData = JSON.stringify(Object.assign(Object.assign({}, memo.qualityIceStatusReportData), { dur: (((_a = memo.iceNewStatusData) === null || _a === void 0 ? void 0 : _a.start) || 0) - (((_b = memo.iceOldStatusData) === null || _b === void 0 ? void 0 : _b.start) || 0), pices: ICEConnectionState[((_c = memo.iceOldStatusData) === null || _c === void 0 ? void 0 : _c.status) || 0], ices: ICEConnectionState[((_d = memo.iceNewStatusData) === null || _d === void 0 ? void 0 : _d.status) || 0], time: Date.now(), cncdts: [] }));
|
|
15280
|
-
logger.__statistics(RCLoggerTag.
|
|
15291
|
+
logger.__statistics(RCLoggerTag.L_QS_ICE_STATUS_S, reportData);
|
|
15281
15292
|
};
|
|
15282
15293
|
const reportQualityFirstSubOrPubStatusData = () => {
|
|
15283
15294
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
@@ -15316,7 +15327,7 @@ const getCommonHeader = () => ({
|
|
|
15316
15327
|
'Content-Type': 'application/json;charset=UTF-8',
|
|
15317
15328
|
'Cache-Control': 'no-cache',
|
|
15318
15329
|
ClientType: `web|${browserInfo.browser}|${browserInfo.version}`,
|
|
15319
|
-
ClientVersion: "5.5.5-beem.
|
|
15330
|
+
ClientVersion: "5.5.5-beem.4",
|
|
15320
15331
|
'Client-Session-Id': getUUID(),
|
|
15321
15332
|
'Request-Id': Date.now().toString(),
|
|
15322
15333
|
});
|
|
@@ -15827,6 +15838,21 @@ class SourceIdMap {
|
|
|
15827
15838
|
}
|
|
15828
15839
|
SourceIdMap._instance = new Map([['sourceIdForPublishMap', new Map()], ['sourceIdForSubscribeMap', new Map()]]);
|
|
15829
15840
|
|
|
15841
|
+
var ReportTypes;
|
|
15842
|
+
(function (ReportTypes) {
|
|
15843
|
+
ReportTypes["TRACK"] = "track";
|
|
15844
|
+
ReportTypes["STREAM"] = "stream";
|
|
15845
|
+
ReportTypes["MEDIASOURCE"] = "media-source";
|
|
15846
|
+
ReportTypes["INBOUNDRTP"] = "inbound-rtp";
|
|
15847
|
+
ReportTypes["OUTBOUNDRTP"] = "outbound-rtp";
|
|
15848
|
+
ReportTypes["REMOTEINBOUNDRTP"] = "remote-inbound-rtp";
|
|
15849
|
+
ReportTypes["PEERCONNECTION"] = "peer-connection";
|
|
15850
|
+
ReportTypes["TRANSPORT"] = "transport";
|
|
15851
|
+
ReportTypes["CERTIFICATE"] = "certificate";
|
|
15852
|
+
ReportTypes["CANDIDATEPAIR"] = "candidate-pair";
|
|
15853
|
+
ReportTypes["REMOTECANDIDATE"] = "remote-candidate";
|
|
15854
|
+
ReportTypes["LOCALCANDIDATE"] = "local-candidate";
|
|
15855
|
+
})(ReportTypes || (ReportTypes = {}));
|
|
15830
15856
|
class AbstractStatParser {
|
|
15831
15857
|
constructor(_rtcPeerConn, _sdpSemantics, _currentUserId) {
|
|
15832
15858
|
this._rtcPeerConn = _rtcPeerConn;
|
|
@@ -15986,10 +16012,10 @@ class AbstractStatParser {
|
|
|
15986
16012
|
}
|
|
15987
16013
|
parseRTCStatsReport(reports) {
|
|
15988
16014
|
const stats = {};
|
|
15989
|
-
for (const key of reports.
|
|
16015
|
+
for (const [key, value] of reports.entries()) {
|
|
15990
16016
|
// 过滤下行数据上报
|
|
15991
|
-
if (!key.includes('RTCCodec_')) {
|
|
15992
|
-
stats[key] =
|
|
16017
|
+
if (!/codec/ig.test(value) || !key.includes('RTCCodec_')) {
|
|
16018
|
+
stats[key] = value;
|
|
15993
16019
|
}
|
|
15994
16020
|
}
|
|
15995
16021
|
return stats;
|
|
@@ -16067,6 +16093,38 @@ class AbstractStatParser {
|
|
|
16067
16093
|
const valid = answer === null || answer === void 0 ? void 0 : answer.split('\r\nm=').some((item) => (item.includes(ssrc) && item.includes('a=inactive')));
|
|
16068
16094
|
return !valid;
|
|
16069
16095
|
}
|
|
16096
|
+
formatStateData(stats) {
|
|
16097
|
+
const init = {
|
|
16098
|
+
outbound: [],
|
|
16099
|
+
remoteInbound: [],
|
|
16100
|
+
inbound: [],
|
|
16101
|
+
transport: [],
|
|
16102
|
+
connection: [],
|
|
16103
|
+
};
|
|
16104
|
+
return Object.values(stats).reduce((result, item) => {
|
|
16105
|
+
if (item.type === ReportTypes.REMOTEINBOUNDRTP) {
|
|
16106
|
+
result.remoteInbound.push(item);
|
|
16107
|
+
return result;
|
|
16108
|
+
}
|
|
16109
|
+
if (item.type === ReportTypes.INBOUNDRTP) {
|
|
16110
|
+
result.inbound.push(item);
|
|
16111
|
+
return result;
|
|
16112
|
+
}
|
|
16113
|
+
if (item.type === ReportTypes.OUTBOUNDRTP) {
|
|
16114
|
+
result.outbound.push(item);
|
|
16115
|
+
return result;
|
|
16116
|
+
}
|
|
16117
|
+
if (item.type === ReportTypes.TRANSPORT) {
|
|
16118
|
+
result.transport.push(item);
|
|
16119
|
+
return result;
|
|
16120
|
+
}
|
|
16121
|
+
if (item.type === ReportTypes.PEERCONNECTION) {
|
|
16122
|
+
result.connection.push(item);
|
|
16123
|
+
return result;
|
|
16124
|
+
}
|
|
16125
|
+
return result;
|
|
16126
|
+
}, init);
|
|
16127
|
+
}
|
|
16070
16128
|
}
|
|
16071
16129
|
/**
|
|
16072
16130
|
* 从sdp中解析出ssrc和msid并缓存
|
|
@@ -16101,25 +16159,118 @@ AbstractStatParser.formatSourceIdMapFromSdp = (sdp, type) => {
|
|
|
16101
16159
|
* chrome 73 无 type 为 remote-inbound-rtp 的数据,上行拿不到 jetter、rtt、packetsLost 数据
|
|
16102
16160
|
*/
|
|
16103
16161
|
class RTCReportParser$2 extends AbstractStatParser {
|
|
16162
|
+
/**
|
|
16163
|
+
* 该函数用于解析getStats()方法返回的RTCStatsReport对象的数据,然后以RCRTCStateReport对象的格式返回数据
|
|
16164
|
+
* @param stats - getStats 方法返回的数据
|
|
16165
|
+
* @returns 返回值是一个具有以下属性的对象:IInnerRCRTCStateReport
|
|
16166
|
+
*/
|
|
16104
16167
|
formatRCRTCStateReport(stats) {
|
|
16168
|
+
const { outbound, remoteInbound, inbound, transport, connection, } = this.formatStateData(stats);
|
|
16105
16169
|
const reports = {
|
|
16106
16170
|
senders: [],
|
|
16107
16171
|
receivers: [],
|
|
16108
16172
|
};
|
|
16109
16173
|
// 当次报告创建时的时间戳
|
|
16110
|
-
const timestamp = Math.floor(
|
|
16174
|
+
const timestamp = Math.floor(connection[0].timestamp);
|
|
16111
16175
|
reports.timestamp = timestamp;
|
|
16112
|
-
const keys = Object.keys(stats);
|
|
16113
16176
|
// 总丢包数
|
|
16114
16177
|
let totalPacketsLost = 0;
|
|
16115
16178
|
// 上行码率总和
|
|
16116
16179
|
let bitrateSend = 0;
|
|
16117
16180
|
// 解析上行媒体流数据: RTCOutboundRTPVideoStream | RTCOutboundRTPAudioStream
|
|
16118
|
-
|
|
16119
|
-
|
|
16181
|
+
({ totalPacketsLost, bitrateSend, senders: reports.senders } = this.pickOutbound(outbound, stats, totalPacketsLost, timestamp, bitrateSend));
|
|
16182
|
+
/**
|
|
16183
|
+
* outbound-rtp 存在无 remoteId 的情况,导致取不到有效的 jitter、rtt、packetsLost,
|
|
16184
|
+
* 可拿到 remote-inbound-rtp 的 localId,补充 senders 中的 jitter、rtt、packetsLost 数据,重新计算丢包率
|
|
16185
|
+
*/
|
|
16186
|
+
if (remoteInbound.length > 0 && reports.senders.length > 0) {
|
|
16187
|
+
this.pickRemoteInbound(remoteInbound, reports.senders, stats);
|
|
16188
|
+
}
|
|
16189
|
+
// 下行码率总和
|
|
16190
|
+
let bitrateRecv = 0;
|
|
16191
|
+
// 下行流数据解析
|
|
16192
|
+
({ totalPacketsLost, bitrateRecv, receivers: reports.receivers } = this.pickInbound(inbound, stats, totalPacketsLost, timestamp, bitrateRecv));
|
|
16193
|
+
// 解析本端/远端 IP、Port 数据
|
|
16194
|
+
if (transport.length > 0) {
|
|
16195
|
+
const rtcTransport = transport[0];
|
|
16196
|
+
this.pickRtcTransport(rtcTransport, stats, reports, bitrateRecv, bitrateSend, totalPacketsLost);
|
|
16197
|
+
}
|
|
16198
|
+
return reports;
|
|
16199
|
+
}
|
|
16200
|
+
/**
|
|
16201
|
+
* 选择 RTC 传输的函数。
|
|
16202
|
+
* @param {ReportData[]} transport - 报告中的传输对象
|
|
16203
|
+
* @param stats - 当前 RTCPeerConnection 的统计信息
|
|
16204
|
+
* @param {IInnerRCRTCStateReport} reports - IInnerRCRTCStateReport
|
|
16205
|
+
* @param {number} bitrateRecv - 接收流的总比特率。
|
|
16206
|
+
* @param {number} bitrateSend - 传出流的比特率。
|
|
16207
|
+
* @param {number} totalPacketsLost - 当前会话中丢失的数据包总数。
|
|
16208
|
+
*/
|
|
16209
|
+
pickRtcTransport(rtcTransport, stats, reports, bitrateRecv, bitrateSend, totalPacketsLost) {
|
|
16210
|
+
const { selectedCandidatePairId } = rtcTransport;
|
|
16211
|
+
if (selectedCandidatePairId) {
|
|
16212
|
+
const iceCandidatePair = stats[selectedCandidatePairId];
|
|
16213
|
+
const { availableOutgoingBitrate,
|
|
16214
|
+
// 下行带宽只在有下行资源时有值
|
|
16215
|
+
availableIncomingBitrate, currentRoundTripTime: rtt, localCandidateId, remoteCandidateId, } = iceCandidatePair;
|
|
16216
|
+
const localCandidate = stats[localCandidateId];
|
|
16217
|
+
const { ip: IP, port, networkType } = localCandidate;
|
|
16218
|
+
const remoteCandidate = stats[remoteCandidateId];
|
|
16219
|
+
const { ip: remoteIP, port: remotePort, protocol } = remoteCandidate;
|
|
16220
|
+
reports.iceCandidatePair = {
|
|
16221
|
+
IP,
|
|
16222
|
+
port,
|
|
16223
|
+
networkType,
|
|
16224
|
+
remoteIP,
|
|
16225
|
+
remotePort,
|
|
16226
|
+
protocol,
|
|
16227
|
+
bitrateRecv,
|
|
16228
|
+
bitrateSend,
|
|
16229
|
+
rtt: rtt * 1000,
|
|
16230
|
+
availableOutgoingBitrate,
|
|
16231
|
+
availableIncomingBitrate,
|
|
16232
|
+
totalPacketsLost,
|
|
16233
|
+
};
|
|
16234
|
+
// 给下行 rtt 赋值
|
|
16235
|
+
reports.receivers.forEach((item) => {
|
|
16236
|
+
item.rtt = rtt;
|
|
16237
|
+
});
|
|
16238
|
+
}
|
|
16239
|
+
}
|
|
16240
|
+
/**
|
|
16241
|
+
* 它接收一个 ReportData 对象数组、一个 ISendTrackState 对象数组和一个 stats 对象。然后,它遍历 ReportData 对象,并为每个对象过滤
|
|
16242
|
+
* ISendTrackState 对象以找到与 ReportData 对象的 localId
|
|
16243
|
+
* 匹配的对象。如果找到匹配项,则检查发送方是否有远程数据。如果没有,则通过解析SDP获取resourceId,设置发送者的jitter和rtt,获取packetsSent,然后更新发送者的packetsLostRate
|
|
16244
|
+
* @param {ReportData[]} remoteInbound - 远程入站轨迹的数据。
|
|
16245
|
+
* @param {ISendTrackState[]} senders - 本地流的发送者列表。
|
|
16246
|
+
* @param stats - 本地流的统计信息。
|
|
16247
|
+
*/
|
|
16248
|
+
pickRemoteInbound(remoteInbound, senders, stats) {
|
|
16249
|
+
remoteInbound.forEach((remoteInboundItem) => {
|
|
16250
|
+
const { localId, jitter, roundTripTime: rtt, packetsLost, } = remoteInboundItem;
|
|
16251
|
+
const sender = senders.filter((item) => item.id === localId)[0];
|
|
16252
|
+
if (sender && !senderHasRemoteData(sender)) {
|
|
16253
|
+
const resourceId = this.getResourceIdByParseSdp(stats[sender.id]);
|
|
16254
|
+
sender.jitter = Math.round(jitter * 1000);
|
|
16255
|
+
sender.rtt = rtt;
|
|
16256
|
+
const packetsSent = this._latestPacketsSent[resourceId].crtPacketsSent;
|
|
16257
|
+
sender.packetsLostRate = this.updateSenderPacketsLost(resourceId, packetsLost, packetsSent);
|
|
16258
|
+
}
|
|
16259
|
+
});
|
|
16260
|
+
}
|
|
16261
|
+
/**
|
|
16262
|
+
* 该函数用于解析发送到远程端的本地流的数据
|
|
16263
|
+
* @param {ReportData[]} outbound - 本端发送的数据。
|
|
16264
|
+
* @param stats - 当前流的统计信息。
|
|
16265
|
+
* @param {number} totalPacketsLost - 本地和远程端丢失的数据包总数。
|
|
16266
|
+
* @param {number} timestamp - 当前报告的时间戳。
|
|
16267
|
+
* @param {number} bitrateSend - 本地流的总比特率。
|
|
16268
|
+
*/
|
|
16269
|
+
pickOutbound(outbound, stats, totalPacketsLost, timestamp, bitrateSend) {
|
|
16270
|
+
const senders = [];
|
|
16271
|
+
outbound.forEach((outboundInfo) => {
|
|
16120
16272
|
var _a;
|
|
16121
16273
|
// 本端输出数据
|
|
16122
|
-
const outboundInfo = stats[key];
|
|
16123
16274
|
if (this._sdpSemantics === 'unified-plan' && !this.isValidSender(outboundInfo)) {
|
|
16124
16275
|
return;
|
|
16125
16276
|
}
|
|
@@ -16183,7 +16334,7 @@ class RTCReportParser$2 extends AbstractStatParser {
|
|
|
16183
16334
|
}
|
|
16184
16335
|
// 总和累加
|
|
16185
16336
|
bitrateSend += bitrate;
|
|
16186
|
-
|
|
16337
|
+
senders.push({
|
|
16187
16338
|
id,
|
|
16188
16339
|
trackId: resourceId,
|
|
16189
16340
|
kind,
|
|
@@ -16205,28 +16356,19 @@ class RTCReportParser$2 extends AbstractStatParser {
|
|
|
16205
16356
|
trackState: STAT_NONE,
|
|
16206
16357
|
});
|
|
16207
16358
|
});
|
|
16208
|
-
|
|
16209
|
-
|
|
16210
|
-
|
|
16211
|
-
|
|
16212
|
-
|
|
16213
|
-
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16217
|
-
|
|
16218
|
-
|
|
16219
|
-
|
|
16220
|
-
|
|
16221
|
-
sender.packetsLostRate = this.updateSenderPacketsLost(resourceId, packetsLost, packetsSent);
|
|
16222
|
-
}
|
|
16223
|
-
});
|
|
16224
|
-
// 下行码率总和
|
|
16225
|
-
let bitrateRecv = 0;
|
|
16226
|
-
// 下行流数据解析
|
|
16227
|
-
const inboundKeys = keys.filter((key) => /^RTCInboundRTP(Video|Audio)Stream_/.test(key));
|
|
16228
|
-
inboundKeys.forEach((key) => {
|
|
16229
|
-
const inboundInfo = stats[key];
|
|
16359
|
+
return { totalPacketsLost, bitrateSend, senders };
|
|
16360
|
+
}
|
|
16361
|
+
/**
|
|
16362
|
+
* 解析报表的入站数据的函数。
|
|
16363
|
+
* @param {ReportData[]} inbound - 报表的入站数据
|
|
16364
|
+
* @param stats - 当前 RTCPeerConnection 的统计信息。
|
|
16365
|
+
* @param {number} totalPacketsLost - 丢包总数
|
|
16366
|
+
* @param {number} timestamp - 当前报告的时间戳。
|
|
16367
|
+
* @param {number} bitrateRecv - 接收流的总比特率。
|
|
16368
|
+
*/
|
|
16369
|
+
pickInbound(inbound, stats, totalPacketsLost, timestamp, bitrateRecv) {
|
|
16370
|
+
let receivers = [];
|
|
16371
|
+
inbound.forEach((inboundInfo) => {
|
|
16230
16372
|
if (this._sdpSemantics === 'unified-plan' && !this.isValidReceiver(inboundInfo)) {
|
|
16231
16373
|
return;
|
|
16232
16374
|
}
|
|
@@ -16253,7 +16395,7 @@ class RTCReportParser$2 extends AbstractStatParser {
|
|
|
16253
16395
|
bitrate = 0;
|
|
16254
16396
|
}
|
|
16255
16397
|
bitrateRecv += bitrate;
|
|
16256
|
-
|
|
16398
|
+
receivers.push({
|
|
16257
16399
|
trackId: resourceId,
|
|
16258
16400
|
kind,
|
|
16259
16401
|
packetsLostRate,
|
|
@@ -16274,78 +16416,35 @@ class RTCReportParser$2 extends AbstractStatParser {
|
|
|
16274
16416
|
trackState: STAT_NONE,
|
|
16275
16417
|
});
|
|
16276
16418
|
});
|
|
16277
|
-
|
|
16278
|
-
const transportKey = keys.filter((key) => /^RTCTransport_/.test(key))[0];
|
|
16279
|
-
if (transportKey) {
|
|
16280
|
-
const rtcTransport = stats[transportKey];
|
|
16281
|
-
const { selectedCandidatePairId } = rtcTransport;
|
|
16282
|
-
if (selectedCandidatePairId) {
|
|
16283
|
-
const iceCandidatePair = stats[selectedCandidatePairId];
|
|
16284
|
-
const { availableOutgoingBitrate,
|
|
16285
|
-
// 下行带宽只在有下行资源时有值
|
|
16286
|
-
availableIncomingBitrate, currentRoundTripTime: rtt, localCandidateId, remoteCandidateId, } = iceCandidatePair;
|
|
16287
|
-
const localCandidate = stats[localCandidateId];
|
|
16288
|
-
const { ip: IP, port, networkType } = localCandidate;
|
|
16289
|
-
const remoteCandidate = stats[remoteCandidateId];
|
|
16290
|
-
const { ip: remoteIP, port: remotePort, protocol } = remoteCandidate;
|
|
16291
|
-
reports.iceCandidatePair = {
|
|
16292
|
-
IP,
|
|
16293
|
-
port,
|
|
16294
|
-
networkType,
|
|
16295
|
-
remoteIP,
|
|
16296
|
-
remotePort,
|
|
16297
|
-
protocol,
|
|
16298
|
-
bitrateRecv,
|
|
16299
|
-
bitrateSend,
|
|
16300
|
-
rtt: rtt * 1000,
|
|
16301
|
-
availableOutgoingBitrate,
|
|
16302
|
-
availableIncomingBitrate,
|
|
16303
|
-
totalPacketsLost,
|
|
16304
|
-
};
|
|
16305
|
-
// 给下行 rtt 赋值
|
|
16306
|
-
reports.receivers.forEach((item) => {
|
|
16307
|
-
item.rtt = rtt;
|
|
16308
|
-
});
|
|
16309
|
-
}
|
|
16310
|
-
}
|
|
16311
|
-
return reports;
|
|
16419
|
+
return { totalPacketsLost, bitrateRecv, receivers };
|
|
16312
16420
|
}
|
|
16421
|
+
/**
|
|
16422
|
+
* 该函数用于获取当前流的音频电平
|
|
16423
|
+
* @param stats - getStats 方法返回的数据
|
|
16424
|
+
* @returns 具有以下属性的对象数组:
|
|
16425
|
+
*/
|
|
16313
16426
|
getAudioLevelList(stats) {
|
|
16314
16427
|
const audioLevelList = [];
|
|
16315
|
-
const keys = Object.keys(stats);
|
|
16316
16428
|
// 解析上行媒体流数据: RTCOutboundRTPVideoStream | RTCOutboundRTPAudioStream
|
|
16317
|
-
const
|
|
16318
|
-
|
|
16319
|
-
|
|
16429
|
+
const { outbound, inbound } = this.formatStateData(stats);
|
|
16430
|
+
const outboundList = outbound.filter((item) => (item === null || item === void 0 ? void 0 : item.kind) === 'audio');
|
|
16431
|
+
outboundList.forEach((outboundInfo) => {
|
|
16432
|
+
var _a;
|
|
16320
16433
|
// 本端输出数据
|
|
16321
|
-
const outboundInfo = stats[key];
|
|
16322
16434
|
if (this._sdpSemantics === 'unified-plan' && !this.isValidSender(outboundInfo)) {
|
|
16323
16435
|
return;
|
|
16324
16436
|
}
|
|
16325
16437
|
const { mediaSourceId, trackId, kind } = outboundInfo;
|
|
16326
|
-
const
|
|
16327
|
-
const
|
|
16328
|
-
let resourceId = '';
|
|
16329
|
-
for (const streamId of resourceIds.keys()) {
|
|
16330
|
-
const value = resourceIds.get(streamId);
|
|
16331
|
-
if (value) {
|
|
16332
|
-
const tracks = (_a = stats[`RTCMediaStream_${value.msid}`]) === null || _a === void 0 ? void 0 : _a.trackIds;
|
|
16333
|
-
if (tracks && tracks.includes(outboundInfo.trackId) && kind === value.kind) {
|
|
16334
|
-
resourceId = streamId;
|
|
16335
|
-
}
|
|
16336
|
-
}
|
|
16337
|
-
}
|
|
16338
|
-
// const resourceId = this.getResourceIdByParseSdp(outboundInfo);
|
|
16339
|
-
const audioLevel = mediaSourceId && stats[mediaSourceId] ? stats[mediaSourceId].audioLevel : (((_b = stats[trackId]) === null || _b === void 0 ? void 0 : _b.audioLevel) || null);
|
|
16438
|
+
const resourceId = this.getResourceIdByParseSdp(outboundInfo);
|
|
16439
|
+
const audioLevel = mediaSourceId && stats[mediaSourceId] ? stats[mediaSourceId].audioLevel : (((_a = stats[trackId]) === null || _a === void 0 ? void 0 : _a.audioLevel) || null);
|
|
16340
16440
|
audioLevelList.push({
|
|
16341
16441
|
trackId: resourceId,
|
|
16342
16442
|
audioLevel: (audioLevel || audioLevel === 0) ? handleAudioLevel(audioLevel) : null,
|
|
16343
16443
|
});
|
|
16344
16444
|
});
|
|
16345
16445
|
// 下行流数据解析
|
|
16346
|
-
const
|
|
16347
|
-
|
|
16348
|
-
const inboundInfo = stats[key];
|
|
16446
|
+
const inboundList = inbound.filter((item) => (item === null || item === void 0 ? void 0 : item.kind) === 'audio');
|
|
16447
|
+
inboundList.forEach((inboundInfo) => {
|
|
16349
16448
|
if (this._sdpSemantics === 'unified-plan' && !this.isValidReceiver(inboundInfo)) {
|
|
16350
16449
|
return;
|
|
16351
16450
|
}
|
|
@@ -17154,6 +17253,10 @@ class ASdpStrategy {
|
|
|
17154
17253
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17155
17254
|
// 过滤行末的空格,服务可能产生空格数据
|
|
17156
17255
|
sdp = ASdpBuilder.trimBlankLine(sdp);
|
|
17256
|
+
if (this._peer.connectionState === 'disconnected'
|
|
17257
|
+
|| this._peer.connectionState === 'closed') {
|
|
17258
|
+
return RCRTCCode.SET_REMOTE_DESCRIPTION_FAILED;
|
|
17259
|
+
}
|
|
17157
17260
|
try {
|
|
17158
17261
|
yield this._peer.setRemoteDescription({ type: 'answer', sdp });
|
|
17159
17262
|
}
|
|
@@ -17508,6 +17611,10 @@ class UnifiedPlanStrategy extends ASdpStrategy {
|
|
|
17508
17611
|
var _a;
|
|
17509
17612
|
(_a = this._logger) === null || _a === void 0 ? void 0 : _a.warn(RCLoggerTag.L_OLD_DAILY_RECORD_O, 'the interface named `setBitrate` is invalid while sdpSemantics value is `unified-plan`');
|
|
17510
17613
|
}
|
|
17614
|
+
/**
|
|
17615
|
+
* 该函数用于向对等连接添加本地轨道
|
|
17616
|
+
* @param {RCLocalTrack} track - RCLocalTrack
|
|
17617
|
+
*/
|
|
17511
17618
|
addLocalTrack(track) {
|
|
17512
17619
|
var _a;
|
|
17513
17620
|
const trackId = track.getTrackId();
|
|
@@ -17532,6 +17639,11 @@ class UnifiedPlanStrategy extends ASdpStrategy {
|
|
|
17532
17639
|
const SingleInstance = SdpResource.getInstance();
|
|
17533
17640
|
SingleInstance.push(trackId, { msid, id: this._outboundStreams[msid].id, kind: (_a = track.streamTrack) === null || _a === void 0 ? void 0 : _a.kind });
|
|
17534
17641
|
}
|
|
17642
|
+
/**
|
|
17643
|
+
* 该函数从对等连接中删除本地轨道
|
|
17644
|
+
* @param {RCLocalTrack} track - RCLocalTrack
|
|
17645
|
+
* @returns 返回值是函数中执行的最后一条语句返回的值。
|
|
17646
|
+
*/
|
|
17535
17647
|
removeLocalTrack(track) {
|
|
17536
17648
|
const trackId = track.getTrackId();
|
|
17537
17649
|
const msid = track.getStreamId();
|
|
@@ -17570,6 +17682,11 @@ class UnifiedPlanStrategy extends ASdpStrategy {
|
|
|
17570
17682
|
tinyTrack.stop();
|
|
17571
17683
|
}
|
|
17572
17684
|
}
|
|
17685
|
+
/**
|
|
17686
|
+
* 更新trackId和收发器的映射关系,从候选列表中删除收发器
|
|
17687
|
+
* @param {string} trackId - 要添加的轨道的 trackId。
|
|
17688
|
+
* @param {RTCRtpTransceiver} transceiver - RTCRtp收发器
|
|
17689
|
+
*/
|
|
17573
17690
|
updateRecvTransceiverMap(trackId, transceiver) {
|
|
17574
17691
|
const { mediaType } = parseTrackId(trackId);
|
|
17575
17692
|
// 更新映射关系
|
|
@@ -17579,6 +17696,10 @@ class UnifiedPlanStrategy extends ASdpStrategy {
|
|
|
17579
17696
|
const index = arrTransceiver.findIndex((item) => item === transceiver);
|
|
17580
17697
|
index >= 0 && arrTransceiver.splice(index, 1);
|
|
17581
17698
|
}
|
|
17699
|
+
/**
|
|
17700
|
+
* 该函数用于更新本地客户端订阅的远程轨道
|
|
17701
|
+
* @param {RCRemoteTrack[]} tracks - 要更新的远程轨道数组。
|
|
17702
|
+
*/
|
|
17582
17703
|
updateSubRemoteTracks(tracks) {
|
|
17583
17704
|
// 减法记录新增订阅
|
|
17584
17705
|
const addTracks = tracks.slice();
|
|
@@ -17792,13 +17913,17 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
17792
17913
|
/**
|
|
17793
17914
|
* 北极星上传实例
|
|
17794
17915
|
*/
|
|
17795
|
-
_polarisReport, onTrackTrouble
|
|
17916
|
+
_polarisReport, onTrackTrouble,
|
|
17917
|
+
/* 私有只读属性。RTCContext */
|
|
17918
|
+
_initOptions) {
|
|
17796
17919
|
super();
|
|
17797
17920
|
this._pcName = _pcName;
|
|
17798
17921
|
this._reTryExchange = _reTryExchange;
|
|
17799
17922
|
this._currentUserId = _currentUserId;
|
|
17800
17923
|
this._polarisReport = _polarisReport;
|
|
17801
17924
|
this.onTrackTrouble = onTrackTrouble;
|
|
17925
|
+
this._initOptions = _initOptions;
|
|
17926
|
+
this.senderAndReciveSize = 32;
|
|
17802
17927
|
this.pubLocalTracks = {};
|
|
17803
17928
|
this._reTryExchangeTimer = null;
|
|
17804
17929
|
// peerConnection stats 计时器
|
|
@@ -17921,6 +18046,13 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
17921
18046
|
}));
|
|
17922
18047
|
});
|
|
17923
18048
|
}
|
|
18049
|
+
/**
|
|
18050
|
+
* `createOffer` 是一个创建报价并记录报价 SDP 和 SDP 语义的函数
|
|
18051
|
+
* @param {boolean} iceRestart - 布尔值
|
|
18052
|
+
* @returns 具有两个属性的对象:
|
|
18053
|
+
* - sdp:SDP 字符串
|
|
18054
|
+
* - 语义:SDP 语义
|
|
18055
|
+
*/
|
|
17924
18056
|
createOffer(iceRestart) {
|
|
17925
18057
|
var _a;
|
|
17926
18058
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -17940,6 +18072,10 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
17940
18072
|
getLocalTrack(trackId) {
|
|
17941
18073
|
return this.pubLocalTracks[trackId] || null;
|
|
17942
18074
|
}
|
|
18075
|
+
/**
|
|
18076
|
+
* 它将本地轨道添加到对等连接。
|
|
18077
|
+
* @param {RCLocalTrack} track - 要添加的本地轨道。
|
|
18078
|
+
*/
|
|
17943
18079
|
addLocalTrack(track) {
|
|
17944
18080
|
var _a;
|
|
17945
18081
|
this.pubLocalTracks[track.getTrackId()] = track;
|
|
@@ -17953,6 +18089,11 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
17953
18089
|
trackId: track.getTrackId(),
|
|
17954
18090
|
}));
|
|
17955
18091
|
}
|
|
18092
|
+
/**
|
|
18093
|
+
* 按 ID 删除本地轨道
|
|
18094
|
+
* @param {string} trackId - 要移除的轨道的 ID。
|
|
18095
|
+
* @returns 正在删除的轨道。
|
|
18096
|
+
*/
|
|
17956
18097
|
removeLocalTrackById(trackId) {
|
|
17957
18098
|
var _a, _b;
|
|
17958
18099
|
const track = this.getLocalTrack(trackId);
|
|
@@ -17970,12 +18111,19 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
17970
18111
|
}));
|
|
17971
18112
|
this.removeLocalTrack(track);
|
|
17972
18113
|
}
|
|
18114
|
+
/**
|
|
18115
|
+
* 它会删除所有本地Track。
|
|
18116
|
+
*/
|
|
17973
18117
|
removeAllLocalTrack() {
|
|
17974
18118
|
Object.keys(this.pubLocalTracks).forEach((id) => {
|
|
17975
18119
|
// 小流不可先于大流执行 removeLocalTrackById,否则可能存在小流被当做大流进而不可被销毁
|
|
17976
18120
|
/_tiny$/.test(id) || this.removeLocalTrackById(id);
|
|
17977
18121
|
});
|
|
17978
18122
|
}
|
|
18123
|
+
/**
|
|
18124
|
+
* 从对等连接中删除本地轨道。
|
|
18125
|
+
* @param {RCLocalTrack} track - 要删除的本地轨道。
|
|
18126
|
+
*/
|
|
17979
18127
|
removeLocalTrack(track) {
|
|
17980
18128
|
var _a;
|
|
17981
18129
|
const trackId = track.getTrackId();
|
|
@@ -18031,44 +18179,46 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
18031
18179
|
this._reportListener = listener;
|
|
18032
18180
|
}
|
|
18033
18181
|
_createRCRTCStateReport(data) {
|
|
18034
|
-
const { timestamp, iceCandidatePair, senders, receivers, } =
|
|
18035
|
-
iceCandidatePair === null || iceCandidatePair === void 0 ?
|
|
18182
|
+
const { timestamp, iceCandidatePair, senders, receivers, } = data;
|
|
18183
|
+
if (iceCandidatePair === null || iceCandidatePair === void 0 ? void 0 : iceCandidatePair.totalPacketsLost) {
|
|
18184
|
+
iceCandidatePair === null || iceCandidatePair === void 0 ? true : delete iceCandidatePair.totalPacketsLost;
|
|
18185
|
+
}
|
|
18036
18186
|
for (const key in iceCandidatePair) {
|
|
18037
18187
|
isNull(iceCandidatePair[key]) && delete iceCandidatePair[key];
|
|
18038
18188
|
}
|
|
18039
|
-
const
|
|
18040
|
-
|
|
18041
|
-
|
|
18042
|
-
|
|
18043
|
-
|
|
18044
|
-
|
|
18189
|
+
const pickSender = [];
|
|
18190
|
+
senders.forEach((item) => {
|
|
18191
|
+
const { trackId, kind, packetsLostRate, remoteResource, bitrate, jitter, } = item;
|
|
18192
|
+
const sender = {
|
|
18193
|
+
trackId, kind, packetsLostRate, remoteResource, bitrate, jitter,
|
|
18194
|
+
};
|
|
18045
18195
|
(item.audioLevel || item.audioLevel === 0) && (sender.audioLevel = item.audioLevel);
|
|
18046
18196
|
item.frameWidth && (sender.frameWidth = item.frameWidth);
|
|
18047
18197
|
item.frameHeight && (sender.frameHeight = item.frameHeight);
|
|
18048
18198
|
item.frameRate && (sender.frameRate = item.frameRate);
|
|
18049
|
-
(item.
|
|
18050
|
-
|
|
18051
|
-
|
|
18052
|
-
});
|
|
18053
|
-
const newReceivers =
|
|
18054
|
-
|
|
18055
|
-
|
|
18056
|
-
|
|
18057
|
-
|
|
18058
|
-
|
|
18199
|
+
if (item.trackId) {
|
|
18200
|
+
pickSender.push(Object.assign({}, sender));
|
|
18201
|
+
}
|
|
18202
|
+
});
|
|
18203
|
+
const newReceivers = [];
|
|
18204
|
+
receivers.forEach((item) => {
|
|
18205
|
+
const { trackId, kind, packetsLostRate, remoteResource, bitrate, jitter, } = item;
|
|
18206
|
+
const receiver = {
|
|
18207
|
+
trackId, kind, packetsLostRate, remoteResource, bitrate, jitter,
|
|
18208
|
+
};
|
|
18059
18209
|
(item.audioLevel || item.audioLevel === 0) && (receiver.audioLevel = item.audioLevel);
|
|
18060
18210
|
item.frameWidth && (receiver.frameWidth = item.frameWidth);
|
|
18061
18211
|
item.frameHeight && (receiver.frameHeight = item.frameHeight);
|
|
18062
18212
|
item.frameRate && (receiver.frameRate = item.frameRate);
|
|
18063
|
-
(item.
|
|
18064
|
-
|
|
18065
|
-
|
|
18213
|
+
if (item.trackId) {
|
|
18214
|
+
newReceivers.push(Object.assign({}, receiver));
|
|
18215
|
+
}
|
|
18066
18216
|
});
|
|
18067
18217
|
return {
|
|
18068
18218
|
timestamp,
|
|
18069
18219
|
iceCandidatePair,
|
|
18070
|
-
senders:
|
|
18071
|
-
receivers: newReceivers
|
|
18220
|
+
senders: pickSender,
|
|
18221
|
+
receivers: newReceivers,
|
|
18072
18222
|
pcName: this._pcName,
|
|
18073
18223
|
};
|
|
18074
18224
|
}
|
|
@@ -18149,35 +18299,48 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
18149
18299
|
* 获取缓存的本地质量数据
|
|
18150
18300
|
*/
|
|
18151
18301
|
_getCacheStatsData() {
|
|
18152
|
-
return this
|
|
18302
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18303
|
+
return this._getStatsData();
|
|
18304
|
+
});
|
|
18153
18305
|
}
|
|
18154
18306
|
/**
|
|
18155
18307
|
* 北极星上报 R3、R4 数据
|
|
18156
18308
|
*/
|
|
18157
18309
|
_sendR3R4Data() {
|
|
18158
|
-
var _a;
|
|
18310
|
+
var _a, _b;
|
|
18159
18311
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18160
|
-
const formatData = this._getCacheStatsData();
|
|
18312
|
+
const formatData = yield this._getCacheStatsData();
|
|
18161
18313
|
if (!formatData) {
|
|
18162
18314
|
return true;
|
|
18163
18315
|
}
|
|
18316
|
+
/**
|
|
18317
|
+
* 优化 300 人大会议室 https://rc-jira.rongcloud.net/browse/BEEM-289
|
|
18318
|
+
* Mac 端卡顿严重, RTCLib 房间超出 32 路流时,不再做北极星质量数据上报,仅取音量数据,以保持 Beem 声音激励功能可用
|
|
18319
|
+
*/
|
|
18320
|
+
if (!((_a = this === null || this === void 0 ? void 0 : this._initOptions) === null || _a === void 0 ? void 0 : _a.polarisThrottle) && formatData.receivers.length + formatData.senders.length > this.senderAndReciveSize) {
|
|
18321
|
+
return true;
|
|
18322
|
+
}
|
|
18164
18323
|
if (formatData.senders.length || formatData.receivers.length) {
|
|
18165
18324
|
/**
|
|
18166
18325
|
* 组装北极星上报 R3、R4 数据并发送
|
|
18167
18326
|
*/
|
|
18168
|
-
const res = yield ((
|
|
18327
|
+
const res = yield ((_b = this._polarisReport) === null || _b === void 0 ? void 0 : _b.sendR3R4Data(formatData));
|
|
18169
18328
|
if (formatData.senders.length > 0) {
|
|
18170
18329
|
formatData.senders.forEach((item) => {
|
|
18171
|
-
|
|
18172
|
-
|
|
18173
|
-
|
|
18174
|
-
|
|
18330
|
+
if (item.kind === 'video') {
|
|
18331
|
+
const { encoderImplementation, frameRate, frameWidth, frameHeight, } = item;
|
|
18332
|
+
let flag = 0;
|
|
18333
|
+
if ((encoderImplementation === null || encoderImplementation === void 0 ? void 0 : encoderImplementation.toLowerCase()) === 'unknown' || !frameRate || !frameWidth || !frameHeight) {
|
|
18334
|
+
flag = 1;
|
|
18335
|
+
}
|
|
18336
|
+
// 当前 trackId 的视频出现问题
|
|
18337
|
+
this.setTroubleTrack(item.trackId, flag);
|
|
18175
18338
|
}
|
|
18176
|
-
this.setTroubleTrack(item.trackId, flag);
|
|
18177
18339
|
});
|
|
18178
18340
|
}
|
|
18179
18341
|
return res;
|
|
18180
18342
|
}
|
|
18343
|
+
return true;
|
|
18181
18344
|
});
|
|
18182
18345
|
}
|
|
18183
18346
|
/**
|
|
@@ -18186,10 +18349,11 @@ class RCRTCPeerConnection extends EventEmitter {
|
|
|
18186
18349
|
__reportR3R4ToPolaris() {
|
|
18187
18350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
18188
18351
|
clearTimeout(this._reportR3R4ToPolarisTimer);
|
|
18189
|
-
|
|
18190
|
-
|
|
18191
|
-
|
|
18192
|
-
|
|
18352
|
+
this._reportR3R4ToPolarisTimer = setTimeout(() => __awaiter(this, void 0, void 0, function* () {
|
|
18353
|
+
this._sendR3R4Data().then(() => {
|
|
18354
|
+
this.__reportR3R4ToPolaris();
|
|
18355
|
+
});
|
|
18356
|
+
}), 2000);
|
|
18193
18357
|
});
|
|
18194
18358
|
}
|
|
18195
18359
|
getRTCPeerConn() {
|
|
@@ -18501,7 +18665,7 @@ class PolarisReporter {
|
|
|
18501
18665
|
* 加入房间
|
|
18502
18666
|
*/
|
|
18503
18667
|
sendR1() {
|
|
18504
|
-
const rtcVersion = "5.5.5-beem.
|
|
18668
|
+
const rtcVersion = "5.5.5-beem.4";
|
|
18505
18669
|
const imVersion = this._context.getCoreVersion();
|
|
18506
18670
|
const platform = 'web';
|
|
18507
18671
|
const pcName = navigator.platform;
|
|
@@ -18651,7 +18815,7 @@ class PolarisHttpReporter {
|
|
|
18651
18815
|
_formatR1Data() {
|
|
18652
18816
|
return {
|
|
18653
18817
|
joinTime: this._context.userJoinTime || 0,
|
|
18654
|
-
rtcVersion: "5.5.5-beem.
|
|
18818
|
+
rtcVersion: "5.5.5-beem.4",
|
|
18655
18819
|
imVersion: this._context.getCoreVersion(),
|
|
18656
18820
|
platform: 'web',
|
|
18657
18821
|
device: navigator.platform,
|
|
@@ -18912,12 +19076,17 @@ class RCRTCPeerCManager {
|
|
|
18912
19076
|
/**
|
|
18913
19077
|
* 北极星上报模块
|
|
18914
19078
|
*/
|
|
18915
|
-
_polarisReport
|
|
19079
|
+
_polarisReport,
|
|
19080
|
+
/**
|
|
19081
|
+
* context
|
|
19082
|
+
*/
|
|
19083
|
+
_initOptions) {
|
|
18916
19084
|
this._useMutilPeerC = _useMutilPeerC;
|
|
18917
19085
|
this._roomId = _roomId;
|
|
18918
19086
|
this._reTryExchange = _reTryExchange;
|
|
18919
19087
|
this._currentUserId = _currentUserId;
|
|
18920
19088
|
this._polarisReport = _polarisReport;
|
|
19089
|
+
this._initOptions = _initOptions;
|
|
18921
19090
|
// private _reportListener: {[key: string]: IRCRTCReportListener | null} = {}
|
|
18922
19091
|
/**
|
|
18923
19092
|
* 存储创建的所有 peerC,key 为 pcName,/exchange 请求中 request header 中的 Peer-Connection-Id 值
|
|
@@ -18984,7 +19153,7 @@ class RCRTCPeerCManager {
|
|
|
18984
19153
|
* 创建一个新 peerC
|
|
18985
19154
|
*/
|
|
18986
19155
|
const isPub = this._isPub(tracks);
|
|
18987
|
-
const newPeerC = new RCRTCPeerConnection(pcName, () => this._reTryExchange(pcName, isPub), this._currentUserId, this._polarisReport, this.onTrackTrouble);
|
|
19156
|
+
const newPeerC = new RCRTCPeerConnection(pcName, () => this._reTryExchange(pcName, isPub), this._currentUserId, this._polarisReport, this.onTrackTrouble, this._initOptions);
|
|
18988
19157
|
this._mutilPeerC[pcName] = {
|
|
18989
19158
|
pc: newPeerC,
|
|
18990
19159
|
tracks,
|
|
@@ -19833,13 +20002,15 @@ class ExchangeCommand extends BaseCommand {
|
|
|
19833
20002
|
}
|
|
19834
20003
|
/**
|
|
19835
20004
|
* 自动模式下:
|
|
20005
|
+
* 无 pull_url 字段
|
|
19836
20006
|
* /exchange 完需根据 broadcast 字端判断是否扩散 cdn_uris 数据,设置房间 cdn_uris 数据
|
|
19837
20007
|
*/
|
|
19838
20008
|
const uris = JSON.parse(pullUrl);
|
|
19839
20009
|
store.setCDNUris(uris);
|
|
19840
20010
|
if ((uris === null || uris === void 0 ? void 0 : uris.broadcast) === RCInnerCDNBroadcast.SPREAD) {
|
|
19841
20011
|
store.setCDNEnabel(true);
|
|
19842
|
-
|
|
20012
|
+
const CDNUris = Object.assign(Object.assign({}, uris), { enableInnerCDN: true });
|
|
20013
|
+
setRoomCDNInfo(store.context, store.roomId, CDNUris);
|
|
19843
20014
|
}
|
|
19844
20015
|
return res;
|
|
19845
20016
|
});
|
|
@@ -20692,11 +20863,12 @@ class RetrySignaling {
|
|
|
20692
20863
|
}
|
|
20693
20864
|
}
|
|
20694
20865
|
|
|
20866
|
+
const PUBLISHSIGNALRETRYTIME = 30 * 1000;
|
|
20695
20867
|
/**
|
|
20696
20868
|
* 资源发布命令
|
|
20697
20869
|
*/
|
|
20698
20870
|
class PublishCommand extends BaseCommand {
|
|
20699
|
-
constructor(tracks, pubhook, signalRetryTime) {
|
|
20871
|
+
constructor(tracks, pubhook, signalRetryTime = PUBLISHSIGNALRETRYTIME) {
|
|
20700
20872
|
var _a;
|
|
20701
20873
|
super();
|
|
20702
20874
|
this.tracks = tracks;
|
|
@@ -20887,10 +21059,12 @@ class PublishCommand extends BaseCommand {
|
|
|
20887
21059
|
});
|
|
20888
21060
|
// 计算此次发布的增量资源数据
|
|
20889
21061
|
const { publishedList: plus } = diffPublishResources(oldPublisheList, allPublishList);
|
|
21062
|
+
const CDNUris = Object.assign(Object.assign({}, store.getCDNUris()), { enableInnerCDN: store.getCDNEnable() });
|
|
21063
|
+
const CDNValueInfo = (CDNUris && CDNUris.broadcast === RCInnerCDNBroadcast.SPREAD) ? JSON.stringify([CDNUris]) : '';
|
|
20890
21064
|
// 通知房间成员
|
|
20891
21065
|
// 连通率相关埋点-统计扩散耗时
|
|
20892
21066
|
recordPublishSignalTotalData();
|
|
20893
|
-
let errorCode = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.PUBLISH, plus), buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList));
|
|
21067
|
+
let errorCode = yield store.context.setRTCTotalRes(roomId, buildPlusMessage(RCRTCMessageType.PUBLISH, plus), buildTotalURIMessageContent(allPublishList), RCRTCMessageType.TOTAL_CONTENT_RESOURCE, buildTotalURIMessageContent(crtMcuPublishList), CDNValueInfo);
|
|
20894
21068
|
// TIPS: 通知房间成员失败,对信息进行重试操作
|
|
20895
21069
|
if (errorCode !== ErrorCode.SUCCESS) {
|
|
20896
21070
|
const RetrySignal = RetrySignaling.handler();
|
|
@@ -20994,7 +21168,7 @@ class PublishCommand extends BaseCommand {
|
|
|
20994
21168
|
});
|
|
20995
21169
|
if (!tracks.length) {
|
|
20996
21170
|
(_f = (_e = store.context) === null || _e === void 0 ? void 0 : _e.logger) === null || _f === void 0 ? void 0 : _f.error(RCLoggerTag.L_ABSTRACT_ROOM_PUBLISH_R, JSON.stringify({
|
|
20997
|
-
status: RCLoggerStatus.
|
|
21171
|
+
status: RCLoggerStatus.FAILED,
|
|
20998
21172
|
code: RCRTCCode.PUBLISH_TRACKS_IS_INVALID,
|
|
20999
21173
|
msg: 'params tracks is invalid',
|
|
21000
21174
|
}), this._traceId);
|
|
@@ -21710,11 +21884,25 @@ const RCAbstractRoomEvent = {
|
|
|
21710
21884
|
* 房间抽象基类
|
|
21711
21885
|
*/
|
|
21712
21886
|
class RCAbstractRoom extends EventEmitter {
|
|
21887
|
+
/**
|
|
21888
|
+
* RCRTCRoom 类的构造函数。
|
|
21889
|
+
* @param {RTCContext} _context - RTC上下文,
|
|
21890
|
+
* @param {IRuntime} _runtime - 运行时
|
|
21891
|
+
* @param {string} _roomId - 房间号
|
|
21892
|
+
* @param {RTCMode} _roomMode - RTC模式,
|
|
21893
|
+
* @param {RCMediaService} _service - RCMediaService
|
|
21894
|
+
* @param {IRCRTCInitOptions} _initOptions - IRCRTCInitOptions
|
|
21895
|
+
* @param {boolean} [isUpgrade] - 是否是升级,如果是升级则不会创建新的peerConnection
|
|
21896
|
+
* @param {boolean} [isMainRoom] - 无论是主房间,主房间都是用户创建的房间,子房间是用户创建的房间。
|
|
21897
|
+
* @param {boolean} [_useMutilPeerC] - 是否使用多个 peerConnections
|
|
21898
|
+
* @param {string} _clientSessionId - 客户端会话 ID,用于标识客户端。
|
|
21899
|
+
* @param {number} signalRetryTime - 发送信号的时间间隔。
|
|
21900
|
+
*/
|
|
21713
21901
|
constructor(_context, _runtime, _roomId, _roomMode, _service, _initOptions, isUpgrade, isMainRoom,
|
|
21714
21902
|
/**
|
|
21715
21903
|
* 是否使用多 peerConnection
|
|
21716
21904
|
*/
|
|
21717
|
-
_useMutilPeerC, _clientSessionId = getUUID()) {
|
|
21905
|
+
_useMutilPeerC, _clientSessionId = getUUID(), signalRetryTime = PUBLISHSIGNALRETRYTIME) {
|
|
21718
21906
|
super();
|
|
21719
21907
|
this._context = _context;
|
|
21720
21908
|
this._runtime = _runtime;
|
|
@@ -21723,6 +21911,7 @@ class RCAbstractRoom extends EventEmitter {
|
|
|
21723
21911
|
this._initOptions = _initOptions;
|
|
21724
21912
|
this._useMutilPeerC = _useMutilPeerC;
|
|
21725
21913
|
this._clientSessionId = _clientSessionId;
|
|
21914
|
+
this.signalRetryTime = signalRetryTime;
|
|
21726
21915
|
this._appListener = null;
|
|
21727
21916
|
this._reportListener = null;
|
|
21728
21917
|
/**
|
|
@@ -21730,7 +21919,7 @@ class RCAbstractRoom extends EventEmitter {
|
|
|
21730
21919
|
*/
|
|
21731
21920
|
this._onRecvPKMsg = null;
|
|
21732
21921
|
this._polarisReport = new PolarisHttpReporter(this._context, this._runtime, this._roomId, this);
|
|
21733
|
-
this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._roomId, this._reTryExchange.bind(this), this._context.getCurrentId(), this._polarisReport);
|
|
21922
|
+
this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._roomId, this._reTryExchange.bind(this), this._context.getCurrentId(), this._polarisReport, this._initOptions);
|
|
21734
21923
|
this._invoker = new Invoker(this._context, this._service, this._peerCManager, _roomId, this._context.getCurrentId(), _roomMode, this._polarisReport, isUpgrade, isMainRoom);
|
|
21735
21924
|
this._store = this._invoker.store;
|
|
21736
21925
|
// 注册监听 rtc_ntf 信令数据,收到通知时拉取房间数据
|
|
@@ -22388,7 +22577,7 @@ class RCAbstractRoom extends EventEmitter {
|
|
|
22388
22577
|
*/
|
|
22389
22578
|
publish(tracks) {
|
|
22390
22579
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22391
|
-
return this._invoker.push(new PublishCommand(tracks, this._pubhook.bind(this), this.
|
|
22580
|
+
return this._invoker.push(new PublishCommand(tracks, this._pubhook.bind(this), this.signalRetryTime));
|
|
22392
22581
|
});
|
|
22393
22582
|
}
|
|
22394
22583
|
/**
|
|
@@ -24486,6 +24675,19 @@ class RTCIdentityChangeCommand extends BaseCommand {
|
|
|
24486
24675
|
* 直播房间
|
|
24487
24676
|
*/
|
|
24488
24677
|
class RCLivingRoom extends RCAbstractRoom {
|
|
24678
|
+
/**
|
|
24679
|
+
* 一个构造函数。
|
|
24680
|
+
* @param {RTCContext} context - RTC上下文,
|
|
24681
|
+
* @param {IRuntime} runtime - 运行时
|
|
24682
|
+
* @param {string} roomId - 房间号
|
|
24683
|
+
* @param {RCMediaService} service - RCMediaService
|
|
24684
|
+
* @param {IRCRTCInitOptions} initOptions - IRCRTCInitOptions
|
|
24685
|
+
* @param {RCLivingType} _livingType - RCLivingType.LIVE_ROOM,
|
|
24686
|
+
* @param {boolean} [isUpgrade] - 是否升级房间,如果为真,则表示房间从会议室升级到直播间,会议室关闭。
|
|
24687
|
+
* @param {boolean} [isMainRoom] - 无论是主房间,主房间都是发起呼叫的房间,子房间是接收呼叫的房间。
|
|
24688
|
+
* @param {boolean} [useMutilPeerC] - 是否使用多个 peerConnections
|
|
24689
|
+
* @param {string} [_clientSessionId] - 当前用户的会话 ID。
|
|
24690
|
+
*/
|
|
24489
24691
|
constructor(context, runtime, roomId, service, initOptions, _livingType, isUpgrade, isMainRoom,
|
|
24490
24692
|
/**
|
|
24491
24693
|
* 是否使用多 peerConnection
|
|
@@ -24823,12 +25025,26 @@ class RCLivingRoom extends RCAbstractRoom {
|
|
|
24823
25025
|
* 普通音视频房间
|
|
24824
25026
|
*/
|
|
24825
25027
|
class RCRTCRoom extends RCAbstractRoom {
|
|
25028
|
+
/**
|
|
25029
|
+
* 类的构造函数。
|
|
25030
|
+
* @param {RTCContext} context - RTC上下文
|
|
25031
|
+
* @param {IRuntime} runtime - 运行时
|
|
25032
|
+
* @param {string} roomId - 房间号
|
|
25033
|
+
* @param {RCMediaService} service - RCMediaService
|
|
25034
|
+
* @param {IRCRTCInitOptions} initOptions - IRCRTCInitOptions
|
|
25035
|
+
* @param {boolean} [isUpgrade] - 是否升级房间,默认为false
|
|
25036
|
+
* @param {boolean} [isMainRoom] - 无论是主房间,主房间是用户进入的房间,子房间是用户进入主房间后进入的房间。
|
|
25037
|
+
* @param {boolean} [useMutilPeerC] - 是否使用多个 peerConnections
|
|
25038
|
+
* @param {string} [_clientSessionId] - 当前房间的clientSessionId,用于区分当前房间和其他房间。
|
|
25039
|
+
* @param {RTCMode} roomType - RTCMode = RTCMode.RTC,
|
|
25040
|
+
* @param {number} signalRetryTime - 重新连接信令服务器的时间间隔。
|
|
25041
|
+
*/
|
|
24826
25042
|
constructor(context, runtime, roomId, service, initOptions, isUpgrade, isMainRoom,
|
|
24827
25043
|
/**
|
|
24828
25044
|
* 是否使用多 peerConnection
|
|
24829
25045
|
*/
|
|
24830
|
-
useMutilPeerC, _clientSessionId, roomType = RTCMode.RTC) {
|
|
24831
|
-
super(context, runtime, roomId, roomType, service, initOptions, isUpgrade, isMainRoom, useMutilPeerC, _clientSessionId);
|
|
25046
|
+
useMutilPeerC, _clientSessionId, roomType = RTCMode.RTC, signalRetryTime = PUBLISHSIGNALRETRYTIME) {
|
|
25047
|
+
super(context, runtime, roomId, roomType, service, initOptions, isUpgrade, isMainRoom, useMutilPeerC, _clientSessionId, signalRetryTime);
|
|
24832
25048
|
}
|
|
24833
25049
|
}
|
|
24834
25050
|
|
|
@@ -24906,7 +25122,7 @@ class RCAudienceClient {
|
|
|
24906
25122
|
this._fromRetry = false;
|
|
24907
25123
|
this._appListener = null;
|
|
24908
25124
|
this._service = new RCMediaService(runtime, _context, _initOption.mediaServer);
|
|
24909
|
-
this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._context.getCurrentId(), this._reTryExchange.bind(this), this._context.getCurrentId());
|
|
25125
|
+
this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._context.getCurrentId(), this._reTryExchange.bind(this), this._context.getCurrentId(), undefined, _initOption);
|
|
24910
25126
|
}
|
|
24911
25127
|
_getReqHeaders(livingType) {
|
|
24912
25128
|
var _a, _b;
|
|
@@ -25252,7 +25468,7 @@ class RCAudienceLivingRoom {
|
|
|
25252
25468
|
// 北极星数据
|
|
25253
25469
|
this._polarisReport = new PolarisHttpReporter(this._context, this._runtime, this._roomId, this, PolarisRole.Audience);
|
|
25254
25470
|
this._polarisReport.sendR1();
|
|
25255
|
-
this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._roomId, this._reTryExchange.bind(this), this._context.getCurrentId(), this._polarisReport);
|
|
25471
|
+
this._peerCManager = new RCRTCPeerCManager(this._useMutilPeerC, this._roomId, this._reTryExchange.bind(this), this._context.getCurrentId(), this._polarisReport, this._initOptions);
|
|
25256
25472
|
// 注册监听 rtc_ntf 信令数据,解码后拉取指定房间数据
|
|
25257
25473
|
this._context.registerRTCSignalListener((buffer) => __awaiter(this, void 0, void 0, function* () {
|
|
25258
25474
|
var _a, _b;
|
|
@@ -26797,7 +27013,7 @@ class RCMediaStreamCapture {
|
|
|
26797
27013
|
}));
|
|
26798
27014
|
return { code: RCRTCCode.INVALID_TAGS };
|
|
26799
27015
|
}
|
|
26800
|
-
if (!track || track
|
|
27016
|
+
if (!track || !(track instanceof MediaStreamTrack) || track.kind !== 'video') {
|
|
26801
27017
|
(_d = (_c = this._context) === null || _c === void 0 ? void 0 : _c.logger) === null || _d === void 0 ? void 0 : _d.error(RCLoggerTag.L_RTC_CLIENT_CREATE_LOCAL_VIDEO_TRACK_O, JSON.stringify({
|
|
26802
27018
|
status: RCLoggerStatus.FAILED,
|
|
26803
27019
|
code: RCRTCCode.CREATE_CUSTOM_TRACK_FAILED,
|
|
@@ -27087,11 +27303,7 @@ class RCRTCClient extends RCMediaStreamCapture {
|
|
|
27087
27303
|
}), traceId);
|
|
27088
27304
|
return { code: RCRTCCode.REPERT_JOIN_ROOM };
|
|
27089
27305
|
}
|
|
27090
|
-
|
|
27091
|
-
if (signalRetryTime) {
|
|
27092
|
-
this._options.signalRetryTime = signalRetryTime;
|
|
27093
|
-
}
|
|
27094
|
-
const room = this._crtRoom = new RCRTCRoom(this._context, this._runtime, roomId, this._service, this._options, false, false, useMutilPeerC, getUUID());
|
|
27306
|
+
const room = this._crtRoom = new RCRTCRoom(this._context, this._runtime, roomId, this._service, this._options, false, false, useMutilPeerC, getUUID(), signalRetryTime);
|
|
27095
27307
|
const { code } = yield room.__innerInit(roomType, joinType, undefined, undefined, outerUserDatas, traceId);
|
|
27096
27308
|
if (code !== RCRTCCode.SUCCESS) {
|
|
27097
27309
|
this._crtRoom = null;
|
|
@@ -27538,7 +27750,7 @@ class RCRTCClient extends RCMediaStreamCapture {
|
|
|
27538
27750
|
}
|
|
27539
27751
|
reportSDKInfo() {
|
|
27540
27752
|
this._context.reportSDKInfo({
|
|
27541
|
-
'plugin-rtc': "5.5.5-beem.
|
|
27753
|
+
'plugin-rtc': "5.5.5-beem.4",
|
|
27542
27754
|
});
|
|
27543
27755
|
}
|
|
27544
27756
|
}
|
|
@@ -28003,7 +28215,8 @@ const encodeRtcInput = (codec, roomType, broadcastType, joinType, innerUserDatas
|
|
|
28003
28215
|
};
|
|
28004
28216
|
const decodeRtcUserListOutput = (codec, buffer) => {
|
|
28005
28217
|
const rtcInfos = codec.decode(RTCPB.RtcUserListOutput, buffer);
|
|
28006
|
-
|
|
28218
|
+
// 多端对齐 OfflineKickTime 默认为 60 S (单位为秒)
|
|
28219
|
+
const { users: list, token, sessionId, roomInfo, entries, offlineKickTime = 60, codeFormat, roomCreateTime, userJoinTime, version, } = rtcInfos;
|
|
28007
28220
|
const users = {};
|
|
28008
28221
|
forEach(list, (item) => {
|
|
28009
28222
|
const { userId, userData } = item;
|
|
@@ -28049,7 +28262,7 @@ const encodeRtcHttp3Report = (codec, report, reportType) => {
|
|
|
28049
28262
|
if ((reportType === RCReportType.R3 && r3Info)) {
|
|
28050
28263
|
const { info } = r3Info;
|
|
28051
28264
|
const { streams } = info;
|
|
28052
|
-
let innerStreams = Array.isArray(streams) && streams.map((stream) => codec.encode(RTCPB.RtcPBStreamInfo, stream, true));
|
|
28265
|
+
let innerStreams = Array.isArray(streams) && streams.map((stream) => stream && codec.encode(RTCPB.RtcPBStreamInfo, stream, true));
|
|
28053
28266
|
let innerInfo = codec.encode(RTCPB.RtcPBStatusInfo, Object.assign(Object.assign({}, info), { streams: innerStreams }), true);
|
|
28054
28267
|
let innterR3Info = codec.encode(RTCPB.RtcPBR3Info, { info: innerInfo }, true);
|
|
28055
28268
|
return codec.encode(RTCPB.RtcPBPolaris, Object.assign(Object.assign({}, commonData), { r3Info: innterR3Info }));
|
|
@@ -28057,7 +28270,7 @@ const encodeRtcHttp3Report = (codec, report, reportType) => {
|
|
|
28057
28270
|
if ((reportType === RCReportType.R4 && r4Info)) {
|
|
28058
28271
|
const { info } = r4Info;
|
|
28059
28272
|
const { streams } = info;
|
|
28060
|
-
let innerStreams = Array.isArray(streams) && streams.map((stream) => codec.encode(RTCPB.RtcPBStreamInfo, stream, true));
|
|
28273
|
+
let innerStreams = Array.isArray(streams) && streams.map((stream) => stream && codec.encode(RTCPB.RtcPBStreamInfo, stream, true));
|
|
28061
28274
|
let innerInfo = codec.encode(RTCPB.RtcPBStatusInfo, Object.assign(Object.assign({}, info), { streams: innerStreams }), true);
|
|
28062
28275
|
let innerR4Info = codec.encode(RTCPB.RtcPBR4Info, { info: innerInfo }, true);
|
|
28063
28276
|
return codec.encode(RTCPB.RtcPBPolaris, Object.assign(Object.assign({}, commonData), { r4Info: innerR4Info }));
|
|
@@ -28159,16 +28372,17 @@ class RTCContext {
|
|
|
28159
28372
|
* @param valueInfo 全量资源数据
|
|
28160
28373
|
* @param objectName 全量 URI 消息名
|
|
28161
28374
|
*/
|
|
28162
|
-
setRTCTotalRes(roomId, message, valueInfo, objectName, mcuValInfo
|
|
28375
|
+
setRTCTotalRes(roomId, message, valueInfo, objectName, mcuValInfo, cdnValInfo) {
|
|
28163
28376
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28164
28377
|
const params = {
|
|
28165
28378
|
objectName,
|
|
28166
28379
|
content: this.codec.encode(RTCPB.RtcValueInfo, { key: message.name, value: message.content }, true),
|
|
28167
28380
|
valueInfo: [
|
|
28168
28381
|
this.codec.encode(RTCPB.RtcValueInfo, { key: 'uris', value: valueInfo }, true),
|
|
28169
|
-
this.codec.encode(RTCPB.RtcValueInfo, { key: 'mcu_uris', value: mcuValInfo }, true),
|
|
28170
28382
|
],
|
|
28171
28383
|
};
|
|
28384
|
+
mcuValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'mcu_uris', value: mcuValInfo }, true));
|
|
28385
|
+
cdnValInfo && params.valueInfo.push(this.codec.encode(RTCPB.RtcValueInfo, { key: 'cdn_uris', value: cdnValInfo }, true));
|
|
28172
28386
|
const sourceData = this.codec.encode(RTCPB.RtcUserSetDataInput, params);
|
|
28173
28387
|
const { code } = yield this.context.rtcSignaling(roomId, RTC_API.userSetData, true, sourceData);
|
|
28174
28388
|
return code;
|
|
@@ -28525,22 +28739,22 @@ const installer = {
|
|
|
28525
28739
|
console.error('Please use the https protocol or use `http://localhost` to open the page!');
|
|
28526
28740
|
return false;
|
|
28527
28741
|
}
|
|
28528
|
-
VersionManage.add('plugin-rtc', "5.5.5-beem.
|
|
28529
|
-
if (!VersionManage.validEngine("^5.6.
|
|
28530
|
-
console.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.
|
|
28742
|
+
VersionManage.add('plugin-rtc', "5.5.5-beem.4");
|
|
28743
|
+
if (!VersionManage.validEngine("^5.6.0")) {
|
|
28744
|
+
console.error(`The current engine version '${VersionManage.getInfo().engine}' error, plugin-rtc required engine version at least '${"^5.6.0"}'.`);
|
|
28531
28745
|
return false;
|
|
28532
28746
|
}
|
|
28533
28747
|
return true;
|
|
28534
28748
|
},
|
|
28535
|
-
setup(context, runtime, options = {
|
|
28749
|
+
setup(context, runtime, options = {}) {
|
|
28536
28750
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
28537
28751
|
const originLogger = context.createLogger('RCRTC', LogSource.RTC);
|
|
28538
28752
|
originLogger.setOutputLevel(options.logLevel || LogL.DEBUG);
|
|
28539
28753
|
RTCLogger.setLogger(originLogger);
|
|
28540
28754
|
logger.setLogger(originLogger);
|
|
28541
28755
|
originLogger.warn(RCLoggerTag.L_INDEX_INSTALL_RTC_PLUGIN_O, JSON.stringify({
|
|
28542
|
-
'RCRTC Version': "5.5.5-beem.
|
|
28543
|
-
Commit: "
|
|
28756
|
+
'RCRTC Version': "5.5.5-beem.4",
|
|
28757
|
+
Commit: "1c464fa58c20897be94d3d50ee25c52729284323",
|
|
28544
28758
|
'browserInfo.browser': browserInfo.browser,
|
|
28545
28759
|
'browserInfo.supportsUnifiedPlan': browserInfo.supportsUnifiedPlan,
|
|
28546
28760
|
'browserInfo.version': browserInfo.version,
|