v150 · media · webcodecs · streams
MediaStreamTrackProcessor frame counters
Chrome 150 adds discardedFrames and totalFrames read-only attributes to MediaStreamTrackProcessor, letting developers monitor how many frames have arrived and how many were dropped when the processor's ReadableStream was not being consumed fast enough.
at a glance
| Shipped in | Chrome 150 (Enabled by default) |
|---|---|
| Status | Enabled by default |
| Spec | Media Capture Transform — MediaStreamTrackProcessor |
| Standards position (Firefox) | Positive |
| Standards position (Safari) | Positive |
| ChromeStatus | 6267249280286720 — MediaStreamTrackProcessor frame counters |
why it exists
MediaStreamTrackProcessor exposes a MediaStreamTrack (camera, screen capture, audio) as a ReadableStream of VideoFrame or AudioData objects. If the consuming code (e.g. a WebCodecs encoder or a canvas-drawing loop) cannot keep up with the incoming frame rate, the processor silently drops frames rather than buffering indefinitely.
Before Chrome 150 there was no way to tell how many frames had been dropped. Developers building WebRTC pipelines, video effects, or recording applications had no visibility into whether their processing was keeping up. The new discardedFrames and totalFrames counters surface this information directly on the processor, making it possible to detect back-pressure problems and measure pipeline health.
shape of the API
| Property | Type | Description |
|---|---|---|
MediaStreamTrackProcessor.totalFrames | number | Total number of frames received from the track since the processor was created |
MediaStreamTrackProcessor.discardedFrames | number | Number of frames dropped because the readable stream was not being read fast enough |
Both properties are read-only and increase monotonically. The drop rate can be computed as discardedFrames / totalFrames.
example
const stream = await navigator.mediaDevices.getUserMedia({ video: true });
const [track] = stream.getVideoTracks();
const processor = new MediaStreamTrackProcessor({ track });
const reader = processor.readable.getReader();
let frameCount = 0;
async function processFrames() {
while (true) {
const { value: frame, done } = await reader.read();
if (done) break;
// Do something with the frame (e.g. encode, draw to canvas)
frame.close();
frameCount++;
// Chrome 150+: monitor pipeline health
if (frameCount % 60 === 0) {
const total = processor.totalFrames;
const dropped = processor.discardedFrames;
const dropRate = total > 0 ? (dropped / total * 100).toFixed(1) : 0;
console.log(`Frames: ${total} total, ${dropped} dropped (${dropRate}%)`);
if (dropped / total > 0.1) {
console.warn('High frame drop rate — processing pipeline too slow');
}
}
}
}
processFrames();
Source: Media Capture Transform spec
browser support
| Browser | Support | Notes |
|---|---|---|
| Chrome 150+ | Enabled by default | All platforms |
| Firefox | Positive | Not yet shipped |
| Safari | Positive | Not yet shipped |