diff --git a/samples/video-decode-display/worker.js b/samples/video-decode-display/worker.js index c3600b9c..110f8177 100644 --- a/samples/video-decode-display/worker.js +++ b/samples/video-decode-display/worker.js @@ -58,6 +58,7 @@ function start({dataUri, rendererName, canvas}) { break; } + let lastTimestamp = -Infinity; // Set up a VideoDecoer. const decoder = new VideoDecoder({ output(frame) { @@ -70,6 +71,14 @@ function start({dataUri, rendererName, canvas}) { setStatus("render", `${fps.toFixed(0)} fps`); } + + if (frame.timestamp < lastTimestamp) { + console.error(`Decoded frame ${frame.timestamp} µs out of order, last frame was ${lastTimestamp} µs`); + } else { + console.log(`Decoded frame ${frame.timestamp} µs`); + } + lastTimestamp = frame.timestamp; + // Schedule the frame to be rendered. renderFrame(frame); },