Skip to content

Commit 8526db4

Browse files
abobadalecurtis
authored andcommitted
Cleanup debug messages
1 parent 9a92fb5 commit 8526db4

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

samples/encode-decode-worker/js/main.js

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,6 @@ const tv4KConstraints = {video: {width: {exact: 3840}, height: {exact: 2160}}}
3333
const cinema4KConstraints = {video: {width: {exact: 4096}, height: {exact: 2160}}};
3434
const eightKConstraints = {video: {width: {min: 7680}, height: {min: 4320}}};
3535

36-
// Old constraints
37-
//const qvgaConstraints = { video: {width: {exact: 320}, height: {exact: 240}}};
38-
//const vgaConstraints = { video: {width: {exact: 640}, height: {exact: 480}}};
39-
//const hdConstraints = { video: {width: {exact: 1280}, height: {exact: 720}}};
40-
//const fullHdConstraints = { video: {width: {exact: 1920}, height: {exact: 1080}}};
41-
//const tv4KConstraints = { video: {width: {exact: 3840}, height: {exact: 2160}}};
42-
//const cinema4KConstraints = { video: {width: {exact: 4096}, height: {exact: 2160}}};
43-
//const eightKConstraints = { video: {width: {exact: 7680}, height: {exact: 4320}}};
44-
4536
let constraints = qvgaConstraints;
4637

4738
function addToEventLog(text, severity = 'info') {
@@ -256,12 +247,9 @@ document.addEventListener('DOMContentLoaded', async function(event) {
256247
break;
257248
case "H265":
258249
config.codec = "hvc1.2.4.L123.00"; // Main 10 profile, level 4.1, main Tier
259-
// config.codec = "hvc1.1.6.L123.00" // Main profile, level 4.1, main Tier
260250
config.hevc = { format: "annexb" };
261251
config.pt = 2;
262-
//addToEventLog('HEVC Encoding not supported yet', 'fatal');
263-
//stop();
264-
//return;
252+
addToEventLog('HEVC Encoding not supported yet', 'fatal');
265253
break;
266254
case "VP8":
267255
config.codec = "vp8";

samples/encode-decode-worker/js/stream_worker.js

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ class pipeline {
169169
if(decoderSupport.supported) {
170170
this.decoder.configure(decoderSupport.config);
171171
self.postMessage({text: 'Decoder successfully configured:\n' + JSON.stringify(decoderSupport.config)});
172-
// self.postMessage({text: 'Decoder state: ' + JSON.stringify(this.decoder.state)});
173172
} else {
174173
self.postMessage({severity: 'fatal', text: 'Config not supported:\n' + JSON.stringify(decoderSupport.config)});
175174
}
@@ -179,7 +178,6 @@ class pipeline {
179178
})
180179
} else {
181180
try {
182-
// self.postMessage({text: 'size: ' + chunk.byteLength + ' seq: ' + chunk.seqNo + ' kf: ' + chunk.keyframeIndex + ' delta: ' + chunk.deltaframeIndex + ' dur: ' + chunk.duration + ' ts: ' + chunk.timestamp + ' ssrc: ' + chunk.ssrc + ' pt: ' + chunk.pt + ' tid: ' + chunk.temporalLayerId + ' type: ' + chunk.type});
183181
const queue = this.decoder.decodeQueueSize;
184182
decqueue_update(queue);
185183
const before = performance.now();
@@ -208,9 +206,8 @@ class pipeline {
208206
this.encoder = encoder = new VideoEncoder({
209207
output: (chunk, cfg) => {
210208
if (cfg.decoderConfig) {
211-
// self.postMessage({text: 'Decoder reconfig!'});
212209
const decoderConfig = JSON.stringify(cfg.decoderConfig);
213-
// self.postMessage({text: 'Configuration: ' + decoderConfig});
210+
self.postMessage({text: 'Configuration: ' + decoderConfig});
214211
const configChunk =
215212
{
216213
type: "config",
@@ -248,7 +245,6 @@ class pipeline {
248245
if(encoderSupport.supported) {
249246
this.encoder.configure(encoderSupport.config);
250247
self.postMessage({text: 'Encoder successfully configured:\n' + JSON.stringify(encoderSupport.config)});
251-
// self.postMessage({text: 'Encoder state: ' + JSON.stringify(this.encoder.state)});
252248
} else {
253249
self.postMessage({severity: 'fatal', text: 'Config not supported:\n' + JSON.stringify(encoderSupport.config)});
254250
}
@@ -264,9 +260,6 @@ class pipeline {
264260
this.frameCounter++;
265261
try {
266262
if (this.encoder.state != "closed") {
267-
if (this.frameCounter % 20 == 0) {
268-
// self.postMessage({text: 'Encoded 20 frames'});
269-
}
270263
const queue = this.encoder.encodeQueueSize;
271264
encqueue_update(queue);
272265
const before = performance.now();
@@ -296,17 +289,14 @@ class pipeline {
296289
if (stopped) return;
297290
stopped = true;
298291
this.stopped = true;
299-
self.postMessage({severity: 'fatal', text: 'stop() called'});
300-
// TODO: There might be a more elegant way of closing a stream, or other
301-
// events to listen for.
292+
self.postMessage({text: 'stop() called'});
302293
if (encoder.state != "closed") encoder.close();
303294
if (decoder.state != "closed") decoder.close();
304-
self.postMessage({severity: 'fatal', text: 'stop(): frame, encoder and decoder closed'});
295+
self.postMessage({text: 'stop(): frame, encoder and decoder closed'});
305296
return;
306297
}
307298

308-
async start()
309-
{
299+
async start() {
310300
if (stopped) return;
311301
started = true;
312302
let duplexStream, readStream, writeStream;

0 commit comments

Comments
 (0)