From e09ed27a4ab1599e21c96d6964edf0e9be3aa6b2 Mon Sep 17 00:00:00 2001 From: aboba Date: Wed, 11 Sep 2024 13:52:26 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20w3c/webc?= =?UTF-8?q?odecs@2c47490654fdc90019ccf484b7d7122cac213c04=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- samples/encode-decode-worker/js/main.js | 32 +++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/samples/encode-decode-worker/js/main.js b/samples/encode-decode-worker/js/main.js index b7ddb5c5..825dded5 100644 --- a/samples/encode-decode-worker/js/main.js +++ b/samples/encode-decode-worker/js/main.js @@ -1,7 +1,7 @@ 'use strict'; let preferredResolution; -let mediaStream, bitrate = 100000; +let mediaStream, bitrate = 300000; let stopped = false; let preferredCodec ="H264"; let mode = "L1T1"; @@ -59,27 +59,34 @@ function metrics_update(data) { function metrics_report() { metrics.all.sort((a, b) => { - return (100000 * (a.mediaTime - b.mediaTime) + a.output - b.output); + return (100000 * (b.captureTime - a.captureTime) + b.output - a.output); }); + //addToEventLog('Metrics dump: ' + JSON.stringify(metrics.all)); const len = metrics.all.length; - let j = 0; + if (len < 2) return; for (let i = 0; i < len ; i++ ) { if (metrics.all[i].output == 1) { const frameno = metrics.all[i].presentedFrames; - const g2g = metrics.all[i].expectedDisplayTime - metrics.all[i-1].captureTime; + const fps = metrics.all[i].fps; + const elapsed = metrics.all[i].elapsed; const mediaTime = metrics.all[i].mediaTime; - const captureTime = metrics.all[i-1].captureTime; + const captureTime = metrics.all[i].captureTime; const expectedDisplayTime = metrics.all[i].expectedDisplayTime; - const delay = metrics.all[i].expectedDisplayTime - metrics.all[i-1].expectedDisplayTime; + const processingDuration = metrics.all[i].processingDuration; + const receiveTime = metrics.all[i].receiveTime; + const rtpTimestamp = metrics.all[i].rtpTimestamp; + const g2g = Math.max(0, expectedDisplayTime - captureTime); const data = [frameno, g2g]; - const info = {frameno: frameno, g2g: g2g, mediaTime: mediaTime, captureTime: captureTime, expectedDisplayTime: expectedDisplayTime, delay: delay}; + const info = {frameno: frameno, elapsed: elapsed, g2g: g2g, captureTime: captureTime, expectedDisplayTime: expectedDisplayTime, + processingDuration: processingDuration, fps: fps, mediaTime: mediaTime, rtpTimestamp: rtpTimestamp, receiveTime: receiveTime}; e2e.all.push(data); display_metrics.all.push(info); } } - // addToEventLog('Data dump: ' + JSON.stringify(e2e.all)); + //addToEventLog('E2E Data dump: ' + JSON.stringify(e2e.all)); + //addToEventLog('Output Data dump: ' + JSON.stringify(display_metrics.all)); return { - count: e2e.all.length + count: metrics.all.length }; } @@ -387,13 +394,14 @@ document.addEventListener('DOMContentLoaded', async function(event) { switch(preferredCodec){ case "H264": - config.codec = "avc1.42002A"; // baseline profile, level 4.2 + config.codec = "avc1.42002A"; // baseline profile, level 4.2 /* config.codec = "avc1.640028"; */ config.avc = { format: "annexb" }; config.pt = 1; break; case "H265": - config.codec = "hvc1.1.6.L123.00"; // Main profile, level 4.1, main Tier + config.codec = "hvc1.1.6.L120.00"; // Main profile, level 4.0, main Tier + // config.codec = "hev1.1.6.L93.B0"; // Main profile, level 3.1, up to 1280 x 720@33.7 config.hevc = { format: "annexb" }; config.pt = 2; break; @@ -406,7 +414,7 @@ document.addEventListener('DOMContentLoaded', async function(event) { config.pt = 4; break; case "AV1": - config.codec = "av01.0.08M.10.0.110.09" // AV1 Main Profile, level 4.0, Main tier, 10-bit content, non-monochrome, with 4:2:0 chroma subsampling + config.codec = "av01.0.08M.08.0.110.09" // AV1 Main Profile, level 4.0, Main tier, 8-bit content, non-monochrome, with 4:2:0 chroma subsampling config.pt = 5; break; }