Skip to content

Commit

Permalink
Deploying to gh-pages from @ 2c47490 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
aboba committed Sep 11, 2024
1 parent f9bedd9 commit e09ed27
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions samples/encode-decode-worker/js/main.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -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
};
}

Expand Down Expand Up @@ -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 [email protected]
config.hevc = { format: "annexb" };
config.pt = 2;
break;
Expand All @@ -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;
}
Expand Down

0 comments on commit e09ed27

Please sign in to comment.