v150 · webrtc · media
MediaStreamTrackProcessor frame counters
MediaStreamTrackProcessor gains totalFrames and discardedFrames attributes. Video processing pipelines can now read their own health stats — how many frames the processor has received and how many it dropped before the consumer could pull them.
concepts
-
Pipeline Meter
Live readout of
totalFramesanddiscardedFramesfrom a webcam track processor. Slow down the consumer with a slider and watch dropped-frame count climb. -
Diagnostic Overlay
The Google Meet motivating use case. A HUD over the camera feed showing declared vs. delivered fps in real time — exactly the gap that surfaces when a USB hub halves the camera rate or the system is under load.
-
Pipeline Health Monitor
A canvas-based video source feeds a real
MediaStreamTrackProcessor. Drag the consumer-rate slider below the 30 fps production rate and watchtotalFramesanddiscardedFramesdiverge on a live chart — with a health indicator that turns red when the discard rate exceeds 20%. -
Frame Budget Calculator
Enter your source frame rate, per-frame transform time, and stream buffer size. The calculator computes your frame budget, budget utilization, and predicted
discardedFramescount over a simulation window — with a visual timeline showing how much of each frame interval is consumed by the transform. Use this to size transforms before shipping. -
Counters API Explorer
Feature-detects
totalFramesanddiscardedFrames, then creates a canvas-basedMediaStreamsource and attaches a processor. Reads both counters every second via a live property panel. Raise the consumer delay slider to induce drops and watchdiscardedFramesclimb. Falls back to a simulation if Chrome 150 is not available. -
Worker Processor
The recommended architecture: move the
MediaStreamTrackProcessorinto a dedicated Worker thread and posttotalFrames/discardedFramesback to main viapostMessage. The main thread receives only health stats — never raw frames. A canvas-based synthetic stream produces frames at 30 fps; a consumer-delay slider induces frame drops in the worker. Full architecture diagram and postMessage log included.
why it shipped
Real-time video pipelines built on Insertable Streams of Media (frame-by-frame processing via WHATWG streams) are notoriously hard to diagnose. If the consumer can't keep up with the producer — for example, because a frame transform is too slow on the device — frames are silently dropped on the floor. Until now there was no API to detect this. The two counters give pipelines a simple health probe: a non-zero growth rate on discardedFrames means you're losing data and should back off the per-frame work.
references
implementation reference
Need the exact API surface, compatibility boundaries, errors, lifecycle, and source links? Read the matching gendn reference ↗