@observertc/observer-js 0.9.1-beta → 0.9.3-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.
Files changed (102) hide show
  1. package/lib/Evaluator.d.ts.map +1 -1
  2. package/lib/Evaluator.js +13 -2
  3. package/lib/Observer.d.ts +5 -3
  4. package/lib/Observer.d.ts.map +1 -1
  5. package/lib/Observer.js +27 -5
  6. package/lib/common/logger.d.ts +2 -2
  7. package/lib/common/logger.d.ts.map +1 -1
  8. package/lib/common/logger.js +49 -35
  9. package/lib/common/types.d.ts +22 -0
  10. package/lib/common/types.d.ts.map +1 -1
  11. package/lib/middlewares/CommitTransactionMiddleware.d.ts.map +1 -1
  12. package/lib/middlewares/CommitTransactionMiddleware.js +25 -0
  13. package/lib/middlewares/TransactionContext.d.ts +4 -2
  14. package/lib/middlewares/TransactionContext.d.ts.map +1 -1
  15. package/lib/middlewares/TransactionContext.js +2 -1
  16. package/lib/middlewares/TransactoinProcessor.d.ts.map +1 -1
  17. package/lib/middlewares/TransactoinProcessor.js +3 -2
  18. package/lib/middlewares/VisitObservedCallsMiddleware.d.ts +1 -1
  19. package/lib/middlewares/VisitObservedCallsMiddleware.d.ts.map +1 -1
  20. package/lib/middlewares/VisitObservedCallsMiddleware.js +2 -2
  21. package/lib/middlewares/VisitObservedSfusMiddleware.d.ts +6 -0
  22. package/lib/middlewares/VisitObservedSfusMiddleware.d.ts.map +1 -0
  23. package/lib/middlewares/VisitObservedSfusMiddleware.js +142 -0
  24. package/lib/middlewares/visitors/visitClient.d.ts.map +1 -1
  25. package/lib/middlewares/visitors/visitClient.js +13 -0
  26. package/lib/middlewares/visitors/{visitOutboundVideoTarcks.d.ts → visitOutboundVideoTarck.d.ts} +1 -1
  27. package/lib/middlewares/visitors/visitOutboundVideoTarck.d.ts.map +1 -0
  28. package/lib/middlewares/visitors/visitSfu.d.ts +5 -0
  29. package/lib/middlewares/visitors/visitSfu.d.ts.map +1 -0
  30. package/lib/middlewares/visitors/visitSfu.js +79 -0
  31. package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts +5 -0
  32. package/lib/middlewares/visitors/visitSfuInboundRtpPad.d.ts.map +1 -0
  33. package/lib/middlewares/visitors/visitSfuInboundRtpPad.js +60 -0
  34. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts +5 -0
  35. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.d.ts.map +1 -0
  36. package/lib/middlewares/visitors/visitSfuOutboundRtpPad.js +61 -0
  37. package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts +5 -0
  38. package/lib/middlewares/visitors/visitSfuSctpChannel.d.ts.map +1 -0
  39. package/lib/middlewares/visitors/visitSfuSctpChannel.js +58 -0
  40. package/lib/middlewares/visitors/visitSfuTransport.d.ts +5 -0
  41. package/lib/middlewares/visitors/visitSfuTransport.d.ts.map +1 -0
  42. package/lib/middlewares/visitors/visitSfuTransport.js +59 -0
  43. package/lib/samples/ObservedSfu.d.ts +27 -0
  44. package/lib/samples/ObservedSfu.d.ts.map +1 -0
  45. package/lib/samples/ObservedSfu.js +72 -0
  46. package/lib/samples/ObservedSfuInboundRtpPad.d.ts +15 -0
  47. package/lib/samples/ObservedSfuInboundRtpPad.d.ts.map +1 -0
  48. package/lib/samples/ObservedSfuInboundRtpPad.js +21 -0
  49. package/lib/samples/ObservedSfuOutboundRtpPad.d.ts +15 -0
  50. package/lib/samples/ObservedSfuOutboundRtpPad.d.ts.map +1 -0
  51. package/lib/samples/ObservedSfuOutboundRtpPad.js +21 -0
  52. package/lib/samples/ObservedSfuSctpChannel.d.ts +15 -0
  53. package/lib/samples/ObservedSfuSctpChannel.d.ts.map +1 -0
  54. package/lib/samples/ObservedSfuSctpChannel.js +21 -0
  55. package/lib/samples/ObservedSfuTransport.d.ts +30 -0
  56. package/lib/samples/ObservedSfuTransport.d.ts.map +1 -0
  57. package/lib/samples/ObservedSfuTransport.js +93 -0
  58. package/lib/samples/ObservedSfus.d.ts +16 -0
  59. package/lib/samples/ObservedSfus.d.ts.map +1 -0
  60. package/lib/samples/ObservedSfus.js +66 -0
  61. package/lib/sinks/ObserverSink.d.ts +3 -3
  62. package/lib/sinks/ObserverSink.d.ts.map +1 -1
  63. package/lib/sources/ObservedSfuSource.d.ts +14 -0
  64. package/lib/sources/ObservedSfuSource.d.ts.map +1 -0
  65. package/lib/sources/ObservedSfuSource.js +2 -0
  66. package/lib/sources/Sources.d.ts +8 -0
  67. package/lib/sources/Sources.d.ts.map +1 -1
  68. package/lib/sources/Sources.js +47 -1
  69. package/lib/storages/StorageProvider.d.ts.map +1 -1
  70. package/package.json +1 -1
  71. package/src/Evaluator.ts +14 -2
  72. package/src/Observer.ts +30 -5
  73. package/src/common/logger.ts +145 -127
  74. package/src/common/types.ts +27 -0
  75. package/src/middlewares/CommitTransactionMiddleware.ts +46 -6
  76. package/src/middlewares/TransactionContext.ts +7 -3
  77. package/src/middlewares/TransactoinProcessor.ts +3 -1
  78. package/src/middlewares/VisitObservedCallsMiddleware.ts +1 -1
  79. package/src/middlewares/VisitObservedSfusMiddleware.ts +202 -0
  80. package/src/middlewares/visitors/visitClient.ts +15 -0
  81. package/src/middlewares/visitors/visitSfu.ts +64 -0
  82. package/src/middlewares/visitors/visitSfuInboundRtpPad.ts +50 -0
  83. package/src/middlewares/visitors/visitSfuOutboundRtpPad.ts +51 -0
  84. package/src/middlewares/visitors/visitSfuSctpChannel.ts +48 -0
  85. package/src/middlewares/visitors/visitSfuTransport.ts +48 -0
  86. package/src/samples/ObservedSfu.ts +108 -0
  87. package/src/samples/ObservedSfuInboundRtpPad.ts +34 -0
  88. package/src/samples/ObservedSfuOutboundRtpPad.ts +34 -0
  89. package/src/samples/ObservedSfuSctpChannel.ts +35 -0
  90. package/src/samples/ObservedSfuTransport.ts +130 -0
  91. package/src/samples/ObservedSfus.ts +85 -0
  92. package/src/sinks/ObserverSink.ts +5 -3
  93. package/src/sources/ObservedSfuSource.ts +23 -0
  94. package/src/sources/Sources.ts +54 -3
  95. package/src/storages/StorageProvider.ts +1 -4
  96. package/lib/middlewares/visitors/visitOutboundVideoTarcks.d.ts.map +0 -1
  97. package/lib/storages/StorageFactory.d.ts +0 -27
  98. package/lib/storages/StorageFactory.d.ts.map +0 -1
  99. package/lib/storages/StorageFactory.js +0 -37
  100. package/src/storages/StorageFactory.ts +0 -58
  101. /package/lib/middlewares/visitors/{visitOutboundVideoTarcks.js → visitOutboundVideoTarck.js} +0 -0
  102. /package/src/middlewares/visitors/{visitOutboundVideoTarcks.ts → visitOutboundVideoTarck.ts} +0 -0
@@ -0,0 +1,35 @@
1
+ import { SfuSctpChannel } from '@observertc/sample-schemas-js';
2
+ import { ObservedSfuTransport } from './ObservedSfuTransport';
3
+
4
+ export interface ObservedSfuSctpChannel {
5
+ readonly sfuTransport: ObservedSfuTransport;
6
+ readonly channelId: string;
7
+
8
+ samples(): IterableIterator<SfuSctpChannel>;
9
+ }
10
+
11
+ export class ObservedSfuSctpChannelBuilder {
12
+ private _samples: SfuSctpChannel[] = [];
13
+ public constructor(
14
+ private _config: Omit<
15
+ ObservedSfuSctpChannel,
16
+ | keyof IterableIterator<SfuSctpChannel>
17
+ | 'sfuTransport'
18
+ | 'samples'
19
+ >
20
+ ) {}
21
+
22
+ public addSample(sfuSctpChannel: SfuSctpChannel) {
23
+ this._samples.push(sfuSctpChannel);
24
+ }
25
+
26
+ public build(sfuTransport: ObservedSfuTransport): ObservedSfuSctpChannel {
27
+ const result: ObservedSfuSctpChannel = {
28
+ sfuTransport,
29
+ ...this._config,
30
+ samples: () => this._samples.values(),
31
+ };
32
+ return result;
33
+ }
34
+ }
35
+
@@ -0,0 +1,130 @@
1
+ import {
2
+ SfuInboundRtpPad,
3
+ SfuOutboundRtpPad,
4
+ SfuSctpChannel,
5
+ SfuTransport,
6
+ } from '@observertc/sample-schemas-js';
7
+ import { ObservedSfu } from './ObservedSfu';
8
+ import { ObservedSfuInboundRtpPad, ObservedSfuInboundRtpPadBuilder } from './ObservedSfuInboundRtpPad';
9
+ import { ObservedSfuOutboundRtpPad, ObservedSfuOutboundRtpPadBuilder } from './ObservedSfuOutboundRtpPad';
10
+ import { ObservedSfuSctpChannel, ObservedSfuSctpChannelBuilder } from './ObservedSfuSctpChannel';
11
+
12
+ export interface ObservedSfuTransport {
13
+ readonly sfu: ObservedSfu;
14
+ readonly transportId: string;
15
+
16
+ inboundRtpPads(): IterableIterator<ObservedSfuInboundRtpPad>;
17
+ outboundRtpPads(): IterableIterator<ObservedSfuOutboundRtpPad>;
18
+ sfuSctpChannels(): IterableIterator<ObservedSfuSctpChannel>;
19
+
20
+ transportSamples(): IterableIterator<SfuTransport>;
21
+ }
22
+
23
+ export class ObservedSfuTransportBuilder {
24
+ private _inboundRtpPads = new Map<string, ObservedSfuInboundRtpPadBuilder>();
25
+ private _outboundRtpPads = new Map<string, ObservedSfuOutboundRtpPadBuilder>();
26
+ private _sctpChannels = new Map<string, ObservedSfuSctpChannelBuilder>();
27
+ private _transportSamples: SfuTransport[] = [];
28
+ public constructor(
29
+ private _config: Omit<
30
+ ObservedSfuTransport,
31
+ | keyof IterableIterator<ObservedSfuTransport>
32
+ | 'sfu'
33
+ | 'inboundRtpPads'
34
+ | 'outboundRtpPads'
35
+ | 'sfuSctpChannels'
36
+ | 'transportSamples'
37
+ >
38
+ ) {}
39
+
40
+ public addTransportSample(transportSample: SfuTransport) {
41
+ this._transportSamples.push(transportSample);
42
+ }
43
+
44
+ public addSfuInboundRtpPad(inboundRtpPad: SfuInboundRtpPad) {
45
+ if (inboundRtpPad.padId) {
46
+ const builder = this._getSfuInboundRtpPadBuilder(inboundRtpPad.padId);
47
+ builder.addSample(inboundRtpPad);
48
+ }
49
+ }
50
+
51
+ private _getSfuInboundRtpPadBuilder(padId: string): ObservedSfuInboundRtpPadBuilder {
52
+ let result = this._inboundRtpPads.get(padId);
53
+ if (!result) {
54
+ result = new ObservedSfuInboundRtpPadBuilder({
55
+ padId,
56
+ });
57
+ this._inboundRtpPads.set(padId, result);
58
+ }
59
+ return result;
60
+ }
61
+
62
+ public addSfuOutboundRtpPad(outboundRtpPad: SfuOutboundRtpPad) {
63
+ if (outboundRtpPad.padId) {
64
+ const builder = this._getSfuOutboundRtpPadBuilder(outboundRtpPad.padId);
65
+ builder.addSample(outboundRtpPad);
66
+ }
67
+ }
68
+
69
+ private _getSfuOutboundRtpPadBuilder(padId: string): ObservedSfuOutboundRtpPadBuilder {
70
+ let result = this._outboundRtpPads.get(padId);
71
+ if (!result) {
72
+ result = new ObservedSfuOutboundRtpPadBuilder({
73
+ padId,
74
+ });
75
+ this._outboundRtpPads.set(padId, result);
76
+ }
77
+ return result;
78
+ }
79
+
80
+ public addSfuSctpChannel(sfuSctpChannel: SfuSctpChannel) {
81
+ if (sfuSctpChannel.channelId) {
82
+ const builder = this._getSfuSctpChannel(sfuSctpChannel.channelId);
83
+ builder.addSample(sfuSctpChannel);
84
+ }
85
+ }
86
+
87
+ private _getSfuSctpChannel(channelId: string): ObservedSfuSctpChannelBuilder {
88
+ let result = this._sctpChannels.get(channelId);
89
+ if (!result) {
90
+ result = new ObservedSfuSctpChannelBuilder({
91
+ channelId,
92
+ });
93
+ this._sctpChannels.set(channelId, result);
94
+ }
95
+ return result;
96
+ }
97
+
98
+ public build(sfu: ObservedSfu): ObservedSfuTransport {
99
+ const sfuInboundRtpPads = new Map<string, ObservedSfuInboundRtpPad>();
100
+ const sfuOutboundRtpPads = new Map<string, ObservedSfuOutboundRtpPad>();
101
+ const sfuSctpChannelsMap = new Map<string, ObservedSfuSctpChannel>();
102
+
103
+ const result: ObservedSfuTransport = {
104
+ sfu,
105
+ ...this._config,
106
+ transportSamples: () => this._transportSamples.values(),
107
+
108
+ inboundRtpPads: () => sfuInboundRtpPads.values(),
109
+ outboundRtpPads: () => sfuOutboundRtpPads.values(),
110
+ sfuSctpChannels: () => sfuSctpChannelsMap.values(),
111
+ };
112
+
113
+ for (const builder of this._inboundRtpPads.values()) {
114
+ const observedInboundRtpPad = builder.build(result);
115
+ sfuInboundRtpPads.set(observedInboundRtpPad.padId, observedInboundRtpPad);
116
+ }
117
+
118
+ for (const builder of this._outboundRtpPads.values()) {
119
+ const observedOutboundRtpPad = builder.build(result);
120
+ sfuOutboundRtpPads.set(observedOutboundRtpPad.padId, observedOutboundRtpPad);
121
+ }
122
+
123
+ for (const builder of this._sctpChannels.values()) {
124
+ const observedSfuSctpChannel = builder.build(result);
125
+ sfuSctpChannelsMap.set(observedSfuSctpChannel.channelId, observedSfuSctpChannel);
126
+ }
127
+
128
+ return result;
129
+ }
130
+ }
@@ -0,0 +1,85 @@
1
+ import { ObservedCall, ObservedCallBuilder } from './ObservedCall';
2
+ import { ObservedSfu, ObservedSfuBuilder } from './ObservedSfu';
3
+
4
+ export interface ObservedSfus {
5
+ sfuIds(): IterableIterator<string>;
6
+ sfuTransportIds(): IterableIterator<string>;
7
+ sfuInboundRtpPadIds(): IterableIterator<string>;
8
+ sfuOutboundRtpPadIds(): IterableIterator<string>;
9
+
10
+ observedSfus(): IterableIterator<ObservedSfu>;
11
+ getObservedSfu(sfuId: string): ObservedSfu | undefined;
12
+ }
13
+
14
+ export class ObservedSfusBuilder {
15
+ private _builders = new Map<string, ObservedSfuBuilder>();
16
+ public constructor() {
17
+ // nothing
18
+ }
19
+
20
+ public getOrCreateObservedSfuBuilder(
21
+ sfuId: string,
22
+ configSupplier: () => ConstructorParameters<typeof ObservedSfuBuilder>[0]
23
+ ) {
24
+ let result = this._builders.get(sfuId);
25
+ if (!result) {
26
+ const config = configSupplier();
27
+ result = new ObservedSfuBuilder(config);
28
+ this._builders.set(sfuId, result);
29
+ }
30
+ return result;
31
+ }
32
+
33
+ public build(): ObservedSfus {
34
+ const observedSfus = new Map<string, ObservedSfu>();
35
+
36
+ const sfuIds = function* (): IterableIterator<string> {
37
+ for (const observedSfu of observedSfus.values()) {
38
+ yield observedSfu.sfuId;
39
+ }
40
+ };
41
+
42
+ const sfuTransportIds = function* (): IterableIterator<string> {
43
+ for (const observedSfu of observedSfus.values()) {
44
+ for (const observedTransport of observedSfu.observedSfuTransports()) {
45
+ yield observedTransport.transportId;
46
+ }
47
+ }
48
+ };
49
+
50
+ const sfuInboundRtpPadIds = function* (): IterableIterator<string> {
51
+ for (const observedSfu of observedSfus.values()) {
52
+ for (const observedTransport of observedSfu.observedSfuTransports()) {
53
+ for (const sfuInboundRtpPad of observedTransport.inboundRtpPads()) {
54
+ yield sfuInboundRtpPad.padId;
55
+ }
56
+ }
57
+ }
58
+ };
59
+
60
+ const sfuOutboundRtpPadIds = function* (): IterableIterator<string> {
61
+ for (const observedSfu of observedSfus.values()) {
62
+ for (const observedTransport of observedSfu.observedSfuTransports()) {
63
+ for (const sfuOutboundRtpPad of observedTransport.outboundRtpPads()) {
64
+ yield sfuOutboundRtpPad.padId;
65
+ }
66
+ }
67
+ }
68
+ };
69
+
70
+
71
+ const result: ObservedSfus = {
72
+ sfuIds,
73
+ sfuTransportIds,
74
+ sfuInboundRtpPadIds,
75
+ sfuOutboundRtpPadIds,
76
+ observedSfus: () => observedSfus.values(),
77
+ getObservedSfu: (sfuId) => observedSfus.get(sfuId),
78
+ };
79
+ for (const builder of this._builders.values()) {
80
+ const observedSfu = builder.build();
81
+ observedSfus.set(observedSfu.sfuId, observedSfu);
82
+ }
83
+ return result;
84
+ }
85
+ }
@@ -37,16 +37,18 @@ export type SinkEventsMap = {
37
37
  'ice-candidate-pair': {
38
38
  reports: IceCandidatePairReport[];
39
39
  };
40
+ 'peer-connection-transport': {
41
+ reports: PeerConnectionTransportReport[];
42
+ };
40
43
  'inbound-audio-track': {
41
44
  reports: InboundAudioTrackReport[];
42
45
  };
43
46
  'inbound-video-track': {
44
47
  reports: InboundVideoTrackReport[];
45
48
  };
46
- 'peer-connection-transport': {
47
- reports: PeerConnectionTransportReport[];
49
+ 'observer-event': {
50
+ reports: ObserverEventReport[]
48
51
  };
49
- 'observer-event': { reports: ObserverEventReport[] };
50
52
  'outbound-audio-track': {
51
53
  reports: OutboundAudioTrackReport[];
52
54
  };
@@ -0,0 +1,23 @@
1
+ import { ClientSample, SfuSample } from '@observertc/sample-schemas-js';
2
+
3
+ export type ObservedSfuSourceConfig = {
4
+ readonly serviceId: string;
5
+ readonly mediaUnitId: string;
6
+ readonly sfuId: string;
7
+ readonly joined: number;
8
+
9
+ timeZoneId?: string;
10
+ };
11
+
12
+ export interface ObservedSfuSource extends ObservedSfuSourceConfig {
13
+ readonly closed: boolean;
14
+
15
+ accept(...samples: SfuSample[]): void;
16
+
17
+ // when you close this, client is disposed. so this triggers the client to dispose
18
+ // therefore this triggers the call to be disposed
19
+ // peer connections, and tracks the creation is evented by the client,
20
+ // the close of those object is evented by the observer or closing this
21
+ // call the close of this is mandatory, as only this closes the client inside the observer
22
+ close(): void;
23
+ }
@@ -1,10 +1,12 @@
1
- import { ClientSample } from '@observertc/sample-schemas-js';
1
+ import { ClientSample, SfuSample } from '@observertc/sample-schemas-js';
2
2
  import { ObservedCalls, ObservedCallsBuilder } from '../samples/ObservedCalls';
3
3
  import { ObservedClientSource, ObservedClientSourceConfig } from './ObservedClientSource';
4
4
  import { EventEmitter } from 'events';
5
5
  import { createLogger } from '../common/logger';
6
6
  import { PartialBy } from '../common/utils';
7
7
  import { ObservedCallSource, ObservedCallSourceConfig } from './ObservedCallSource';
8
+ import { ObservedSfuSourceConfig, ObservedSfuSource } from './ObservedSfuSource';
9
+ import { ObservedSfus, ObservedSfusBuilder } from '../samples/ObservedSfus';
8
10
 
9
11
  const logger = createLogger('Sources');
10
12
 
@@ -16,15 +18,20 @@ export type SourcesConfig = {
16
18
  export type SourcesEvents = {
17
19
  'observed-samples': {
18
20
  observedCalls: ObservedCalls;
21
+ observedSfus: ObservedSfus;
19
22
  numberOfSamples: number;
20
23
  };
21
24
  'removed-client-source': ObservedClientSourceConfig;
22
25
  'added-client-source': ObservedClientSourceConfig;
26
+ 'removed-sfu-source': ObservedSfuSourceConfig;
27
+ 'added-sfu-source': ObservedSfuSourceConfig;
23
28
  };
24
29
 
25
30
  export class Sources {
26
31
  private _clientSources = new Map<string, ObservedClientSource>();
32
+ private _sfuSources = new Map<string, ObservedSfuSource>();
27
33
  private _observedCallsBuilder = new ObservedCallsBuilder();
34
+ private _observedSfusBuilder = new ObservedSfusBuilder();
28
35
  private _emitter = new EventEmitter();
29
36
  private _timer?: ReturnType<typeof setTimeout>;
30
37
  private _numberOfSamples = 0;
@@ -94,6 +101,50 @@ export class Sources {
94
101
  return source;
95
102
  }
96
103
 
104
+ public createSfuSource(config: PartialBy<ObservedSfuSourceConfig, 'joined'>): ObservedSfuSource {
105
+ const existingSfuSource = this._sfuSources.get(config.sfuId);
106
+ if (existingSfuSource) {
107
+ logger.warn(`Attempted to add a SfuSource for sfu ${config.sfuId} twice`);
108
+ return existingSfuSource;
109
+ }
110
+ let closed = false;
111
+ // config.joined = config.joined ?? Date.now();
112
+ const source: ObservedSfuSource = {
113
+ ...config,
114
+ joined: config.joined ?? Date.now(),
115
+
116
+ accept: (...samples: SfuSample[]) => {
117
+ if (closed) {
118
+ throw new Error('Closed ClientSource cannot accept samples');
119
+ }
120
+ const observedSfuBuilder = this._observedSfusBuilder.getOrCreateObservedSfuBuilder(config.sfuId, () => {
121
+ return {
122
+ ...source,
123
+ };
124
+ });
125
+
126
+ for (const sample of samples) {
127
+ observedSfuBuilder.addSfuSample(sample);
128
+ }
129
+ this._incrementSamples(samples.length);
130
+ },
131
+ close: () => {
132
+ if (closed) {
133
+ return;
134
+ }
135
+ closed = true;
136
+ this._emit('removed-sfu-source', source);
137
+ },
138
+ closed,
139
+ };
140
+ if (this._sfuSources.size < 1) {
141
+ this._resetTimer();
142
+ }
143
+ this._sfuSources.set(config.sfuId, source);
144
+ this._emit('added-sfu-source', source);
145
+ return source;
146
+ }
147
+
97
148
  private _incrementSamples(increment = 1) {
98
149
  this._numberOfSamples += increment;
99
150
  if (this.config.maxSamples < 1 || this._numberOfSamples < this.config.maxSamples) {
@@ -106,10 +157,10 @@ export class Sources {
106
157
  this._resetTimer();
107
158
  const observedCalls = this._observedCallsBuilder.build();
108
159
  this._observedCallsBuilder = new ObservedCallsBuilder();
109
-
160
+ const observedSfus = this._observedSfusBuilder.build();
110
161
  this._emit('observed-samples', {
111
162
  observedCalls,
112
- // observedSfus,
163
+ observedSfus,
113
164
  numberOfSamples: this._numberOfSamples,
114
165
  });
115
166
  this._numberOfSamples = 0;
@@ -1,4 +1,3 @@
1
- import { StorageFactory } from './StorageFactory';
2
1
  import { ObserverStorage } from './ObserverStorage';
3
2
  import * as Models from '../models/Models';
4
3
  import { SimpleStorage } from './SimpleStorage';
@@ -25,9 +24,7 @@ export function createSimpleStorageProvider(): StorageProvider {
25
24
  const sfuStorage = new SimpleStorage<string, Models.Sfu>('ObserverSfuStorage');
26
25
  const sfuTransportStorage = new SimpleStorage<string, Models.SfuTransport>('ObserverSfuTransportStorage');
27
26
  const sfuInboundRtpPadStorage = new SimpleStorage<string, Models.SfuInboundRtpPad>('ObserverSfuInboundRtpPadStorage');
28
- const sfuOutboundRtpPadStorage = new SimpleStorage<string, Models.SfuOutboundRtpPad>(
29
- 'ObserverSfuOutboundRtpPadStorage'
30
- );
27
+ const sfuOutboundRtpPadStorage = new SimpleStorage<string, Models.SfuOutboundRtpPad>('ObserverSfuOutboundRtpPadStorage');
31
28
  const sfuSctpChannelStorage = new SimpleStorage<string, Models.SfuSctpChannel>('ObserverSfuSctpChannelStorage');
32
29
 
33
30
  return {
@@ -1 +0,0 @@
1
- {"version":3,"file":"visitOutboundVideoTarcks.d.ts","sourceRoot":"","sources":["../../../src/middlewares/visitors/visitOutboundVideoTarcks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAKtF,wBAAgB,uBAAuB,CACtC,0BAA0B,EAAE,0BAA0B,EACtD,oBAAoB,EAAE,MAAM,CAAC,cAAc,EAC3C,oBAAoB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,EACvD,OAAO,EAAE,gBAAgB,EACzB,YAAY,EAAE,OAAO,QAiFrB"}
@@ -1,27 +0,0 @@
1
- import { ObserverStorage } from './ObserverStorage';
2
- import * as Models from '../models/Models';
3
- export interface StorageFactory {
4
- createCallStorage(): Promise<ObserverStorage<string, Models.Call>>;
5
- createClientStorage(): Promise<ObserverStorage<string, Models.Client>>;
6
- createPeerConnectionStorage(): Promise<ObserverStorage<string, Models.PeerConnection>>;
7
- createInboundTrackStorage(): Promise<ObserverStorage<string, Models.InboundTrack>>;
8
- createOutboundTrackStorage(): Promise<ObserverStorage<string, Models.OutboundTrack>>;
9
- createSfuStorage(): Promise<ObserverStorage<string, Models.Sfu>>;
10
- createSfuTransportStorage(): Promise<ObserverStorage<string, Models.SfuTransport>>;
11
- createSfuInboundRtpPadStorage(): Promise<ObserverStorage<string, Models.SfuInboundRtpPad>>;
12
- createSfuOutboundRtpPadStorage(): Promise<ObserverStorage<string, Models.SfuOutboundRtpPad>>;
13
- createSfuSctpChannelStorage(): Promise<ObserverStorage<string, Models.SfuSctpChannel>>;
14
- }
15
- export declare class MapBasedStorageFactory implements StorageFactory {
16
- createCallStorage(): Promise<ObserverStorage<string, Models.Call>>;
17
- createClientStorage(): Promise<ObserverStorage<string, Models.Client>>;
18
- createPeerConnectionStorage(): Promise<ObserverStorage<string, Models.PeerConnection>>;
19
- createInboundTrackStorage(): Promise<ObserverStorage<string, Models.InboundTrack>>;
20
- createOutboundTrackStorage(): Promise<ObserverStorage<string, Models.OutboundTrack>>;
21
- createSfuStorage(): Promise<ObserverStorage<string, Models.Sfu>>;
22
- createSfuTransportStorage(): Promise<ObserverStorage<string, Models.SfuTransport>>;
23
- createSfuInboundRtpPadStorage(): Promise<ObserverStorage<string, Models.SfuInboundRtpPad>>;
24
- createSfuOutboundRtpPadStorage(): Promise<ObserverStorage<string, Models.SfuOutboundRtpPad>>;
25
- createSfuSctpChannelStorage(): Promise<ObserverStorage<string, Models.SfuSctpChannel>>;
26
- }
27
- //# sourceMappingURL=StorageFactory.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StorageFactory.d.ts","sourceRoot":"","sources":["../../src/storages/StorageFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAG3C,MAAM,WAAW,cAAc;IAC9B,iBAAiB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IACnE,mBAAmB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACvE,2BAA2B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IACvF,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IACnF,0BAA0B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;IACrF,gBAAgB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IACnF,6BAA6B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAC3F,8BAA8B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC7F,2BAA2B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;CACvF;AAED,qBAAa,sBAAuB,YAAW,cAAc;IAC/C,iBAAiB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAIlE,mBAAmB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAItE,2BAA2B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;IAItF,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAIlF,0BAA0B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IAIpF,gBAAgB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAIhE,yBAAyB,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IAIlF,6BAA6B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,gBAAgB,CAAC,CAAC;IAI1F,8BAA8B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAI5F,2BAA2B,IAAI,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC;CAGnG"}
@@ -1,37 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MapBasedStorageFactory = void 0;
4
- const SimpleStorage_1 = require("./SimpleStorage");
5
- class MapBasedStorageFactory {
6
- async createCallStorage() {
7
- return new SimpleStorage_1.SimpleStorage('ObserverCallStorage');
8
- }
9
- async createClientStorage() {
10
- return new SimpleStorage_1.SimpleStorage('ObserverClientStorage');
11
- }
12
- async createPeerConnectionStorage() {
13
- return new SimpleStorage_1.SimpleStorage('ObserverPeerConnectionStorage');
14
- }
15
- async createInboundTrackStorage() {
16
- return new SimpleStorage_1.SimpleStorage('ObserverInboundTrackStorage');
17
- }
18
- async createOutboundTrackStorage() {
19
- return new SimpleStorage_1.SimpleStorage('ObserverOutboundTrackStorage');
20
- }
21
- async createSfuStorage() {
22
- return new SimpleStorage_1.SimpleStorage('ObserverSfuStorage');
23
- }
24
- async createSfuTransportStorage() {
25
- return new SimpleStorage_1.SimpleStorage('ObserverSfuTransportStorage');
26
- }
27
- async createSfuInboundRtpPadStorage() {
28
- return new SimpleStorage_1.SimpleStorage('ObserverSfuInboundRtpPadStorage');
29
- }
30
- async createSfuOutboundRtpPadStorage() {
31
- return new SimpleStorage_1.SimpleStorage('ObserverSfuOutboundRtpPadStorage');
32
- }
33
- async createSfuSctpChannelStorage() {
34
- return new SimpleStorage_1.SimpleStorage('ObserverSfuSctpChannelStorage');
35
- }
36
- }
37
- exports.MapBasedStorageFactory = MapBasedStorageFactory;
@@ -1,58 +0,0 @@
1
- import { ObserverStorage } from './ObserverStorage';
2
- import * as Models from '../models/Models';
3
- import { SimpleStorage } from './SimpleStorage';
4
-
5
- export interface StorageFactory {
6
- createCallStorage(): Promise<ObserverStorage<string, Models.Call>>;
7
- createClientStorage(): Promise<ObserverStorage<string, Models.Client>>;
8
- createPeerConnectionStorage(): Promise<ObserverStorage<string, Models.PeerConnection>>;
9
- createInboundTrackStorage(): Promise<ObserverStorage<string, Models.InboundTrack>>;
10
- createOutboundTrackStorage(): Promise<ObserverStorage<string, Models.OutboundTrack>>;
11
- createSfuStorage(): Promise<ObserverStorage<string, Models.Sfu>>;
12
- createSfuTransportStorage(): Promise<ObserverStorage<string, Models.SfuTransport>>;
13
- createSfuInboundRtpPadStorage(): Promise<ObserverStorage<string, Models.SfuInboundRtpPad>>;
14
- createSfuOutboundRtpPadStorage(): Promise<ObserverStorage<string, Models.SfuOutboundRtpPad>>;
15
- createSfuSctpChannelStorage(): Promise<ObserverStorage<string, Models.SfuSctpChannel>>;
16
- }
17
-
18
- export class MapBasedStorageFactory implements StorageFactory {
19
- public async createCallStorage(): Promise<ObserverStorage<string, Models.Call>> {
20
- return new SimpleStorage<string, Models.Call>('ObserverCallStorage');
21
- }
22
-
23
- public async createClientStorage(): Promise<ObserverStorage<string, Models.Client>> {
24
- return new SimpleStorage<string, Models.Client>('ObserverClientStorage');
25
- }
26
-
27
- public async createPeerConnectionStorage(): Promise<ObserverStorage<string, Models.PeerConnection>> {
28
- return new SimpleStorage<string, Models.PeerConnection>('ObserverPeerConnectionStorage');
29
- }
30
-
31
- public async createInboundTrackStorage(): Promise<ObserverStorage<string, Models.InboundTrack>> {
32
- return new SimpleStorage<string, Models.InboundTrack>('ObserverInboundTrackStorage');
33
- }
34
-
35
- public async createOutboundTrackStorage(): Promise<ObserverStorage<string, Models.OutboundTrack>> {
36
- return new SimpleStorage<string, Models.OutboundTrack>('ObserverOutboundTrackStorage');
37
- }
38
-
39
- public async createSfuStorage(): Promise<ObserverStorage<string, Models.Sfu>> {
40
- return new SimpleStorage<string, Models.Sfu>('ObserverSfuStorage');
41
- }
42
-
43
- public async createSfuTransportStorage(): Promise<ObserverStorage<string, Models.SfuTransport>> {
44
- return new SimpleStorage<string, Models.SfuTransport>('ObserverSfuTransportStorage');
45
- }
46
-
47
- public async createSfuInboundRtpPadStorage(): Promise<ObserverStorage<string, Models.SfuInboundRtpPad>> {
48
- return new SimpleStorage<string, Models.SfuInboundRtpPad>('ObserverSfuInboundRtpPadStorage');
49
- }
50
-
51
- public async createSfuOutboundRtpPadStorage(): Promise<ObserverStorage<string, Models.SfuOutboundRtpPad>> {
52
- return new SimpleStorage<string, Models.SfuOutboundRtpPad>('ObserverSfuOutboundRtpPadStorage');
53
- }
54
-
55
- public async createSfuSctpChannelStorage(): Promise<ObserverStorage<string, Models.SfuSctpChannel>> {
56
- return new SimpleStorage<string, Models.SfuSctpChannel>('ObserverSfuSctpChannelStorage');
57
- }
58
- }