@100mslive/hms-video-store 0.13.2-alpha.4 → 0.13.2-alpha.6

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,5 +1,5 @@
1
1
  {
2
- "version": "0.13.2-alpha.4",
2
+ "version": "0.13.2-alpha.6",
3
3
  "license": "MIT",
4
4
  "repository": {
5
5
  "type": "git",
@@ -73,5 +73,5 @@
73
73
  "conferencing",
74
74
  "100ms"
75
75
  ],
76
- "gitHead": "94890263c80668495d3069f378a04a6d5e8ab11c"
76
+ "gitHead": "b68f0630c63c6de29580cc131feed91934825cfb"
77
77
  }
@@ -175,7 +175,7 @@ export abstract class RunningTrackAnalytics {
175
175
  protected calculateAverage(key: keyof TempStats, round = true) {
176
176
  const sum = this.calculateSum(key);
177
177
  const avg = sum !== undefined ? sum / this.tempStats.length : undefined;
178
- return avg ? (round ? Math.round(avg) : avg) : undefined;
178
+ return avg !== undefined ? (round ? Math.round(avg) : avg) : undefined;
179
179
  }
180
180
 
181
181
  protected calculateDifferenceForSample(key: keyof TempStats) {
@@ -154,6 +154,7 @@ class RunningLocalTrackAnalytics extends RunningTrackAnalytics {
154
154
  };
155
155
 
156
156
  protected collateSample = (): LocalBaseSample | LocalVideoSample => {
157
+ const firstStat = this.getFirstStat();
157
158
  const latestStat = this.getLatestStat();
158
159
 
159
160
  const resolution = latestStat.frameHeight
@@ -172,6 +173,9 @@ class RunningLocalTrackAnalytics extends RunningTrackAnalytics {
172
173
  const effects_metrics = this.track.getPluginsMetrics?.();
173
174
  return removeUndefinedFromObject({
174
175
  timestamp: Date.now(),
176
+ sample_start_ts: firstStat.timestamp,
177
+ sample_end_ts: latestStat.timestamp,
178
+ sample_duration_ms: latestStat.timestamp - firstStat.timestamp,
175
179
  avg_available_outgoing_bitrate_bps: this.calculateAverage('availableOutgoingBitrate'),
176
180
  avg_bitrate_bps: this.calculateAverage('bitrate'),
177
181
  avg_fps: this.calculateAverage('framesPerSecond'),
@@ -136,9 +136,13 @@ class RunningRemoteTrackAnalytics extends RunningTrackAnalytics {
136
136
 
137
137
  const baseSample = {
138
138
  timestamp: Date.now(),
139
+ sample_start_ts: firstStat.timestamp,
140
+ sample_end_ts: latestStat.timestamp,
141
+ sample_duration_ms: latestStat.timestamp - firstStat.timestamp,
139
142
  total_pli_count: this.calculateDifferenceForSample('pliCount'),
140
143
  total_nack_count: this.calculateDifferenceForSample('nackCount'),
141
144
  avg_jitter_buffer_delay: this.calculateAverage('calculatedJitterBufferDelay', false),
145
+ avg_bitrate_bps: this.calculateAverage('bitrate'),
142
146
  };
143
147
 
144
148
  if (latestStat.kind === 'video') {
@@ -33,6 +33,9 @@ export type RemoteVideoTrackAnalytics = TrackAnalytics<RemoteVideoSample>;
33
33
  // One sample would contain the data of the last 30 seconds window
34
34
  export interface LocalBaseSample {
35
35
  timestamp: number; // the ts at the end of the 30s window
36
+ sample_start_ts?: number; // WebRTC timestamp of the first stat in the sample window
37
+ sample_end_ts?: number; // WebRTC timestamp of the last stat in the sample window
38
+ sample_duration_ms?: number; // Duration of the sample window in milliseconds
36
39
  avg_round_trip_time_ms?: number;
37
40
  avg_jitter_ms?: number;
38
41
  total_packets_lost?: number;
@@ -74,8 +77,12 @@ export interface Resolution {
74
77
 
75
78
  interface RemoteBaseSample {
76
79
  timestamp: number;
80
+ sample_start_ts?: number; // WebRTC timestamp of the first stat in the sample window
81
+ sample_end_ts?: number; // WebRTC timestamp of the last stat in the sample window
82
+ sample_duration_ms?: number; // Duration of the sample window in milliseconds
77
83
  estimated_playout_timestamp?: number;
78
84
  avg_jitter_buffer_delay?: number;
85
+ avg_bitrate_bps?: number;
79
86
  }
80
87
 
81
88
  export interface RemoteAudioSample extends RemoteBaseSample {