Selkies

lib/stream-stats-view

What the dashboard draws of lib/stream-stats.js's contract, kept free of any framework so the two cannot read the same session differently: the four status rows and what makes one a warning, the figures under the graphs, the host meters, the geometry of a graph, and the plain-text report a user pastes into an issue.

A row warns where the session fell short of what it asked for, never for a choice and never for a server with no GPU, which is an ordinary deployment: software encoding somebody selected, or on a host exposed no GPU, is neutral, and software encoding on a session that asked for hardware where there is a GPU is a warning and carries pixelflux's reason. A readback in front of a hardware encoder is read the same way: it warns where the display server offered the encoder a zero-copy path (zero_copy_available) and the capture took a copy anyway, and is neutral on a server that offers none, such as an Xvfb with neither DRI3 nor NvFBC. The client's side reads the same way: software decoding warns only where a hardware decoder was there to take the stream, since a client without one is as ordinary as a server without a GPU, and a path through a relay or over TCP is how the network connects this client, which marks nothing either way, while a direct UDP path is good. Every value opens with a capital, and names the system reports (nvidia, renderD128, a decoder's own) are kept as reported. Technical values (NVENC, Zero-copy, renderD128) are not translated; the words a dashboard does translate arrive in words, and a figure's label is the dashboard's to word by the figure's key, the English here being the report's and the fallback.

Interfaces

StreamRow

Defined in: lib/stream-stats-view.js:44

One status row.

Properties

key
key: "encoder" | "capture" | "decoder" | "connection";

Defined in: lib/stream-stats-view.js:45

status
status: "good" | "warn" | "neutral";

Defined in: lib/stream-stats-view.js:46

value
value: string;

Defined in: lib/stream-stats-view.js:47

The headline.

detail
detail: string;

Defined in: lib/stream-stats-view.js:48

The quieter second line, may be empty.

reason
reason: string;

Defined in: lib/stream-stats-view.js:49

Why the row warns, empty unless it does.


StreamWords

Defined in: lib/stream-stats-view.js:53

The translated words the rows use.

Properties

hardware
hardware: string;

Defined in: lib/stream-stats-view.js:54

software
software: string;

Defined in: lib/stream-stats-view.js:55

unknown
unknown: string;

Defined in: lib/stream-stats-view.js:56

throttled
throttled: string;

Defined in: lib/stream-stats-view.js:57

Said when the server holds frames back.

hardware_available
hardware_available: string;

Defined in: lib/stream-stats-view.js:58

Why a software decode fell short where the engine has an efficient decoder for the stream.

software_preferred
software_preferred: string;

Defined in: lib/stream-stats-view.js:60

Why it fell short where this client left a hardware decoder after it failed.


StreamInfo

Defined in: lib/stream-stats.js:46

The server's description of the stream.

Properties

backend
backend: string;

Defined in: lib/stream-stats.js:47

x11 or wayland.

capture
capture: string;

Defined in: lib/stream-stats.js:48

The capture path: NvFBC, DRI3, XShm, dmabuf, or readback.

zero_copy
zero_copy: boolean;

Defined in: lib/stream-stats.js:50

Whether frames reach the encoder without a copy.

zero_copy_available
zero_copy_available: boolean;

Defined in: lib/stream-stats.js:51

Whether the display server offered the encoder a zero-copy path at all, so that a copy fell short of one.

capture_reason
capture_reason: string;

Defined in: lib/stream-stats.js:53

Why not, empty where there is nothing to explain.

encoder
encoder: string;

Defined in: lib/stream-stats.js:54

NVENC, VAAPI, or the software library.

hardware
hardware: boolean;

Defined in: lib/stream-stats.js:55

Whether the encoder runs on a GPU.

gpu_present
gpu_present: boolean;

Defined in: lib/stream-stats.js:56

Whether the server is exposed a GPU at all.

hardware_expected
hardware_expected: boolean;

Defined in: lib/stream-stats.js:57

Whether the session asked for that on a server that has one.

encoder_reason
encoder_reason: string;

Defined in: lib/stream-stats.js:59

Why it does not.

codec
codec: string;

Defined in: lib/stream-stats.js:60

fullcolor
fullcolor: boolean;

Defined in: lib/stream-stats.js:61

Whether the stream is 4:4:4.

bit_depth?
bit_depth?: number;

Defined in: lib/stream-stats.js:62

Bits per sample of the stream, 8 or 10.

striped
striped: boolean;

Defined in: lib/stream-stats.js:63

gpu
gpu: string;

Defined in: lib/stream-stats.js:64

The GPU a hardware session encodes on.

driver
driver: string;

Defined in: lib/stream-stats.js:65

Its kernel driver.

encode_node
encode_node: string;

Defined in: lib/stream-stats.js:66

Its render node.

renderer?
renderer?: string;

Defined in: lib/stream-stats.js:67

Wayland only: gl or pixman.

render_node?
render_node?: string;

Defined in: lib/stream-stats.js:68

render_gpu?
render_gpu?: string;

Defined in: lib/stream-stats.js:69

renderer_reason?
renderer_reason?: string;

Defined in: lib/stream-stats.js:70


StreamClient

Defined in: lib/stream-stats.js:74

This page's description of the stream.

Properties

transport
transport: "websockets" | "webrtc";

Defined in: lib/stream-stats.js:75

decoder
decoder: "hardware" | "software" | "unknown";

Defined in: lib/stream-stats.js:76

decoder_evidence
decoder_evidence: string;

Defined in: lib/stream-stats.js:77

What that verdict rests on.

hardware_expected
hardware_expected: boolean;

Defined in: lib/stream-stats.js:78

Whether a hardware decoder was there to take the stream, so a software verdict fell short of it.

decoder_reason
decoder_reason: string;

Defined in: lib/stream-stats.js:80

Why a software decode fell short, a word the dashboards translate: hardware_available (the engine has an efficient decoder for the stream) or software_preferred (this client left a hardware decoder after it failed); empty where it did not.

codec
codec: string;

Defined in: lib/stream-stats.js:84

resolution
resolution: string;

Defined in: lib/stream-stats.js:85

1920x1080.

path
path: string;

Defined in: lib/stream-stats.js:86

WebRTC only: the candidate pair, as host udp.

sink
sink: string;

Defined in: lib/stream-stats.js:87

How decoded frames reach the screen: a track generator feeding a <video>, a canvas a worker composites on, or the page's own canvas. Which one an engine allows is probed, so this is the one that was taken rather than the one preferred.

decode_path
decode_path: string;

Defined in: lib/stream-stats.js:91

JPEG only: what turns a stripe into a picture, and where it runs.

connection
connection: "ok" | "poor";

Defined in: lib/stream-stats.js:93

The server's verdict on this page's connection: poor while too many of its display's frames are lost on the way or held back for its link (ConnectionVerdict on the server). The server says so only when it changes, so it is kept with the stats shut.

Type Aliases

StreamSample

type StreamSample = Object<string, number | boolean | string>;

Defined in: lib/stream-stats.js:100

One second's figures: the server's (cpu_percent, mem_used, mem_total, gpu_percent, gpu_mem_used, gpu_mem_total, encoded_fps, encode_ms, pipeline_ms, rtt_ms, throttled) where it sent them, and server, whether it did, this page's (fps, the frames the screen was handed, where the sink says so; present_ms, how long a frame took from its arrival to that; frames_not_shown since the opening, those decoded but never shown; mbps, received_mb since the opening, and whatever else its core measures, lib/present-meter.js for the three), and t, the time in ms.

Type Parameters

Type Parameter

Variables

OVERSHOOT

const OVERSHOOT: 1.1 = 1.1;

Defined in: lib/stream-stats-view.js:202

How far above its CBR target a stream may run, the policy's bound, before its rate warns.


HOLD_MS

const HOLD_MS: 5000 = 5000;

Defined in: lib/stream-stats-view.js:209

How long a time measured in an earlier second stands in for seconds that measured none, in ms: a still screen encodes nothing, so motion that comes and goes would otherwise blink its times out between frames.


GRAPH_POINTS

const GRAPH_POINTS: 120 = 120;

Defined in: lib/stream-stats-view.js:327

Points a graph draws at most; a longer history is bucketed down to it by maximum.

Functions

codecName()

function codecName(codec): string;

Defined in: lib/stream-stats-view.js:67

Parameters

ParameterTypeDescription
codecstring-

Returns

string


nodeName()

function nodeName(path): string;

Defined in: lib/stream-stats-view.js:69

Parameters

ParameterTypeDescription
pathstring-

Returns

string


joined()

function joined(parts): string;

Defined in: lib/stream-stats-view.js:71

Parameters

ParameterTypeDescription
parts(string | false)[]-

Returns

string


sentence()

function sentence(text): string;

Defined in: lib/stream-stats-view.js:73

Parameters

ParameterTypeDescription
textstringProse the server or an engine phrased.

Returns

string


encoderRow()

function encoderRow(info): StreamRow;

Defined in: lib/stream-stats-view.js:79

Parameters

ParameterTypeDescription
infoStreamInfo-

Returns

StreamRow


captureRow()

function captureRow(info): StreamRow;

Defined in: lib/stream-stats-view.js:99

Parameters

ParameterTypeDescription
infoStreamInfo-

Returns

StreamRow


decoderRow()

function decoderRow(client, words): StreamRow;

Defined in: lib/stream-stats-view.js:121

Parameters

ParameterTypeDescription
clientStreamClient-
wordsStreamWords-

Returns

StreamRow


connectionRow()

function connectionRow(
   client, 
   latest, 
   words
): StreamRow;

Defined in: lib/stream-stats-view.js:142

Parameters

ParameterTypeDescription
clientStreamClient-
latest{ }-
wordsStreamWords-

Returns

StreamRow


streamRows()

function streamRows(
   info, 
   client, 
   latest, 
   words
): StreamRow[];

Defined in: lib/stream-stats-view.js:164

The four status rows, in display order.

Parameters

ParameterTypeDescription
infoStreamInfo-
clientStreamClient-
latest{ }-
wordsStreamWords-

Returns

StreamRow[]


figure()

function figure(
   latest, 
   key, 
   history?
): object;

Defined in: lib/stream-stats-view.js:223

What a figure reads: its value with the unit, and for a time the server measured its range, as least–most, and whether it warns: the video rate when it runs past OVERSHOOT of its CBR target, which it is shown against. A time with nothing measured this second reads the last one measured within HOLD_MS (history), else idle where the stream moved no frame, else a dash.

Parameters

ParameterTypeDefault valueDescription
latest{ }undefined-
keystringundefined-
history?object[]null-

Returns

object

value
value: string;
detail
detail: string;
warn
warn: boolean;

streamTiles()

function streamTiles(
   latest, 
   transport, 
   history?
): object[];

Defined in: lib/stream-stats-view.js:265

The figures under the graphs: one fixed set per transport, so the layout holds still. A time is the last second's, its range under it where the server measured one, and the video rate the last ten seconds' against the CBR target with its fullest quarter second beside it; everything else counts from the opening: the data received, the packet loss, and each drop and repair. A figure with nothing measured this second keeps its place: a time reads its last measurement for a while (figure), and the rest a dash.

Parameters

ParameterTypeDefault valueDescription
latest{ }undefined-
transport"websockets" | "webrtc"undefined-
history?object[]nullWhat the time figures fall back on.

Returns

object[]


streamStrip()

function streamStrip(latest, transport): object[];

Defined in: lib/stream-stats-view.js:279

The strip a dashboard lays over the stream: how fast frames reach the screen, the video rate against its target, and how long a frame takes from its capture to the wire, with the round trip over WebSockets, where the server measures one. Each names the tile, or graph, whose label captions it.

Parameters

ParameterTypeDescription
latest{ }-
transport"websockets" | "webrtc"-

Returns

object[]


gib()

function gib(bytes): string;

Defined in: lib/stream-stats-view.js:290

Parameters

ParameterTypeDescription
bytesnumber-

Returns

string


streamMeters()

function streamMeters(latest): object[];

Defined in: lib/stream-stats-view.js:302

The host meters: the utilizations first and the memories under them, so the bars read as one block rather than alternating with the figures. A utilization carries a bar, which is what a share of a whole reads well as; a memory pair carries its amounts as the figure and no bar, because how much of how much is what an operator needs and a bar leaves it to a hover no touch screen has. The GPU rows are left out where the server reads no GPU.

Parameters

ParameterTypeDescription
latest{ }-

Returns

object[]


seriesOf()

function seriesOf(history, key): number[];

Defined in: lib/stream-stats-view.js:337

One series of a history, bucketed down to GRAPH_POINTS so a graph that has grown for ten minutes costs what a short one does. A bucket keeps its maximum, since a graph of a rate is read for its peaks.

Parameters

ParameterTypeDescription
historyobject[]-
keystring-

Returns

number[]


graphPath()

function graphPath(
   values, 
   width, 
   height, 
   max
): object;

Defined in: lib/stream-stats-view.js:355

A graph's SVG geometry. The history grows from the left edge until it fills the width, the way it reads while the stats stay open.

Parameters

ParameterTypeDescription
valuesnumber[]-
widthnumber-
heightnumber-
maxnumberThe value at the top edge.

Returns

object

Path data for the stroke and the fill under it, and each point's coordinates.

line
line: string;
area
area: string;
xs
xs: number[];
ys
ys: number[];

streamReport()

function streamReport(
   info, 
   client, 
   latest
): string;

Defined in: lib/stream-stats-view.js:372

The session as plain text, for an issue or a chat.

Parameters

ParameterTypeDescription
infoStreamInfo-
clientStreamClient-
latest{ }-

Returns

string