Skip to content

Commit 9bc20d1

Browse files
committed
only report quality score on streaming
1 parent c477ed1 commit 9bc20d1

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

peer/src/peer.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -328,18 +328,24 @@ export class Peer {
328328
const rawStats = await sess.getStats();
329329
const at = Date.now() * 1_000;
330330
const stats = collectWebRTCStats(rawStats);
331-
const quality = calculateWebRTCQuality(stats);
332-
333-
events.push({
334-
timestampUs: BigInt(at),
335-
tags: {
336-
src: this.transport.info,
337-
dst: sess.other,
338-
},
339-
metrics: {
340-
qualityScore: BigInt(quality),
341-
},
342-
});
331+
332+
if (
333+
stats.audio.length != 0 ||
334+
stats.video.length != 0 && stats.data.length != 0
335+
) {
336+
const quality = calculateWebRTCQuality(stats);
337+
338+
events.push({
339+
timestampUs: BigInt(at),
340+
tags: {
341+
src: this.transport.info,
342+
dst: sess.other,
343+
},
344+
metrics: {
345+
qualityScore: BigInt(quality),
346+
},
347+
});
348+
}
343349
}
344350

345351
const request: AnalyticsReportReq = { events };

0 commit comments

Comments
 (0)