@unwanted/matrix-sdk-mini 34.12.0-1 → 34.12.0-2

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.
Files changed (185) hide show
  1. package/git-revision.txt +1 -1
  2. package/lib/@types/event.d.ts +0 -19
  3. package/lib/@types/event.d.ts.map +1 -1
  4. package/lib/@types/event.js.map +1 -1
  5. package/lib/client.d.ts +2 -50
  6. package/lib/client.d.ts.map +1 -1
  7. package/lib/client.js +391 -501
  8. package/lib/client.js.map +1 -1
  9. package/lib/embedded.d.ts.map +1 -1
  10. package/lib/embedded.js +0 -1
  11. package/lib/embedded.js.map +1 -1
  12. package/lib/matrix.d.ts +0 -6
  13. package/lib/matrix.d.ts.map +1 -1
  14. package/lib/matrix.js +1 -5
  15. package/lib/matrix.js.map +1 -1
  16. package/package.json +1 -1
  17. package/src/@types/event.ts +2 -36
  18. package/src/client.ts +1 -150
  19. package/src/embedded.ts +0 -2
  20. package/src/matrix.ts +0 -13
  21. package/lib/matrixrtc/CallMembership.d.ts +0 -66
  22. package/lib/matrixrtc/CallMembership.d.ts.map +0 -1
  23. package/lib/matrixrtc/CallMembership.js +0 -197
  24. package/lib/matrixrtc/CallMembership.js.map +0 -1
  25. package/lib/matrixrtc/LivekitFocus.d.ts +0 -16
  26. package/lib/matrixrtc/LivekitFocus.d.ts.map +0 -1
  27. package/lib/matrixrtc/LivekitFocus.js +0 -20
  28. package/lib/matrixrtc/LivekitFocus.js.map +0 -1
  29. package/lib/matrixrtc/MatrixRTCSession.d.ts +0 -295
  30. package/lib/matrixrtc/MatrixRTCSession.d.ts.map +0 -1
  31. package/lib/matrixrtc/MatrixRTCSession.js +0 -1043
  32. package/lib/matrixrtc/MatrixRTCSession.js.map +0 -1
  33. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts +0 -40
  34. package/lib/matrixrtc/MatrixRTCSessionManager.d.ts.map +0 -1
  35. package/lib/matrixrtc/MatrixRTCSessionManager.js +0 -146
  36. package/lib/matrixrtc/MatrixRTCSessionManager.js.map +0 -1
  37. package/lib/matrixrtc/focus.d.ts +0 -10
  38. package/lib/matrixrtc/focus.d.ts.map +0 -1
  39. package/lib/matrixrtc/focus.js +0 -1
  40. package/lib/matrixrtc/focus.js.map +0 -1
  41. package/lib/matrixrtc/index.d.ts +0 -7
  42. package/lib/matrixrtc/index.d.ts.map +0 -1
  43. package/lib/matrixrtc/index.js +0 -21
  44. package/lib/matrixrtc/index.js.map +0 -1
  45. package/lib/matrixrtc/types.d.ts +0 -19
  46. package/lib/matrixrtc/types.d.ts.map +0 -1
  47. package/lib/matrixrtc/types.js +0 -1
  48. package/lib/matrixrtc/types.js.map +0 -1
  49. package/lib/webrtc/audioContext.d.ts +0 -15
  50. package/lib/webrtc/audioContext.d.ts.map +0 -1
  51. package/lib/webrtc/audioContext.js +0 -46
  52. package/lib/webrtc/audioContext.js.map +0 -1
  53. package/lib/webrtc/call.d.ts +0 -560
  54. package/lib/webrtc/call.d.ts.map +0 -1
  55. package/lib/webrtc/call.js +0 -2541
  56. package/lib/webrtc/call.js.map +0 -1
  57. package/lib/webrtc/callEventHandler.d.ts +0 -37
  58. package/lib/webrtc/callEventHandler.d.ts.map +0 -1
  59. package/lib/webrtc/callEventHandler.js +0 -344
  60. package/lib/webrtc/callEventHandler.js.map +0 -1
  61. package/lib/webrtc/callEventTypes.d.ts +0 -73
  62. package/lib/webrtc/callEventTypes.d.ts.map +0 -1
  63. package/lib/webrtc/callEventTypes.js +0 -13
  64. package/lib/webrtc/callEventTypes.js.map +0 -1
  65. package/lib/webrtc/callFeed.d.ts +0 -128
  66. package/lib/webrtc/callFeed.d.ts.map +0 -1
  67. package/lib/webrtc/callFeed.js +0 -289
  68. package/lib/webrtc/callFeed.js.map +0 -1
  69. package/lib/webrtc/groupCall.d.ts +0 -323
  70. package/lib/webrtc/groupCall.d.ts.map +0 -1
  71. package/lib/webrtc/groupCall.js +0 -1337
  72. package/lib/webrtc/groupCall.js.map +0 -1
  73. package/lib/webrtc/groupCallEventHandler.d.ts +0 -31
  74. package/lib/webrtc/groupCallEventHandler.d.ts.map +0 -1
  75. package/lib/webrtc/groupCallEventHandler.js +0 -178
  76. package/lib/webrtc/groupCallEventHandler.js.map +0 -1
  77. package/lib/webrtc/mediaHandler.d.ts +0 -89
  78. package/lib/webrtc/mediaHandler.d.ts.map +0 -1
  79. package/lib/webrtc/mediaHandler.js +0 -437
  80. package/lib/webrtc/mediaHandler.js.map +0 -1
  81. package/lib/webrtc/stats/callFeedStatsReporter.d.ts +0 -8
  82. package/lib/webrtc/stats/callFeedStatsReporter.d.ts.map +0 -1
  83. package/lib/webrtc/stats/callFeedStatsReporter.js +0 -82
  84. package/lib/webrtc/stats/callFeedStatsReporter.js.map +0 -1
  85. package/lib/webrtc/stats/callStatsReportGatherer.d.ts +0 -25
  86. package/lib/webrtc/stats/callStatsReportGatherer.d.ts.map +0 -1
  87. package/lib/webrtc/stats/callStatsReportGatherer.js +0 -199
  88. package/lib/webrtc/stats/callStatsReportGatherer.js.map +0 -1
  89. package/lib/webrtc/stats/callStatsReportSummary.d.ts +0 -17
  90. package/lib/webrtc/stats/callStatsReportSummary.d.ts.map +0 -1
  91. package/lib/webrtc/stats/callStatsReportSummary.js +0 -1
  92. package/lib/webrtc/stats/callStatsReportSummary.js.map +0 -1
  93. package/lib/webrtc/stats/connectionStats.d.ts +0 -28
  94. package/lib/webrtc/stats/connectionStats.d.ts.map +0 -1
  95. package/lib/webrtc/stats/connectionStats.js +0 -26
  96. package/lib/webrtc/stats/connectionStats.js.map +0 -1
  97. package/lib/webrtc/stats/connectionStatsBuilder.d.ts +0 -5
  98. package/lib/webrtc/stats/connectionStatsBuilder.d.ts.map +0 -1
  99. package/lib/webrtc/stats/connectionStatsBuilder.js +0 -27
  100. package/lib/webrtc/stats/connectionStatsBuilder.js.map +0 -1
  101. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts +0 -7
  102. package/lib/webrtc/stats/connectionStatsReportBuilder.d.ts.map +0 -1
  103. package/lib/webrtc/stats/connectionStatsReportBuilder.js +0 -121
  104. package/lib/webrtc/stats/connectionStatsReportBuilder.js.map +0 -1
  105. package/lib/webrtc/stats/groupCallStats.d.ts +0 -22
  106. package/lib/webrtc/stats/groupCallStats.d.ts.map +0 -1
  107. package/lib/webrtc/stats/groupCallStats.js +0 -78
  108. package/lib/webrtc/stats/groupCallStats.js.map +0 -1
  109. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts +0 -10
  110. package/lib/webrtc/stats/media/mediaSsrcHandler.d.ts.map +0 -1
  111. package/lib/webrtc/stats/media/mediaSsrcHandler.js +0 -57
  112. package/lib/webrtc/stats/media/mediaSsrcHandler.js.map +0 -1
  113. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts +0 -12
  114. package/lib/webrtc/stats/media/mediaTrackHandler.d.ts.map +0 -1
  115. package/lib/webrtc/stats/media/mediaTrackHandler.js +0 -62
  116. package/lib/webrtc/stats/media/mediaTrackHandler.js.map +0 -1
  117. package/lib/webrtc/stats/media/mediaTrackStats.d.ts +0 -86
  118. package/lib/webrtc/stats/media/mediaTrackStats.d.ts.map +0 -1
  119. package/lib/webrtc/stats/media/mediaTrackStats.js +0 -142
  120. package/lib/webrtc/stats/media/mediaTrackStats.js.map +0 -1
  121. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts +0 -22
  122. package/lib/webrtc/stats/media/mediaTrackStatsHandler.d.ts.map +0 -1
  123. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js +0 -76
  124. package/lib/webrtc/stats/media/mediaTrackStatsHandler.js.map +0 -1
  125. package/lib/webrtc/stats/statsReport.d.ts +0 -99
  126. package/lib/webrtc/stats/statsReport.d.ts.map +0 -1
  127. package/lib/webrtc/stats/statsReport.js +0 -32
  128. package/lib/webrtc/stats/statsReport.js.map +0 -1
  129. package/lib/webrtc/stats/statsReportEmitter.d.ts +0 -15
  130. package/lib/webrtc/stats/statsReportEmitter.d.ts.map +0 -1
  131. package/lib/webrtc/stats/statsReportEmitter.js +0 -33
  132. package/lib/webrtc/stats/statsReportEmitter.js.map +0 -1
  133. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts +0 -16
  134. package/lib/webrtc/stats/summaryStatsReportGatherer.d.ts.map +0 -1
  135. package/lib/webrtc/stats/summaryStatsReportGatherer.js +0 -116
  136. package/lib/webrtc/stats/summaryStatsReportGatherer.js.map +0 -1
  137. package/lib/webrtc/stats/trackStatsBuilder.d.ts +0 -19
  138. package/lib/webrtc/stats/trackStatsBuilder.d.ts.map +0 -1
  139. package/lib/webrtc/stats/trackStatsBuilder.js +0 -168
  140. package/lib/webrtc/stats/trackStatsBuilder.js.map +0 -1
  141. package/lib/webrtc/stats/transportStats.d.ts +0 -11
  142. package/lib/webrtc/stats/transportStats.d.ts.map +0 -1
  143. package/lib/webrtc/stats/transportStats.js +0 -1
  144. package/lib/webrtc/stats/transportStats.js.map +0 -1
  145. package/lib/webrtc/stats/transportStatsBuilder.d.ts +0 -5
  146. package/lib/webrtc/stats/transportStatsBuilder.d.ts.map +0 -1
  147. package/lib/webrtc/stats/transportStatsBuilder.js +0 -34
  148. package/lib/webrtc/stats/transportStatsBuilder.js.map +0 -1
  149. package/lib/webrtc/stats/valueFormatter.d.ts +0 -4
  150. package/lib/webrtc/stats/valueFormatter.d.ts.map +0 -1
  151. package/lib/webrtc/stats/valueFormatter.js +0 -25
  152. package/lib/webrtc/stats/valueFormatter.js.map +0 -1
  153. package/src/matrixrtc/CallMembership.ts +0 -247
  154. package/src/matrixrtc/LivekitFocus.ts +0 -39
  155. package/src/matrixrtc/MatrixRTCSession.ts +0 -1319
  156. package/src/matrixrtc/MatrixRTCSessionManager.ts +0 -166
  157. package/src/matrixrtc/focus.ts +0 -25
  158. package/src/matrixrtc/index.ts +0 -22
  159. package/src/matrixrtc/types.ts +0 -36
  160. package/src/webrtc/audioContext.ts +0 -44
  161. package/src/webrtc/call.ts +0 -3074
  162. package/src/webrtc/callEventHandler.ts +0 -425
  163. package/src/webrtc/callEventTypes.ts +0 -93
  164. package/src/webrtc/callFeed.ts +0 -364
  165. package/src/webrtc/groupCall.ts +0 -1735
  166. package/src/webrtc/groupCallEventHandler.ts +0 -234
  167. package/src/webrtc/mediaHandler.ts +0 -484
  168. package/src/webrtc/stats/callFeedStatsReporter.ts +0 -94
  169. package/src/webrtc/stats/callStatsReportGatherer.ts +0 -219
  170. package/src/webrtc/stats/callStatsReportSummary.ts +0 -30
  171. package/src/webrtc/stats/connectionStats.ts +0 -47
  172. package/src/webrtc/stats/connectionStatsBuilder.ts +0 -28
  173. package/src/webrtc/stats/connectionStatsReportBuilder.ts +0 -140
  174. package/src/webrtc/stats/groupCallStats.ts +0 -93
  175. package/src/webrtc/stats/media/mediaSsrcHandler.ts +0 -57
  176. package/src/webrtc/stats/media/mediaTrackHandler.ts +0 -76
  177. package/src/webrtc/stats/media/mediaTrackStats.ts +0 -176
  178. package/src/webrtc/stats/media/mediaTrackStatsHandler.ts +0 -90
  179. package/src/webrtc/stats/statsReport.ts +0 -133
  180. package/src/webrtc/stats/statsReportEmitter.ts +0 -49
  181. package/src/webrtc/stats/summaryStatsReportGatherer.ts +0 -148
  182. package/src/webrtc/stats/trackStatsBuilder.ts +0 -207
  183. package/src/webrtc/stats/transportStats.ts +0 -26
  184. package/src/webrtc/stats/transportStatsBuilder.ts +0 -48
  185. package/src/webrtc/stats/valueFormatter.ts +0 -27
@@ -1,207 +0,0 @@
1
- import { MediaTrackStats } from "./media/mediaTrackStats.ts";
2
- import { ValueFormatter } from "./valueFormatter.ts";
3
- import { TrackSummary } from "./callStatsReportSummary.ts";
4
-
5
- export class TrackStatsBuilder {
6
- public static buildFramerateResolution(trackStats: MediaTrackStats, now: any): void {
7
- const resolution = {
8
- height: now.frameHeight,
9
- width: now.frameWidth,
10
- };
11
- const frameRate = now.framesPerSecond;
12
-
13
- if (resolution.height && resolution.width) {
14
- trackStats.setResolution(resolution);
15
- }
16
- trackStats.setFramerate(Math.round(frameRate || 0));
17
- }
18
-
19
- public static calculateSimulcastFramerate(trackStats: MediaTrackStats, now: any, before: any, layer: number): void {
20
- let frameRate = trackStats.getFramerate();
21
- if (!frameRate) {
22
- if (before) {
23
- const timeMs = now.timestamp - before.timestamp;
24
-
25
- if (timeMs > 0 && now.framesSent) {
26
- const numberOfFramesSinceBefore = now.framesSent - before.framesSent;
27
-
28
- frameRate = (numberOfFramesSinceBefore / timeMs) * 1000;
29
- }
30
- }
31
-
32
- if (!frameRate) {
33
- return;
34
- }
35
- }
36
-
37
- // Reset frame rate to 0 when video is suspended as a result of endpoint falling out of last-n.
38
- frameRate = layer ? Math.round(frameRate / layer) : 0;
39
- trackStats.setFramerate(frameRate);
40
- }
41
-
42
- public static buildCodec(report: RTCStatsReport | undefined, trackStats: MediaTrackStats, now: any): void {
43
- const codec = report?.get(now.codecId);
44
-
45
- if (codec) {
46
- /**
47
- * The mime type has the following form: video/VP8 or audio/ISAC,
48
- * so we what to keep just the type after the '/', audio and video
49
- * keys will be added on the processing side.
50
- */
51
- const codecShortType = codec.mimeType.split("/")[1];
52
-
53
- if (codecShortType) trackStats.setCodec(codecShortType);
54
- }
55
- }
56
-
57
- public static buildBitrateReceived(trackStats: MediaTrackStats, now: any, before: any): void {
58
- trackStats.setBitrate({
59
- download: TrackStatsBuilder.calculateBitrate(
60
- now.bytesReceived,
61
- before.bytesReceived,
62
- now.timestamp,
63
- before.timestamp,
64
- ),
65
- upload: 0,
66
- });
67
- }
68
-
69
- public static buildBitrateSend(trackStats: MediaTrackStats, now: any, before: any): void {
70
- trackStats.setBitrate({
71
- download: 0,
72
- upload: this.calculateBitrate(now.bytesSent, before.bytesSent, now.timestamp, before.timestamp),
73
- });
74
- }
75
-
76
- public static buildPacketsLost(trackStats: MediaTrackStats, now: any, before: any): void {
77
- const key = now.type === "outbound-rtp" ? "packetsSent" : "packetsReceived";
78
-
79
- let packetsNow = now[key];
80
- if (!packetsNow || packetsNow < 0) {
81
- packetsNow = 0;
82
- }
83
-
84
- const packetsBefore = ValueFormatter.getNonNegativeValue(before[key]);
85
- const packetsDiff = Math.max(0, packetsNow - packetsBefore);
86
-
87
- const packetsLostNow = ValueFormatter.getNonNegativeValue(now.packetsLost);
88
- const packetsLostBefore = ValueFormatter.getNonNegativeValue(before.packetsLost);
89
- const packetsLostDiff = Math.max(0, packetsLostNow - packetsLostBefore);
90
-
91
- trackStats.setLoss({
92
- packetsTotal: packetsDiff + packetsLostDiff,
93
- packetsLost: packetsLostDiff,
94
- isDownloadStream: now.type !== "outbound-rtp",
95
- });
96
- }
97
-
98
- private static calculateBitrate(
99
- bytesNowAny: any,
100
- bytesBeforeAny: any,
101
- nowTimestamp: number,
102
- beforeTimestamp: number,
103
- ): number {
104
- const bytesNow = ValueFormatter.getNonNegativeValue(bytesNowAny);
105
- const bytesBefore = ValueFormatter.getNonNegativeValue(bytesBeforeAny);
106
- const bytesProcessed = Math.max(0, bytesNow - bytesBefore);
107
-
108
- const timeMs = nowTimestamp - beforeTimestamp;
109
- let bitrateKbps = 0;
110
-
111
- if (timeMs > 0) {
112
- bitrateKbps = Math.round((bytesProcessed * 8) / timeMs);
113
- }
114
-
115
- return bitrateKbps;
116
- }
117
-
118
- public static setTrackStatsState(trackStats: MediaTrackStats, transceiver: RTCRtpTransceiver | undefined): void {
119
- if (transceiver === undefined) {
120
- trackStats.alive = false;
121
- return;
122
- }
123
-
124
- const track = trackStats.getType() === "remote" ? transceiver.receiver.track : transceiver?.sender?.track;
125
- if (track === undefined || track === null) {
126
- trackStats.alive = false;
127
- return;
128
- }
129
-
130
- if (track.readyState === "ended") {
131
- trackStats.alive = false;
132
- return;
133
- }
134
- trackStats.muted = track.muted;
135
- trackStats.enabled = track.enabled;
136
- trackStats.alive = true;
137
- }
138
-
139
- public static buildTrackSummary(trackStatsList: MediaTrackStats[]): {
140
- audioTrackSummary: TrackSummary;
141
- videoTrackSummary: TrackSummary;
142
- } {
143
- const videoTrackSummary: TrackSummary = {
144
- count: 0,
145
- muted: 0,
146
- maxJitter: 0,
147
- maxPacketLoss: 0,
148
- concealedAudio: 0,
149
- totalAudio: 0,
150
- };
151
- const audioTrackSummary: TrackSummary = {
152
- count: 0,
153
- muted: 0,
154
- maxJitter: 0,
155
- maxPacketLoss: 0,
156
- concealedAudio: 0,
157
- totalAudio: 0,
158
- };
159
-
160
- const remoteTrackList = trackStatsList.filter((t) => t.getType() === "remote");
161
- const audioTrackList = remoteTrackList.filter((t) => t.kind === "audio");
162
-
163
- remoteTrackList.forEach((stats) => {
164
- const trackSummary = stats.kind === "video" ? videoTrackSummary : audioTrackSummary;
165
- trackSummary.count++;
166
- if (stats.alive && stats.muted) {
167
- trackSummary.muted++;
168
- }
169
- if (trackSummary.maxJitter < stats.getJitter()) {
170
- trackSummary.maxJitter = stats.getJitter();
171
- }
172
- if (trackSummary.maxPacketLoss < stats.getLoss().packetsLost) {
173
- trackSummary.maxPacketLoss = stats.getLoss().packetsLost;
174
- }
175
- if (audioTrackList.length > 0) {
176
- trackSummary.concealedAudio += stats.getAudioConcealment()?.concealedAudio;
177
- trackSummary.totalAudio += stats.getAudioConcealment()?.totalAudioDuration;
178
- }
179
- });
180
-
181
- return { audioTrackSummary, videoTrackSummary };
182
- }
183
-
184
- public static buildJitter(trackStats: MediaTrackStats, statsReport: any): void {
185
- if (statsReport.type !== "inbound-rtp") {
186
- return;
187
- }
188
-
189
- const jitterStr = statsReport?.jitter;
190
- if (jitterStr !== undefined) {
191
- const jitter = ValueFormatter.getNonNegativeValue(jitterStr);
192
- trackStats.setJitter(Math.round(jitter * 1000));
193
- } else {
194
- trackStats.setJitter(-1);
195
- }
196
- }
197
-
198
- public static buildAudioConcealment(trackStats: MediaTrackStats, statsReport: any): void {
199
- if (statsReport.type !== "inbound-rtp") {
200
- return;
201
- }
202
- const msPerSample = (1000 * statsReport?.totalSamplesDuration) / statsReport?.totalSamplesReceived;
203
- const concealedAudioDuration = msPerSample * statsReport?.concealedSamples;
204
- const totalAudioDuration = 1000 * statsReport?.totalSamplesDuration;
205
- trackStats.setAudioConcealment(concealedAudioDuration, totalAudioDuration);
206
- }
207
- }
@@ -1,26 +0,0 @@
1
- /*
2
- Copyright 2023 The Matrix.org Foundation C.I.C.
3
-
4
- Licensed under the Apache License, Version 2.0 (the "License");
5
- you may not use this file except in compliance with the License.
6
- You may obtain a copy of the License at
7
-
8
- http://www.apache.org/licenses/LICENSE-2.0
9
-
10
- Unless required by applicable law or agreed to in writing, software
11
- distributed under the License is distributed on an "AS IS" BASIS,
12
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- See the License for the specific language governing permissions and
14
- limitations under the License.
15
- */
16
-
17
- export interface TransportStats {
18
- ip: string;
19
- type: string;
20
- localIp: string;
21
- isFocus: boolean;
22
- localCandidateType: string;
23
- remoteCandidateType: string;
24
- networkType: string;
25
- rtt: number;
26
- }
@@ -1,48 +0,0 @@
1
- import { TransportStats } from "./transportStats.ts";
2
-
3
- export class TransportStatsBuilder {
4
- public static buildReport(
5
- report: RTCStatsReport | undefined,
6
- now: RTCIceCandidatePairStats,
7
- conferenceStatsTransport: TransportStats[],
8
- isFocus: boolean,
9
- ): TransportStats[] {
10
- const localUsedCandidate = report?.get(now.localCandidateId);
11
- const remoteUsedCandidate = report?.get(now.remoteCandidateId);
12
-
13
- // RTCIceCandidateStats
14
- // https://w3c.github.io/webrtc-stats/#icecandidate-dict*
15
- if (remoteUsedCandidate && localUsedCandidate) {
16
- const remoteIpAddress =
17
- remoteUsedCandidate.ip !== undefined ? remoteUsedCandidate.ip : remoteUsedCandidate.address;
18
- const remotePort = remoteUsedCandidate.port;
19
- const ip = `${remoteIpAddress}:${remotePort}`;
20
-
21
- const localIpAddress =
22
- localUsedCandidate.ip !== undefined ? localUsedCandidate.ip : localUsedCandidate.address;
23
- const localPort = localUsedCandidate.port;
24
- const localIp = `${localIpAddress}:${localPort}`;
25
-
26
- const type = remoteUsedCandidate.protocol;
27
-
28
- // Save the address unless it has been saved already.
29
- if (
30
- !conferenceStatsTransport.some(
31
- (t: TransportStats) => t.ip === ip && t.type === type && t.localIp === localIp,
32
- )
33
- ) {
34
- conferenceStatsTransport.push({
35
- ip,
36
- type,
37
- localIp,
38
- isFocus,
39
- localCandidateType: localUsedCandidate.candidateType,
40
- remoteCandidateType: remoteUsedCandidate.candidateType,
41
- networkType: localUsedCandidate.networkType,
42
- rtt: now.currentRoundTripTime ? now.currentRoundTripTime * 1000 : NaN,
43
- } as TransportStats);
44
- }
45
- }
46
- return conferenceStatsTransport;
47
- }
48
- }
@@ -1,27 +0,0 @@
1
- /*
2
- Copyright 2023 The Matrix.org Foundation C.I.C.
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
12
- */
13
- export class ValueFormatter {
14
- public static getNonNegativeValue(imput: any): number {
15
- let value = imput;
16
-
17
- if (typeof value !== "number") {
18
- value = Number(value);
19
- }
20
-
21
- if (isNaN(value)) {
22
- return 0;
23
- }
24
-
25
- return Math.max(0, value);
26
- }
27
- }