@pexip/peer-connection-stats 18.1.0 → 18.3.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 18.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 27d9dd7: Expose `quality` from `onRtcStats` signal.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [adc1a50]
12
+ - @pexip/utils@17.0.1
13
+ - @pexip/signal@16.9.0
14
+
15
+ ## 18.2.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 7f9df17: Expose `qualityLimitationDurations` and `qualityLimitationReason`.
20
+
21
+ ### Patch Changes
22
+
23
+ - 709232f: Correct typedoc comment to fix the document generation.
24
+ - Updated dependencies [6fddc11]
25
+ - @pexip/signal@16.9.0
26
+ - @pexip/utils@17.0.0
27
+
3
28
  ## 18.1.0
4
29
 
5
30
  ### Minor Changes
package/README.md CHANGED
@@ -8,6 +8,6 @@ Helps with normalization of data from `RTCStats` and friends.
8
8
 
9
9
  Related documentation:
10
10
 
11
- - <https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_Statistics_API>
12
- - <https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport>
13
- - <https://developer.mozilla.org/en-US/docs/Web/API/RTCStats>
11
+ - [https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_Statistics_API](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_Statistics_API)
12
+ - [https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport](https://developer.mozilla.org/en-US/docs/Web/API/RTCStatsReport)
13
+ - [https://developer.mozilla.org/en-US/docs/Web/API/RTCStats](https://developer.mozilla.org/en-US/docs/Web/API/RTCStats)
@@ -97,6 +97,7 @@ export declare const addDeltaStats: (newStats: NormalizedRTCStats, cache: CacheS
97
97
  timestamp?: number;
98
98
  totalPercentageLost?: number;
99
99
  timeToCaptureStats?: number;
100
+ quality?: Quality;
100
101
  } | {
101
102
  framesPerSecond?: number;
102
103
  resolution?: string;
@@ -116,6 +117,7 @@ export declare const addDeltaStats: (newStats: NormalizedRTCStats, cache: CacheS
116
117
  timestamp?: number;
117
118
  totalPercentageLost?: number;
118
119
  timeToCaptureStats?: number;
120
+ quality?: Quality;
119
121
  averageDecodeTime?: number;
120
122
  } | {
121
123
  framesPerSecond?: number;
@@ -136,9 +138,12 @@ export declare const addDeltaStats: (newStats: NormalizedRTCStats, cache: CacheS
136
138
  timestamp?: number;
137
139
  totalPercentageLost?: number;
138
140
  timeToCaptureStats?: number;
141
+ quality?: Quality;
139
142
  totalPacketSendDelay?: number;
140
143
  averagePacketSendDelay?: number;
141
144
  averageEncodeTime?: number;
145
+ qualityLimitationReason?: OutboundVideo["qualityLimitationReason"];
146
+ qualityLimitationDurations?: OutboundVideo["qualityLimitationDurations"];
142
147
  }, Quality, CallQualityStats];
143
148
  export declare const calculateQuality: (stats: number | [number, number]) => Quality;
144
149
  /**
@@ -148,6 +153,6 @@ export declare const calculateQuality: (stats: number | [number, number]) => Qua
148
153
  * @param signal - Signal which distributes stats
149
154
  * @param interval - how often signal with fire with new stats
150
155
  *
151
- * @returns \{function to reset stats window, cleanup func\}
156
+ * @returns {Object} function to reset stats window, cleanup func
152
157
  */
153
158
  export declare const createStatsCollector: ({ input, signals: { onCallQuality, onCallQualityStats, onRtcStats }, interval, }: StatsCollectorOptions) => StatsCollector;
@@ -224,6 +224,8 @@ export const outboundVideo = (statsData) => {
224
224
  averageEncodeTime: statsData.framesEncoded && statsData.totalEncodeTime
225
225
  ? statsData.totalEncodeTime / statsData.framesEncoded
226
226
  : 0,
227
+ qualityLimitationReason: statsData.qualityLimitationReason,
228
+ qualityLimitationDurations: statsData.qualityLimitationDurations,
227
229
  };
228
230
  };
229
231
  const isInbound = (entry) => entry.type === 'inbound-rtp';
@@ -442,11 +444,9 @@ export const addDeltaStats = (newStats, cache) => {
442
444
  }
443
445
  });
444
446
  const callQualityStats = recordCallQualityStats(oldStats, deltaStats, cache.callQualityStats);
445
- return [
446
- deltaStats,
447
- getQuality(callQualityStats ?? []).quality,
448
- callQualityStats,
449
- ];
447
+ const quality = getQuality(callQualityStats ?? []).quality;
448
+ deltaStats.quality = quality;
449
+ return [deltaStats, quality, callQualityStats];
450
450
  };
451
451
  // https://docs.pexip.com/admin/media_statistics.htm
452
452
  export const calculateQuality = (stats) => {
@@ -493,7 +493,7 @@ export const calculateQuality = (stats) => {
493
493
  * @param signal - Signal which distributes stats
494
494
  * @param interval - how often signal with fire with new stats
495
495
  *
496
- * @returns \{function to reset stats window, cleanup func\}
496
+ * @returns {Object} function to reset stats window, cleanup func
497
497
  */
498
498
  export const createStatsCollector = ({ input, signals: { onCallQuality, onCallQualityStats, onRtcStats }, interval = 1000, }) => {
499
499
  const newCache = () => ({
@@ -86,6 +86,10 @@ export interface OutboundVideo extends RTCStats {
86
86
  framesEncoded?: number;
87
87
  bitrateMean?: number;
88
88
  framerateMean?: number;
89
+ qualityLimitationReason?: 'cpu' | 'bandwidth' | 'other' | 'none';
90
+ qualityLimitationDurations?: {
91
+ [key in NonNullable<OutboundVideo['qualityLimitationReason']>]?: number;
92
+ };
89
93
  }
90
94
  export interface MediaSource extends RTCStats {
91
95
  type: 'media-source';
@@ -115,6 +119,7 @@ export interface Metrics {
115
119
  timestamp?: number;
116
120
  totalPercentageLost?: number;
117
121
  timeToCaptureStats?: number;
122
+ quality?: Quality;
118
123
  }
119
124
  export interface VideoMetrics extends Metrics {
120
125
  framesPerSecond?: number;
@@ -132,6 +137,8 @@ export type OutboundVideoMetrics = VideoMetrics & {
132
137
  totalPacketSendDelay?: number;
133
138
  averagePacketSendDelay?: number;
134
139
  averageEncodeTime?: number;
140
+ qualityLimitationReason?: OutboundVideo['qualityLimitationReason'];
141
+ qualityLimitationDurations?: OutboundVideo['qualityLimitationDurations'];
135
142
  };
136
143
  export type NormalizedRTCStats = InboundAudioMetrics | InboundVideoMetrics | OutboundAudioMetrics | OutboundVideoMetrics;
137
144
  export type PacketsStats = [number, number][];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pexip/peer-connection-stats",
3
- "version": "18.1.0",
3
+ "version": "18.3.0",
4
4
  "description": "Normalizer of RTCStats and related",
5
5
  "homepage": "https://gitlab.com/pexip/zoo",
6
6
  "bugs": "https://gitlab.com/pexip/zoo/issues",
@@ -40,11 +40,11 @@
40
40
  "typecheck": "yarn tsc --noEmit -p ."
41
41
  },
42
42
  "dependencies": {
43
- "@pexip/signal": "16.8.0",
44
- "@pexip/utils": "17.0.0"
43
+ "@pexip/signal": "16.9.0",
44
+ "@pexip/utils": "17.0.1"
45
45
  },
46
46
  "devDependencies": {
47
- "@pexip/bundler": "18.1.0",
47
+ "@pexip/bundler": "18.1.2",
48
48
  "@swc/core": "^1.10.12",
49
49
  "@swc/jest": "^0.2.37",
50
50
  "jest": "^29.5.12",