@observertc/observer-js 0.9.3-beta → 0.9.5-beta

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@observertc/observer-js",
3
- "version": "0.9.3-beta",
3
+ "version": "0.9.5-beta",
4
4
  "description": "Server Side NodeJS Library for processing ObserveRTC Samples",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
package/src/index.ts CHANGED
@@ -34,6 +34,7 @@ export type {
34
34
  SfuOutboundRtpPad,
35
35
  SfuSctpChannel,
36
36
  SfuExtensionStats,
37
+ DataChannel,
37
38
  } from '@observertc/sample-schemas-js';
38
39
 
39
40
  export type {
@@ -3,6 +3,7 @@ import * as Models from '../../models/Models';
3
3
  import { ReportsCollector } from '../../common/ReportsCollector';
4
4
  import { logger } from '../VisitObservedCallsMiddleware';
5
5
  import { PeerConnectionTransportReport } from '@observertc/report-schemas-js';
6
+ import { Samples_ClientSample_IceCandidatePair, Samples_ClientSample_IceLocalCandidate, Samples_ClientSample_IceRemoteCandidate, Samples_ClientSample_PeerConnectionTransport } from '../../models/samples_pb';
6
7
 
7
8
  export function visitPeerConnection(
8
9
  observedPeerConnection: ObservedPeerConnection,
@@ -55,16 +56,62 @@ export function visitPeerConnection(
55
56
  }
56
57
 
57
58
  if (fetchSamples) {
59
+ storedPeerConnection.icelocalCandidates = [];
58
60
  for (const iceLocalCandidate of observedPeerConnection.iceLocalCandidates()) {
59
- // iceLocalCandidate.id
61
+ const {
62
+ priority,
63
+ ...sample
64
+ } = iceLocalCandidate;
65
+ storedPeerConnection.icelocalCandidates.push(new Samples_ClientSample_IceLocalCandidate({
66
+ ...sample,
67
+ priority: BigInt(priority ?? -1)
68
+ }));
60
69
  }
61
70
 
71
+ storedPeerConnection.iceRemoteCandidates = [];
62
72
  for (const iceRemoteCandidate of observedPeerConnection.iceRemoteCandidates()) {
63
- // iceRemoteCandidates
73
+ const {
74
+ priority,
75
+ ...sample
76
+ } = iceRemoteCandidate;
77
+ storedPeerConnection.iceRemoteCandidates.push(new Samples_ClientSample_IceRemoteCandidate({
78
+ ...sample,
79
+ priority: BigInt(priority ?? -1)
80
+ }));
64
81
  }
65
82
 
83
+ storedPeerConnection.iceCandidatePairs = [];
66
84
  for (const iceCandidatePair of observedPeerConnection.iceCandidatePairs()) {
67
- // iceCandidatePair
85
+ const {
86
+ bytesDiscardedOnSend,
87
+ bytesReceived,
88
+ bytesSent,
89
+ lastPacketReceivedTimestamp,
90
+ lastPacketSentTimestamp,
91
+ ...sample
92
+ } = iceCandidatePair;
93
+ storedPeerConnection.iceCandidatePairs.push(new Samples_ClientSample_IceCandidatePair({
94
+ ...sample,
95
+ bytesDiscardedOnSend: BigInt(bytesDiscardedOnSend ?? -1),
96
+ bytesReceived: BigInt(bytesReceived ?? -1),
97
+ bytesSent: BigInt(bytesSent ?? -1),
98
+ lastPacketReceivedTimestamp: BigInt(lastPacketReceivedTimestamp ?? -1),
99
+ lastPacketSentTimestamp: BigInt(lastPacketSentTimestamp ?? -1),
100
+ }));
101
+ }
102
+
103
+ storedPeerConnection.transports = [];
104
+ for (const pcTransport of observedPeerConnection.transportSamples()) {
105
+ const {
106
+ bytesReceived,
107
+ bytesSent,
108
+ ...sample
109
+ } = pcTransport;
110
+ storedPeerConnection.transports.push(new Samples_ClientSample_PeerConnectionTransport({
111
+ ...sample,
112
+ bytesReceived: BigInt(bytesReceived ?? -1),
113
+ bytesSent: BigInt(bytesSent ?? -1),
114
+ }));
68
115
  }
69
116
  }
70
117
  }