@epicgames-ps/lib-pixelstreamingfrontend-ue5.5 0.3.0 → 0.3.1
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/commonjs/AFK/AFKController.js +109 -109
- package/dist/commonjs/Config/Config.js +559 -559
- package/dist/commonjs/Config/SettingBase.js +98 -98
- package/dist/commonjs/Config/SettingFlag.js +49 -49
- package/dist/commonjs/Config/SettingNumber.js +83 -83
- package/dist/commonjs/Config/SettingOption.js +84 -84
- package/dist/commonjs/Config/SettingText.js +42 -42
- package/dist/commonjs/DataChannel/DataChannelController.js +106 -106
- package/dist/commonjs/DataChannel/DataChannelLatencyTestController.js +94 -94
- package/dist/commonjs/DataChannel/DataChannelLatencyTestResults.js +18 -18
- package/dist/commonjs/DataChannel/DataChannelSender.js +43 -43
- package/dist/commonjs/DataChannel/InitialSettings.js +41 -41
- package/dist/commonjs/DataChannel/LatencyTestResults.js +60 -60
- package/dist/commonjs/FreezeFrame/FreezeFrame.js +93 -93
- package/dist/commonjs/FreezeFrame/FreezeFrameController.js +95 -95
- package/dist/commonjs/Inputs/GamepadController.js +188 -188
- package/dist/commonjs/Inputs/GamepadTypes.js +21 -21
- package/dist/commonjs/Inputs/IInputController.js +2 -2
- package/dist/commonjs/Inputs/InputClassesFactory.js +96 -96
- package/dist/commonjs/Inputs/KeyCodes.js +112 -112
- package/dist/commonjs/Inputs/KeyboardController.js +137 -137
- package/dist/commonjs/Inputs/MouseButtons.js +28 -28
- package/dist/commonjs/Inputs/MouseController.js +97 -97
- package/dist/commonjs/Inputs/MouseControllerHovering.js +93 -93
- package/dist/commonjs/Inputs/MouseControllerLocked.js +153 -153
- package/dist/commonjs/Inputs/SpecialKeyCodes.js +19 -19
- package/dist/commonjs/Inputs/TouchController.js +123 -123
- package/dist/commonjs/Inputs/TouchControllerFake.js +91 -91
- package/dist/commonjs/Inputs/XRGamepadController.js +124 -124
- package/dist/commonjs/PeerConnectionController/AggregatedStats.js +252 -252
- package/dist/commonjs/PeerConnectionController/CandidatePairStats.js +10 -10
- package/dist/commonjs/PeerConnectionController/CandidateStat.js +10 -10
- package/dist/commonjs/PeerConnectionController/CodecStats.js +10 -10
- package/dist/commonjs/PeerConnectionController/DataChannelStats.js +10 -10
- package/dist/commonjs/PeerConnectionController/InboundRTPStats.js +22 -22
- package/dist/commonjs/PeerConnectionController/InboundTrackStats.js +10 -10
- package/dist/commonjs/PeerConnectionController/OutBoundRTPStats.js +16 -16
- package/dist/commonjs/PeerConnectionController/PeerConnectionController.js +584 -584
- package/dist/commonjs/PeerConnectionController/SessionStats.js +10 -10
- package/dist/commonjs/PeerConnectionController/StreamStats.js +10 -10
- package/dist/commonjs/PixelStreaming/PixelStreaming.js +607 -607
- package/dist/commonjs/UI/OnScreenKeyboard.js +82 -82
- package/dist/commonjs/UeInstanceMessage/ResponseController.js +38 -38
- package/dist/commonjs/UeInstanceMessage/SendMessageController.js +120 -120
- package/dist/commonjs/UeInstanceMessage/StreamMessageController.js +210 -210
- package/dist/commonjs/UeInstanceMessage/ToStreamerMessagesController.js +49 -49
- package/dist/commonjs/Util/EventEmitter.js +386 -386
- package/dist/commonjs/Util/FileUtil.js +108 -108
- package/dist/commonjs/Util/IURLSearchParams.js +25 -25
- package/dist/commonjs/Util/InputCoordTranslator.js +49 -49
- package/dist/commonjs/Util/RTCUtils.js +40 -40
- package/dist/commonjs/VideoPlayer/StreamController.js +67 -67
- package/dist/commonjs/VideoPlayer/VideoPlayer.js +177 -177
- package/dist/commonjs/WebRtcPlayer/WebRtcPlayerController.js +1221 -1221
- package/dist/commonjs/WebXR/WebXRController.js +335 -335
- package/dist/commonjs/pixelstreamingfrontend.js +70 -70
- package/dist/esm/AFK/AFKController.js +105 -105
- package/dist/esm/Config/Config.js +551 -551
- package/dist/esm/Config/SettingBase.js +94 -94
- package/dist/esm/Config/SettingFlag.js +45 -45
- package/dist/esm/Config/SettingNumber.js +79 -79
- package/dist/esm/Config/SettingOption.js +80 -80
- package/dist/esm/Config/SettingText.js +38 -38
- package/dist/esm/DataChannel/DataChannelController.js +102 -102
- package/dist/esm/DataChannel/DataChannelLatencyTestController.js +90 -90
- package/dist/esm/DataChannel/DataChannelLatencyTestResults.js +14 -14
- package/dist/esm/DataChannel/DataChannelSender.js +39 -39
- package/dist/esm/DataChannel/InitialSettings.js +34 -34
- package/dist/esm/DataChannel/LatencyTestResults.js +56 -56
- package/dist/esm/FreezeFrame/FreezeFrame.js +89 -89
- package/dist/esm/FreezeFrame/FreezeFrameController.js +91 -91
- package/dist/esm/Inputs/GamepadController.js +184 -184
- package/dist/esm/Inputs/GamepadTypes.js +17 -17
- package/dist/esm/Inputs/IInputController.js +1 -1
- package/dist/esm/Inputs/InputClassesFactory.js +91 -91
- package/dist/esm/Inputs/KeyCodes.js +109 -109
- package/dist/esm/Inputs/KeyboardController.js +133 -133
- package/dist/esm/Inputs/MouseButtons.js +23 -23
- package/dist/esm/Inputs/MouseController.js +93 -93
- package/dist/esm/Inputs/MouseControllerHovering.js +89 -89
- package/dist/esm/Inputs/MouseControllerLocked.js +149 -149
- package/dist/esm/Inputs/SpecialKeyCodes.js +15 -15
- package/dist/esm/Inputs/TouchController.js +119 -119
- package/dist/esm/Inputs/TouchControllerFake.js +87 -87
- package/dist/esm/Inputs/XRGamepadController.js +120 -120
- package/dist/esm/PeerConnectionController/AggregatedStats.js +248 -248
- package/dist/esm/PeerConnectionController/CandidatePairStats.js +6 -6
- package/dist/esm/PeerConnectionController/CandidateStat.js +6 -6
- package/dist/esm/PeerConnectionController/CodecStats.js +6 -6
- package/dist/esm/PeerConnectionController/DataChannelStats.js +6 -6
- package/dist/esm/PeerConnectionController/InboundRTPStats.js +16 -16
- package/dist/esm/PeerConnectionController/InboundTrackStats.js +6 -6
- package/dist/esm/PeerConnectionController/OutBoundRTPStats.js +11 -11
- package/dist/esm/PeerConnectionController/PeerConnectionController.js +580 -580
- package/dist/esm/PeerConnectionController/SessionStats.js +6 -6
- package/dist/esm/PeerConnectionController/StreamStats.js +6 -6
- package/dist/esm/PixelStreaming/PixelStreaming.js +603 -603
- package/dist/esm/UI/OnScreenKeyboard.js +78 -78
- package/dist/esm/UeInstanceMessage/ResponseController.js +34 -34
- package/dist/esm/UeInstanceMessage/SendMessageController.js +116 -116
- package/dist/esm/UeInstanceMessage/StreamMessageController.js +205 -205
- package/dist/esm/UeInstanceMessage/ToStreamerMessagesController.js +45 -45
- package/dist/esm/Util/EventEmitter.js +345 -345
- package/dist/esm/Util/FileUtil.js +103 -103
- package/dist/esm/Util/IURLSearchParams.js +21 -21
- package/dist/esm/Util/InputCoordTranslator.js +45 -45
- package/dist/esm/Util/RTCUtils.js +36 -36
- package/dist/esm/VideoPlayer/StreamController.js +63 -63
- package/dist/esm/VideoPlayer/VideoPlayer.js +173 -173
- package/dist/esm/WebRtcPlayer/WebRtcPlayerController.js +1217 -1217
- package/dist/esm/WebXR/WebXRController.js +331 -331
- package/dist/esm/pixelstreamingfrontend.js +24 -24
- package/dist/types/AFK/AFKController.d.ts +38 -38
- package/dist/types/Config/Config.d.ts +220 -220
- package/dist/types/Config/SettingBase.d.ts +43 -43
- package/dist/types/Config/SettingFlag.d.ts +24 -24
- package/dist/types/Config/SettingNumber.d.ts +41 -41
- package/dist/types/Config/SettingOption.d.ts +41 -41
- package/dist/types/Config/SettingText.d.ts +21 -21
- package/dist/types/DataChannel/DataChannelController.d.ts +59 -59
- package/dist/types/DataChannel/DataChannelLatencyTestController.d.ts +25 -25
- package/dist/types/DataChannel/DataChannelLatencyTestResults.d.ts +46 -46
- package/dist/types/DataChannel/DataChannelSender.d.ts +21 -21
- package/dist/types/DataChannel/InitialSettings.d.ts +44 -44
- package/dist/types/DataChannel/LatencyTestResults.d.ts +31 -31
- package/dist/types/FreezeFrame/FreezeFrame.d.ts +36 -36
- package/dist/types/FreezeFrame/FreezeFrameController.d.ts +37 -37
- package/dist/types/Inputs/GamepadController.d.ts +61 -61
- package/dist/types/Inputs/GamepadTypes.d.ts +15 -15
- package/dist/types/Inputs/IInputController.d.ts +16 -16
- package/dist/types/Inputs/InputClassesFactory.d.ts +53 -53
- package/dist/types/Inputs/KeyCodes.d.ts +5 -5
- package/dist/types/Inputs/KeyboardController.d.ts +34 -34
- package/dist/types/Inputs/MouseButtons.d.ts +22 -22
- package/dist/types/Inputs/MouseController.d.ts +40 -40
- package/dist/types/Inputs/MouseControllerHovering.d.ts +26 -26
- package/dist/types/Inputs/MouseControllerLocked.d.ts +31 -31
- package/dist/types/Inputs/SpecialKeyCodes.d.ts +14 -14
- package/dist/types/Inputs/TouchController.d.ts +28 -28
- package/dist/types/Inputs/TouchControllerFake.d.ts +29 -29
- package/dist/types/Inputs/XRGamepadController.d.ts +15 -15
- package/dist/types/PeerConnectionController/AggregatedStats.d.ts +82 -82
- package/dist/types/PeerConnectionController/CandidatePairStats.d.ts +22 -22
- package/dist/types/PeerConnectionController/CandidateStat.d.ts +13 -13
- package/dist/types/PeerConnectionController/CodecStats.d.ts +14 -14
- package/dist/types/PeerConnectionController/DataChannelStats.d.ts +15 -15
- package/dist/types/PeerConnectionController/InboundRTPStats.d.ts +141 -141
- package/dist/types/PeerConnectionController/InboundTrackStats.d.ts +32 -32
- package/dist/types/PeerConnectionController/OutBoundRTPStats.d.ts +23 -23
- package/dist/types/PeerConnectionController/PeerConnectionController.d.ts +143 -143
- package/dist/types/PeerConnectionController/SessionStats.d.ts +8 -8
- package/dist/types/PeerConnectionController/StreamStats.d.ts +9 -9
- package/dist/types/PixelStreaming/PixelStreaming.d.ts +271 -271
- package/dist/types/UI/OnScreenKeyboard.d.ts +30 -30
- package/dist/types/UeInstanceMessage/ResponseController.d.ts +19 -19
- package/dist/types/UeInstanceMessage/SendMessageController.d.ts +18 -18
- package/dist/types/UeInstanceMessage/StreamMessageController.d.ts +29 -29
- package/dist/types/UeInstanceMessage/ToStreamerMessagesController.d.ts +32 -32
- package/dist/types/Util/EventEmitter.d.ts +429 -429
- package/dist/types/Util/FileUtil.d.ts +32 -32
- package/dist/types/Util/IURLSearchParams.d.ts +9 -9
- package/dist/types/Util/InputCoordTranslator.d.ts +29 -29
- package/dist/types/Util/RTCUtils.d.ts +8 -8
- package/dist/types/VideoPlayer/StreamController.d.ts +22 -22
- package/dist/types/VideoPlayer/VideoPlayer.d.ts +78 -78
- package/dist/types/WebRtcPlayer/WebRtcPlayerController.d.ts +379 -379
- package/dist/types/WebXR/WebXRController.d.ts +42 -42
- package/dist/types/pixelstreamingfrontend.d.ts +23 -23
- package/package.json +45 -45
|
@@ -1,249 +1,249 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
import { InboundVideoStats, InboundAudioStats } from './InboundRTPStats';
|
|
3
|
-
import { DataChannelStats } from './DataChannelStats';
|
|
4
|
-
import { CandidateStat } from './CandidateStat';
|
|
5
|
-
import { OutBoundVideoStats } from './OutBoundRTPStats';
|
|
6
|
-
import { SessionStats } from './SessionStats';
|
|
7
|
-
import { StreamStats } from './StreamStats';
|
|
8
|
-
import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
|
|
9
|
-
export class AggregatedStats {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.inboundVideoStats = new InboundVideoStats();
|
|
12
|
-
this.inboundAudioStats = new InboundAudioStats();
|
|
13
|
-
this.DataChannelStats = new DataChannelStats();
|
|
14
|
-
this.outBoundVideoStats = new OutBoundVideoStats();
|
|
15
|
-
this.sessionStats = new SessionStats();
|
|
16
|
-
this.streamStats = new StreamStats();
|
|
17
|
-
this.codecs = new Map();
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Gather all the information from the RTC Peer Connection Report
|
|
21
|
-
* @param rtcStatsReport - RTC Stats Report
|
|
22
|
-
*/
|
|
23
|
-
processStats(rtcStatsReport) {
|
|
24
|
-
this.localCandidates = new Array();
|
|
25
|
-
this.remoteCandidates = new Array();
|
|
26
|
-
this.candidatePairs = new Array();
|
|
27
|
-
rtcStatsReport.forEach((stat) => {
|
|
28
|
-
const type = stat.type;
|
|
29
|
-
switch (type) {
|
|
30
|
-
case 'candidate-pair':
|
|
31
|
-
this.handleCandidatePair(stat);
|
|
32
|
-
break;
|
|
33
|
-
case 'certificate':
|
|
34
|
-
break;
|
|
35
|
-
case 'codec':
|
|
36
|
-
this.handleCodec(stat);
|
|
37
|
-
break;
|
|
38
|
-
case 'data-channel':
|
|
39
|
-
this.handleDataChannel(stat);
|
|
40
|
-
break;
|
|
41
|
-
case 'inbound-rtp':
|
|
42
|
-
this.handleInBoundRTP(stat);
|
|
43
|
-
break;
|
|
44
|
-
case 'local-candidate':
|
|
45
|
-
this.handleLocalCandidate(stat);
|
|
46
|
-
break;
|
|
47
|
-
case 'media-source':
|
|
48
|
-
break;
|
|
49
|
-
case 'media-playout':
|
|
50
|
-
break;
|
|
51
|
-
case 'outbound-rtp':
|
|
52
|
-
break;
|
|
53
|
-
case 'peer-connection':
|
|
54
|
-
break;
|
|
55
|
-
case 'remote-candidate':
|
|
56
|
-
this.handleRemoteCandidate(stat);
|
|
57
|
-
break;
|
|
58
|
-
case 'remote-inbound-rtp':
|
|
59
|
-
break;
|
|
60
|
-
case 'remote-outbound-rtp':
|
|
61
|
-
this.handleRemoteOutBound(stat);
|
|
62
|
-
break;
|
|
63
|
-
case 'track':
|
|
64
|
-
this.handleTrack(stat);
|
|
65
|
-
break;
|
|
66
|
-
case 'transport':
|
|
67
|
-
this.handleTransport(stat);
|
|
68
|
-
break;
|
|
69
|
-
case 'stream':
|
|
70
|
-
this.handleStream(stat);
|
|
71
|
-
break;
|
|
72
|
-
default:
|
|
73
|
-
Logger.Error('unhandled Stat Type');
|
|
74
|
-
Logger.Info(stat);
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Process stream stats data from webrtc
|
|
81
|
-
*
|
|
82
|
-
* @param stat - the stats coming in from webrtc
|
|
83
|
-
*/
|
|
84
|
-
handleStream(stat) {
|
|
85
|
-
this.streamStats = stat;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Process the Ice Candidate Pair Data
|
|
89
|
-
* @param stat - the stats coming in from ice candidates
|
|
90
|
-
*/
|
|
91
|
-
handleCandidatePair(stat) {
|
|
92
|
-
// Add the candidate pair to the candidate pair array
|
|
93
|
-
this.candidatePairs.push(stat);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Process the Data Channel Data
|
|
97
|
-
* @param stat - the stats coming in from the data channel
|
|
98
|
-
*/
|
|
99
|
-
handleDataChannel(stat) {
|
|
100
|
-
this.DataChannelStats.bytesReceived = stat.bytesReceived;
|
|
101
|
-
this.DataChannelStats.bytesSent = stat.bytesSent;
|
|
102
|
-
this.DataChannelStats.dataChannelIdentifier = stat.dataChannelIdentifier;
|
|
103
|
-
this.DataChannelStats.id = stat.id;
|
|
104
|
-
this.DataChannelStats.label = stat.label;
|
|
105
|
-
this.DataChannelStats.messagesReceived = stat.messagesReceived;
|
|
106
|
-
this.DataChannelStats.messagesSent = stat.messagesSent;
|
|
107
|
-
this.DataChannelStats.protocol = stat.protocol;
|
|
108
|
-
this.DataChannelStats.state = stat.state;
|
|
109
|
-
this.DataChannelStats.timestamp = stat.timestamp;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Process the Local Ice Candidate Data
|
|
113
|
-
* @param stat - local stats
|
|
114
|
-
*/
|
|
115
|
-
handleLocalCandidate(stat) {
|
|
116
|
-
const localCandidate = new CandidateStat();
|
|
117
|
-
localCandidate.label = 'local-candidate';
|
|
118
|
-
localCandidate.address = stat.address;
|
|
119
|
-
localCandidate.port = stat.port;
|
|
120
|
-
localCandidate.protocol = stat.protocol;
|
|
121
|
-
localCandidate.candidateType = stat.candidateType;
|
|
122
|
-
localCandidate.id = stat.id;
|
|
123
|
-
localCandidate.relayProtocol = stat.relayProtocol;
|
|
124
|
-
localCandidate.transportId = stat.transportId;
|
|
125
|
-
this.localCandidates.push(localCandidate);
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Process the Remote Ice Candidate Data
|
|
129
|
-
* @param stat - ice candidate stats
|
|
130
|
-
*/
|
|
131
|
-
handleRemoteCandidate(stat) {
|
|
132
|
-
const RemoteCandidate = new CandidateStat();
|
|
133
|
-
RemoteCandidate.label = 'remote-candidate';
|
|
134
|
-
RemoteCandidate.address = stat.address;
|
|
135
|
-
RemoteCandidate.port = stat.port;
|
|
136
|
-
RemoteCandidate.protocol = stat.protocol;
|
|
137
|
-
RemoteCandidate.id = stat.id;
|
|
138
|
-
RemoteCandidate.candidateType = stat.candidateType;
|
|
139
|
-
RemoteCandidate.relayProtocol = stat.relayProtocol;
|
|
140
|
-
RemoteCandidate.transportId = stat.transportId;
|
|
141
|
-
this.remoteCandidates.push(RemoteCandidate);
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Process the Inbound RTP Audio and Video Data
|
|
145
|
-
* @param stat - inbound rtp stats
|
|
146
|
-
*/
|
|
147
|
-
handleInBoundRTP(stat) {
|
|
148
|
-
switch (stat.kind) {
|
|
149
|
-
case 'video':
|
|
150
|
-
// Calculate bitrate between stat updates
|
|
151
|
-
if (stat.bytesReceived > this.inboundVideoStats.bytesReceived &&
|
|
152
|
-
stat.timestamp > this.inboundVideoStats.timestamp) {
|
|
153
|
-
this.inboundVideoStats.bitrate =
|
|
154
|
-
(8 * (stat.bytesReceived - this.inboundVideoStats.bytesReceived)) /
|
|
155
|
-
(stat.timestamp - this.inboundVideoStats.timestamp);
|
|
156
|
-
this.inboundVideoStats.bitrate = Math.floor(this.inboundVideoStats.bitrate);
|
|
157
|
-
}
|
|
158
|
-
// Copy members from stat into `this.inboundVideoStats`
|
|
159
|
-
for (const key in stat) {
|
|
160
|
-
this.inboundVideoStats[key] = stat[key];
|
|
161
|
-
}
|
|
162
|
-
break;
|
|
163
|
-
case 'audio':
|
|
164
|
-
if (stat.bytesReceived > this.inboundAudioStats.bytesReceived &&
|
|
165
|
-
stat.timestamp > this.inboundAudioStats.timestamp) {
|
|
166
|
-
this.inboundAudioStats.bitrate =
|
|
167
|
-
(8 * (stat.bytesReceived - this.inboundAudioStats.bytesReceived)) /
|
|
168
|
-
(stat.timestamp - this.inboundAudioStats.timestamp);
|
|
169
|
-
this.inboundAudioStats.bitrate = Math.floor(this.inboundAudioStats.bitrate);
|
|
170
|
-
}
|
|
171
|
-
// Copy members from stat into `this.inboundAudioStats`
|
|
172
|
-
for (const key in stat) {
|
|
173
|
-
this.inboundAudioStats[key] = stat[key];
|
|
174
|
-
}
|
|
175
|
-
break;
|
|
176
|
-
default:
|
|
177
|
-
Logger.Error(`Kind should be audio or video, we got ${stat.kind} - that's unsupported.`);
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Process the outbound RTP Audio and Video Data
|
|
183
|
-
* @param stat - remote outbound stats
|
|
184
|
-
*/
|
|
185
|
-
handleRemoteOutBound(stat) {
|
|
186
|
-
switch (stat.kind) {
|
|
187
|
-
case 'video':
|
|
188
|
-
this.outBoundVideoStats.bytesSent = stat.bytesSent;
|
|
189
|
-
this.outBoundVideoStats.id = stat.id;
|
|
190
|
-
this.outBoundVideoStats.localId = stat.localId;
|
|
191
|
-
this.outBoundVideoStats.packetsSent = stat.packetsSent;
|
|
192
|
-
this.outBoundVideoStats.remoteTimestamp = stat.remoteTimestamp;
|
|
193
|
-
this.outBoundVideoStats.timestamp = stat.timestamp;
|
|
194
|
-
break;
|
|
195
|
-
case 'audio':
|
|
196
|
-
break;
|
|
197
|
-
default:
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Process the Inbound Video Track Data
|
|
203
|
-
* @param stat - video track stats
|
|
204
|
-
*/
|
|
205
|
-
handleTrack(stat) {
|
|
206
|
-
// we only want to extract stats from the video track
|
|
207
|
-
if (stat.type === 'track' && (stat.trackIdentifier === 'video_label' || stat.kind === 'video')) {
|
|
208
|
-
this.inboundVideoStats.framesDropped = stat.framesDropped;
|
|
209
|
-
this.inboundVideoStats.framesReceived = stat.framesReceived;
|
|
210
|
-
this.inboundVideoStats.frameHeight = stat.frameHeight;
|
|
211
|
-
this.inboundVideoStats.frameWidth = stat.frameWidth;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
handleTransport(stat) {
|
|
215
|
-
this.transportStats = stat;
|
|
216
|
-
}
|
|
217
|
-
handleCodec(stat) {
|
|
218
|
-
const codecId = stat.id;
|
|
219
|
-
this.codecs.set(codecId, stat);
|
|
220
|
-
}
|
|
221
|
-
handleSessionStatistics(videoStartTime, inputController, videoEncoderAvgQP) {
|
|
222
|
-
const deltaTime = Date.now() - videoStartTime;
|
|
223
|
-
this.sessionStats.runTime = new Date(deltaTime).toISOString().substr(11, 8).toString();
|
|
224
|
-
const controlsStreamInput = inputController === null ? 'Not sent yet' : inputController ? 'true' : 'false';
|
|
225
|
-
this.sessionStats.controlsStreamInput = controlsStreamInput;
|
|
226
|
-
this.sessionStats.videoEncoderAvgQP = videoEncoderAvgQP;
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Check if a value coming in from our stats is actually a number
|
|
230
|
-
* @param value - the number to be checked
|
|
231
|
-
*/
|
|
232
|
-
isNumber(value) {
|
|
233
|
-
return typeof value === 'number' && isFinite(value);
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Helper function to return the active candidate pair
|
|
237
|
-
* @returns The candidate pair that is currently receiving data
|
|
238
|
-
*/
|
|
239
|
-
getActiveCandidatePair() {
|
|
240
|
-
// Check if the RTCTransport stat is not undefined
|
|
241
|
-
if (this.transportStats) {
|
|
242
|
-
// Return the candidate pair that matches the transport candidate pair id
|
|
243
|
-
return this.candidatePairs.find((candidatePair) => candidatePair.id === this.transportStats.selectedCandidatePairId, null);
|
|
244
|
-
}
|
|
245
|
-
// Fall back to the selected candidate pair
|
|
246
|
-
return this.candidatePairs.find((candidatePair) => candidatePair.selected, null);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
1
|
+
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
+
import { InboundVideoStats, InboundAudioStats } from './InboundRTPStats';
|
|
3
|
+
import { DataChannelStats } from './DataChannelStats';
|
|
4
|
+
import { CandidateStat } from './CandidateStat';
|
|
5
|
+
import { OutBoundVideoStats } from './OutBoundRTPStats';
|
|
6
|
+
import { SessionStats } from './SessionStats';
|
|
7
|
+
import { StreamStats } from './StreamStats';
|
|
8
|
+
import { Logger } from '@epicgames-ps/lib-pixelstreamingcommon-ue5.5';
|
|
9
|
+
export class AggregatedStats {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.inboundVideoStats = new InboundVideoStats();
|
|
12
|
+
this.inboundAudioStats = new InboundAudioStats();
|
|
13
|
+
this.DataChannelStats = new DataChannelStats();
|
|
14
|
+
this.outBoundVideoStats = new OutBoundVideoStats();
|
|
15
|
+
this.sessionStats = new SessionStats();
|
|
16
|
+
this.streamStats = new StreamStats();
|
|
17
|
+
this.codecs = new Map();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gather all the information from the RTC Peer Connection Report
|
|
21
|
+
* @param rtcStatsReport - RTC Stats Report
|
|
22
|
+
*/
|
|
23
|
+
processStats(rtcStatsReport) {
|
|
24
|
+
this.localCandidates = new Array();
|
|
25
|
+
this.remoteCandidates = new Array();
|
|
26
|
+
this.candidatePairs = new Array();
|
|
27
|
+
rtcStatsReport.forEach((stat) => {
|
|
28
|
+
const type = stat.type;
|
|
29
|
+
switch (type) {
|
|
30
|
+
case 'candidate-pair':
|
|
31
|
+
this.handleCandidatePair(stat);
|
|
32
|
+
break;
|
|
33
|
+
case 'certificate':
|
|
34
|
+
break;
|
|
35
|
+
case 'codec':
|
|
36
|
+
this.handleCodec(stat);
|
|
37
|
+
break;
|
|
38
|
+
case 'data-channel':
|
|
39
|
+
this.handleDataChannel(stat);
|
|
40
|
+
break;
|
|
41
|
+
case 'inbound-rtp':
|
|
42
|
+
this.handleInBoundRTP(stat);
|
|
43
|
+
break;
|
|
44
|
+
case 'local-candidate':
|
|
45
|
+
this.handleLocalCandidate(stat);
|
|
46
|
+
break;
|
|
47
|
+
case 'media-source':
|
|
48
|
+
break;
|
|
49
|
+
case 'media-playout':
|
|
50
|
+
break;
|
|
51
|
+
case 'outbound-rtp':
|
|
52
|
+
break;
|
|
53
|
+
case 'peer-connection':
|
|
54
|
+
break;
|
|
55
|
+
case 'remote-candidate':
|
|
56
|
+
this.handleRemoteCandidate(stat);
|
|
57
|
+
break;
|
|
58
|
+
case 'remote-inbound-rtp':
|
|
59
|
+
break;
|
|
60
|
+
case 'remote-outbound-rtp':
|
|
61
|
+
this.handleRemoteOutBound(stat);
|
|
62
|
+
break;
|
|
63
|
+
case 'track':
|
|
64
|
+
this.handleTrack(stat);
|
|
65
|
+
break;
|
|
66
|
+
case 'transport':
|
|
67
|
+
this.handleTransport(stat);
|
|
68
|
+
break;
|
|
69
|
+
case 'stream':
|
|
70
|
+
this.handleStream(stat);
|
|
71
|
+
break;
|
|
72
|
+
default:
|
|
73
|
+
Logger.Error('unhandled Stat Type');
|
|
74
|
+
Logger.Info(stat);
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Process stream stats data from webrtc
|
|
81
|
+
*
|
|
82
|
+
* @param stat - the stats coming in from webrtc
|
|
83
|
+
*/
|
|
84
|
+
handleStream(stat) {
|
|
85
|
+
this.streamStats = stat;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Process the Ice Candidate Pair Data
|
|
89
|
+
* @param stat - the stats coming in from ice candidates
|
|
90
|
+
*/
|
|
91
|
+
handleCandidatePair(stat) {
|
|
92
|
+
// Add the candidate pair to the candidate pair array
|
|
93
|
+
this.candidatePairs.push(stat);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Process the Data Channel Data
|
|
97
|
+
* @param stat - the stats coming in from the data channel
|
|
98
|
+
*/
|
|
99
|
+
handleDataChannel(stat) {
|
|
100
|
+
this.DataChannelStats.bytesReceived = stat.bytesReceived;
|
|
101
|
+
this.DataChannelStats.bytesSent = stat.bytesSent;
|
|
102
|
+
this.DataChannelStats.dataChannelIdentifier = stat.dataChannelIdentifier;
|
|
103
|
+
this.DataChannelStats.id = stat.id;
|
|
104
|
+
this.DataChannelStats.label = stat.label;
|
|
105
|
+
this.DataChannelStats.messagesReceived = stat.messagesReceived;
|
|
106
|
+
this.DataChannelStats.messagesSent = stat.messagesSent;
|
|
107
|
+
this.DataChannelStats.protocol = stat.protocol;
|
|
108
|
+
this.DataChannelStats.state = stat.state;
|
|
109
|
+
this.DataChannelStats.timestamp = stat.timestamp;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Process the Local Ice Candidate Data
|
|
113
|
+
* @param stat - local stats
|
|
114
|
+
*/
|
|
115
|
+
handleLocalCandidate(stat) {
|
|
116
|
+
const localCandidate = new CandidateStat();
|
|
117
|
+
localCandidate.label = 'local-candidate';
|
|
118
|
+
localCandidate.address = stat.address;
|
|
119
|
+
localCandidate.port = stat.port;
|
|
120
|
+
localCandidate.protocol = stat.protocol;
|
|
121
|
+
localCandidate.candidateType = stat.candidateType;
|
|
122
|
+
localCandidate.id = stat.id;
|
|
123
|
+
localCandidate.relayProtocol = stat.relayProtocol;
|
|
124
|
+
localCandidate.transportId = stat.transportId;
|
|
125
|
+
this.localCandidates.push(localCandidate);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Process the Remote Ice Candidate Data
|
|
129
|
+
* @param stat - ice candidate stats
|
|
130
|
+
*/
|
|
131
|
+
handleRemoteCandidate(stat) {
|
|
132
|
+
const RemoteCandidate = new CandidateStat();
|
|
133
|
+
RemoteCandidate.label = 'remote-candidate';
|
|
134
|
+
RemoteCandidate.address = stat.address;
|
|
135
|
+
RemoteCandidate.port = stat.port;
|
|
136
|
+
RemoteCandidate.protocol = stat.protocol;
|
|
137
|
+
RemoteCandidate.id = stat.id;
|
|
138
|
+
RemoteCandidate.candidateType = stat.candidateType;
|
|
139
|
+
RemoteCandidate.relayProtocol = stat.relayProtocol;
|
|
140
|
+
RemoteCandidate.transportId = stat.transportId;
|
|
141
|
+
this.remoteCandidates.push(RemoteCandidate);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Process the Inbound RTP Audio and Video Data
|
|
145
|
+
* @param stat - inbound rtp stats
|
|
146
|
+
*/
|
|
147
|
+
handleInBoundRTP(stat) {
|
|
148
|
+
switch (stat.kind) {
|
|
149
|
+
case 'video':
|
|
150
|
+
// Calculate bitrate between stat updates
|
|
151
|
+
if (stat.bytesReceived > this.inboundVideoStats.bytesReceived &&
|
|
152
|
+
stat.timestamp > this.inboundVideoStats.timestamp) {
|
|
153
|
+
this.inboundVideoStats.bitrate =
|
|
154
|
+
(8 * (stat.bytesReceived - this.inboundVideoStats.bytesReceived)) /
|
|
155
|
+
(stat.timestamp - this.inboundVideoStats.timestamp);
|
|
156
|
+
this.inboundVideoStats.bitrate = Math.floor(this.inboundVideoStats.bitrate);
|
|
157
|
+
}
|
|
158
|
+
// Copy members from stat into `this.inboundVideoStats`
|
|
159
|
+
for (const key in stat) {
|
|
160
|
+
this.inboundVideoStats[key] = stat[key];
|
|
161
|
+
}
|
|
162
|
+
break;
|
|
163
|
+
case 'audio':
|
|
164
|
+
if (stat.bytesReceived > this.inboundAudioStats.bytesReceived &&
|
|
165
|
+
stat.timestamp > this.inboundAudioStats.timestamp) {
|
|
166
|
+
this.inboundAudioStats.bitrate =
|
|
167
|
+
(8 * (stat.bytesReceived - this.inboundAudioStats.bytesReceived)) /
|
|
168
|
+
(stat.timestamp - this.inboundAudioStats.timestamp);
|
|
169
|
+
this.inboundAudioStats.bitrate = Math.floor(this.inboundAudioStats.bitrate);
|
|
170
|
+
}
|
|
171
|
+
// Copy members from stat into `this.inboundAudioStats`
|
|
172
|
+
for (const key in stat) {
|
|
173
|
+
this.inboundAudioStats[key] = stat[key];
|
|
174
|
+
}
|
|
175
|
+
break;
|
|
176
|
+
default:
|
|
177
|
+
Logger.Error(`Kind should be audio or video, we got ${stat.kind} - that's unsupported.`);
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Process the outbound RTP Audio and Video Data
|
|
183
|
+
* @param stat - remote outbound stats
|
|
184
|
+
*/
|
|
185
|
+
handleRemoteOutBound(stat) {
|
|
186
|
+
switch (stat.kind) {
|
|
187
|
+
case 'video':
|
|
188
|
+
this.outBoundVideoStats.bytesSent = stat.bytesSent;
|
|
189
|
+
this.outBoundVideoStats.id = stat.id;
|
|
190
|
+
this.outBoundVideoStats.localId = stat.localId;
|
|
191
|
+
this.outBoundVideoStats.packetsSent = stat.packetsSent;
|
|
192
|
+
this.outBoundVideoStats.remoteTimestamp = stat.remoteTimestamp;
|
|
193
|
+
this.outBoundVideoStats.timestamp = stat.timestamp;
|
|
194
|
+
break;
|
|
195
|
+
case 'audio':
|
|
196
|
+
break;
|
|
197
|
+
default:
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Process the Inbound Video Track Data
|
|
203
|
+
* @param stat - video track stats
|
|
204
|
+
*/
|
|
205
|
+
handleTrack(stat) {
|
|
206
|
+
// we only want to extract stats from the video track
|
|
207
|
+
if (stat.type === 'track' && (stat.trackIdentifier === 'video_label' || stat.kind === 'video')) {
|
|
208
|
+
this.inboundVideoStats.framesDropped = stat.framesDropped;
|
|
209
|
+
this.inboundVideoStats.framesReceived = stat.framesReceived;
|
|
210
|
+
this.inboundVideoStats.frameHeight = stat.frameHeight;
|
|
211
|
+
this.inboundVideoStats.frameWidth = stat.frameWidth;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
handleTransport(stat) {
|
|
215
|
+
this.transportStats = stat;
|
|
216
|
+
}
|
|
217
|
+
handleCodec(stat) {
|
|
218
|
+
const codecId = stat.id;
|
|
219
|
+
this.codecs.set(codecId, stat);
|
|
220
|
+
}
|
|
221
|
+
handleSessionStatistics(videoStartTime, inputController, videoEncoderAvgQP) {
|
|
222
|
+
const deltaTime = Date.now() - videoStartTime;
|
|
223
|
+
this.sessionStats.runTime = new Date(deltaTime).toISOString().substr(11, 8).toString();
|
|
224
|
+
const controlsStreamInput = inputController === null ? 'Not sent yet' : inputController ? 'true' : 'false';
|
|
225
|
+
this.sessionStats.controlsStreamInput = controlsStreamInput;
|
|
226
|
+
this.sessionStats.videoEncoderAvgQP = videoEncoderAvgQP;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Check if a value coming in from our stats is actually a number
|
|
230
|
+
* @param value - the number to be checked
|
|
231
|
+
*/
|
|
232
|
+
isNumber(value) {
|
|
233
|
+
return typeof value === 'number' && isFinite(value);
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Helper function to return the active candidate pair
|
|
237
|
+
* @returns The candidate pair that is currently receiving data
|
|
238
|
+
*/
|
|
239
|
+
getActiveCandidatePair() {
|
|
240
|
+
// Check if the RTCTransport stat is not undefined
|
|
241
|
+
if (this.transportStats) {
|
|
242
|
+
// Return the candidate pair that matches the transport candidate pair id
|
|
243
|
+
return this.candidatePairs.find((candidatePair) => candidatePair.id === this.transportStats.selectedCandidatePairId, null);
|
|
244
|
+
}
|
|
245
|
+
// Fall back to the selected candidate pair
|
|
246
|
+
return this.candidatePairs.find((candidatePair) => candidatePair.selected, null);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
249
|
//# sourceMappingURL=AggregatedStats.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
/**
|
|
3
|
-
* ICE Candidate Pair Stats collected from the RTC Stats Report
|
|
4
|
-
*/
|
|
5
|
-
export class CandidatePairStats {
|
|
6
|
-
}
|
|
1
|
+
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
+
/**
|
|
3
|
+
* ICE Candidate Pair Stats collected from the RTC Stats Report
|
|
4
|
+
*/
|
|
5
|
+
export class CandidatePairStats {
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=CandidatePairStats.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
/**
|
|
3
|
-
* ICE Candidate Stat collected from the RTC Stats Report
|
|
4
|
-
*/
|
|
5
|
-
export class CandidateStat {
|
|
6
|
-
}
|
|
1
|
+
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
+
/**
|
|
3
|
+
* ICE Candidate Stat collected from the RTC Stats Report
|
|
4
|
+
*/
|
|
5
|
+
export class CandidateStat {
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=CandidateStat.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
/**
|
|
3
|
-
* Codec Stats collected from the RTC Stats Report
|
|
4
|
-
*/
|
|
5
|
-
export class CodecStats {
|
|
6
|
-
}
|
|
1
|
+
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
+
/**
|
|
3
|
+
* Codec Stats collected from the RTC Stats Report
|
|
4
|
+
*/
|
|
5
|
+
export class CodecStats {
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=CodecStats.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
/**
|
|
3
|
-
* Data Channel Stats collected from the RTC Stats Report
|
|
4
|
-
*/
|
|
5
|
-
export class DataChannelStats {
|
|
6
|
-
}
|
|
1
|
+
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
+
/**
|
|
3
|
+
* Data Channel Stats collected from the RTC Stats Report
|
|
4
|
+
*/
|
|
5
|
+
export class DataChannelStats {
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=DataChannelStats.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
/**
|
|
3
|
-
* Inbound Audio Stats collected from the RTC Stats Report
|
|
4
|
-
*/
|
|
5
|
-
export class InboundAudioStats {
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Inbound Video Stats collected from the RTC Stats Report
|
|
9
|
-
*/
|
|
10
|
-
export class InboundVideoStats {
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Inbound Stats collected from the RTC Stats Report
|
|
14
|
-
*/
|
|
15
|
-
export class InboundRTPStats {
|
|
16
|
-
}
|
|
1
|
+
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
+
/**
|
|
3
|
+
* Inbound Audio Stats collected from the RTC Stats Report
|
|
4
|
+
*/
|
|
5
|
+
export class InboundAudioStats {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Inbound Video Stats collected from the RTC Stats Report
|
|
9
|
+
*/
|
|
10
|
+
export class InboundVideoStats {
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Inbound Stats collected from the RTC Stats Report
|
|
14
|
+
*/
|
|
15
|
+
export class InboundRTPStats {
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=InboundRTPStats.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
/**
|
|
3
|
-
* Inbound Track Stats collected from the RTC Stats Report
|
|
4
|
-
*/
|
|
5
|
-
export class InboundTrackStats {
|
|
6
|
-
}
|
|
1
|
+
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
+
/**
|
|
3
|
+
* Inbound Track Stats collected from the RTC Stats Report
|
|
4
|
+
*/
|
|
5
|
+
export class InboundTrackStats {
|
|
6
|
+
}
|
|
7
7
|
//# sourceMappingURL=InboundTrackStats.js.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
-
/**
|
|
3
|
-
* Outbound Video Stats collected from the RTC Stats Report
|
|
4
|
-
*/
|
|
5
|
-
export class OutBoundVideoStats {
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Outbound Stats collected from the RTC Stats Report
|
|
9
|
-
*/
|
|
10
|
-
export class OutBoundRTPStats {
|
|
11
|
-
}
|
|
1
|
+
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
2
|
+
/**
|
|
3
|
+
* Outbound Video Stats collected from the RTC Stats Report
|
|
4
|
+
*/
|
|
5
|
+
export class OutBoundVideoStats {
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Outbound Stats collected from the RTC Stats Report
|
|
9
|
+
*/
|
|
10
|
+
export class OutBoundRTPStats {
|
|
11
|
+
}
|
|
12
12
|
//# sourceMappingURL=OutBoundRTPStats.js.map
|