@@ -27,6 +27,11 @@ const maxPeerDisconnectedMs = Number(
2727 process . env . SIMDECK_E2E_MAX_PEER_DISCONNECTED_MS ?? 1000 ,
2828) ;
2929const maxDecoderDrops = Number ( process . env . SIMDECK_E2E_MAX_DECODER_DROPS ?? 0 ) ;
30+ const minVideoWidth = Number ( process . env . SIMDECK_E2E_MIN_VIDEO_WIDTH ?? 0 ) ;
31+ const minVideoHeight = Number ( process . env . SIMDECK_E2E_MIN_VIDEO_HEIGHT ?? 0 ) ;
32+ const minDecodedFps = Number ( process . env . SIMDECK_E2E_MIN_DECODED_FPS ?? 0 ) ;
33+ const minPresentedFps = Number ( process . env . SIMDECK_E2E_MIN_PRESENTED_FPS ?? 0 ) ;
34+ const minReceivedFps = Number ( process . env . SIMDECK_E2E_MIN_RECEIVED_FPS ?? 0 ) ;
3035const visualSampleIntervalMs = Number (
3136 process . env . SIMDECK_E2E_VISUAL_SAMPLE_INTERVAL_MS ?? 5000 ,
3237) ;
@@ -406,6 +411,13 @@ try {
406411 directStatsEnd . packetsReceived - directStatsStart . packetsReceived ;
407412 const directPresentedDelta =
408413 directStatsEnd . totalVideoFrames - directStatsStart . totalVideoFrames ;
414+ const observedDurationSeconds = Math . max (
415+ 0.001 ,
416+ ( directStatsEnd . timestampMs - directStatsStart . timestampMs ) / 1000 ,
417+ ) ;
418+ const decodedFps = directDecodedDelta / observedDurationSeconds ;
419+ const presentedFps = directPresentedDelta / observedDurationSeconds ;
420+ const receivedFps = directPacketsDelta / observedDurationSeconds ;
409421
410422 if ( decodedDelta <= 0 || receivedDelta <= 0 ) {
411423 failures . push (
@@ -429,6 +441,41 @@ try {
429441 if ( reconnectDelta > 0 ) {
430442 failures . push ( `peer reconnected ${ reconnectDelta } times` ) ;
431443 }
444+ const finalVideoWidth = Math . max (
445+ numeric ( finalPage . width ) ,
446+ numeric ( finalWebRtc . width ) ,
447+ numeric ( directStatsEnd . videoWidth ) ,
448+ ) ;
449+ const finalVideoHeight = Math . max (
450+ numeric ( finalPage . height ) ,
451+ numeric ( finalWebRtc . height ) ,
452+ numeric ( directStatsEnd . videoHeight ) ,
453+ ) ;
454+ if ( minVideoWidth > 0 && finalVideoWidth < minVideoWidth ) {
455+ failures . push (
456+ `video width ${ finalVideoWidth } did not meet minimum ${ minVideoWidth } ` ,
457+ ) ;
458+ }
459+ if ( minVideoHeight > 0 && finalVideoHeight < minVideoHeight ) {
460+ failures . push (
461+ `video height ${ finalVideoHeight } did not meet minimum ${ minVideoHeight } ` ,
462+ ) ;
463+ }
464+ if ( minDecodedFps > 0 && decodedFps < minDecodedFps ) {
465+ failures . push (
466+ `decoded fps ${ decodedFps . toFixed ( 2 ) } did not meet minimum ${ minDecodedFps } ` ,
467+ ) ;
468+ }
469+ if ( minPresentedFps > 0 && presentedFps < minPresentedFps ) {
470+ failures . push (
471+ `presented fps ${ presentedFps . toFixed ( 2 ) } did not meet minimum ${ minPresentedFps } ` ,
472+ ) ;
473+ }
474+ if ( minReceivedFps > 0 && receivedFps < minReceivedFps ) {
475+ failures . push (
476+ `received packet fps ${ receivedFps . toFixed ( 2 ) } did not meet minimum ${ minReceivedFps } ` ,
477+ ) ;
478+ }
432479 if ( maxPeerDisconnectedObservedMs > maxPeerDisconnectedMs ) {
433480 failures . push (
434481 `peer disconnected for ${ maxPeerDisconnectedObservedMs } ms, exceeded ${ maxPeerDisconnectedMs } ms` ,
@@ -480,8 +527,14 @@ try {
480527 durationMs,
481528 finalPage,
482529 finalWebRtc,
530+ finalVideoHeight,
531+ finalVideoWidth,
483532 initialPage,
484533 initialWebRtc,
534+ observedDurationSeconds,
535+ decodedFps,
536+ presentedFps,
537+ receivedFps,
485538 maxObservedDecodeQueue,
486539 maxObservedFrameGapMs,
487540 maxPeerDisconnectedMs,
@@ -601,12 +654,15 @@ async function collectDirectWebRtcStats(cdp) {
601654 (async () => {
602655 const totals = {
603656 framesDecoded: 0,
604- framesDropped: 0,
605- jitter: 0,
606- packetsLost: 0,
607- packetsReceived: 0,
608- totalVideoFrames: 0,
609- };
657+ framesDropped: 0,
658+ jitter: 0,
659+ packetsLost: 0,
660+ packetsReceived: 0,
661+ timestampMs: Date.now(),
662+ totalVideoFrames: 0,
663+ videoHeight: 0,
664+ videoWidth: 0,
665+ };
610666 for (const pc of window.__simdeckPeerConnections || []) {
611667 const reports = await pc.getStats();
612668 for (const report of reports.values()) {
@@ -622,6 +678,8 @@ async function collectDirectWebRtcStats(cdp) {
622678 for (const video of document.querySelectorAll("video.stream-video")) {
623679 const quality = video.getVideoPlaybackQuality?.();
624680 totals.totalVideoFrames += quality?.totalVideoFrames || 0;
681+ totals.videoWidth = Math.max(totals.videoWidth, video.videoWidth || 0);
682+ totals.videoHeight = Math.max(totals.videoHeight, video.videoHeight || 0);
625683 }
626684 return totals;
627685 })()
0 commit comments