diff options
| author | Luke Hoersten <[email protected]> | 2026-06-15 09:06:25 -0500 |
|---|---|---|
| committer | Luke Hoersten <[email protected]> | 2026-06-15 09:06:25 -0500 |
| commit | 7a5216e6a13c015ae47d2c5d486e2d85f23f7e13 (patch) | |
| tree | 7ac5645e86da2efdb2aa01d3a9dd3e2b7e97ee0c | |
| parent | 676bb4eb1e9bd17aaf251574cbbe4c39a1bdf4e1 (diff) | |
scrypted: only warn about dropped frames when drops exceed 25% of target rate
ffmpeg's fps filter sometimes emits timestamp-clumped pairs at low
rates; the single-flight POST guard correctly drops the second one
and we logged a "raise frame_interval_ms" warning for every such
event. At 500ms interval (2 fps target) a single drop produced a
0.6 fps warning even though we were still painting the requested
rate.
Suppress the message unless drops exceed a quarter of the configured
rate. Above that threshold there's real backpressure worth knowing
about; below it's just decimation noise.
| -rw-r--r-- | scrypted/scrypted-viewport.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/scrypted/scrypted-viewport.ts b/scrypted/scrypted-viewport.ts index a752bc3..f9dc38e 100644 --- a/scrypted/scrypted-viewport.ts +++ b/scrypted/scrypted-viewport.ts @@ -785,11 +785,19 @@ class ScryptedViewportProvider extends ScryptedDeviceBase // Periodic skip-rate log so the operator sees the effective fps // and can decide whether to bump frame_interval_ms up or down. + // Only log if drops exceed 25% of the configured rate — below + // that it's just ffmpeg's fps filter emitting timestamp-clumped + // pairs that our single-flight guard correctly drops without + // any actual playback impact. const skipLogger = setInterval(() => { const now = Date.now(); - if (droppedFrames > 0) { - const window = (now - lastLogUs) / 1000; - this.console.log(`"${v.name}": dropping ~${(droppedFrames / window).toFixed(1)} fps over the last ${window.toFixed(1)}s (in-flight HTTP POST hadn't returned when ffmpeg emitted the next frame; raise frame_interval_ms slightly to flatten this)`); + const window = (now - lastLogUs) / 1000; + if (droppedFrames > 0 && window > 0) { + const dropRate = droppedFrames / window; + const targetRate = 1000 / v.frameIntervalMs; + if (dropRate > targetRate * 0.25) { + this.console.log(`"${v.name}": dropping ~${dropRate.toFixed(1)} fps over the last ${window.toFixed(1)}s (in-flight HTTP POST hadn't returned when ffmpeg emitted the next frame; raise frame_interval_ms slightly to flatten this)`); + } droppedFrames = 0; lastLogUs = now; } |
