Skip to content

feat: dropped-frame / achieved-fps telemetry (fixes #23) - #34

Merged
joeblau merged 1 commit into
mainfrom
feat/23-dropped-frame-telemetry
Jul 6, 2026
Merged

feat: dropped-frame / achieved-fps telemetry (fixes #23)#34
joeblau merged 1 commit into
mainfrom
feat/23-dropped-frame-telemetry

Conversation

@joeblau

@joeblau joeblau commented Jul 5, 2026

Copy link
Copy Markdown
Owner

What & why

Closes #23 (M8 · Dropped-frame / achieved-fps telemetry). There were ≥4 silent frame-shed sites with no counters — PTS-deadline pacing, bufferingNewest(1) backpressure, compositor pool exhaustion, and VideoFrameAdmission — and no measured achieved fps (the HUD showed the encoder's target rate). This adds real observability that feeds the M3 HUD now and is reachable by the M1/M9 adaptive logic.

Changes

  • FrameTelemetry (StreamCore) — thread-safe cumulative counters (captured / encoded + the four drop reasons) via OSAllocatedUnfairLock, mirroring VideoFrameAdmission. Plus a pure, unit-tested rate(from:to:elapsed:) for achieved fps + congestion-drops/sec.
  • LiveStats gains achievedFrameRate and droppedFrames. Congestion = backpressure + admission (frames the pipeline wanted to encode but couldn't); intentional pacing and overlay-only compositor drops are tracked but excluded from the HUD total.
  • Capture output records captured / pacing / backpressure (via the AsyncStream .dropped yield result) / compositor (pool-exhaustion fallback) on the serial sample queue.
  • Both publishers record admission + encoded and hold the shared telemetry, so the adaptive controller (M9) can consume the congestion signal.
  • Controller folds measured fps + cumulative drops into liveStats each ~1s poll. HUD now shows achieved fps (falling back to the target for the first second) and a subtle "N frames dropped" notice that appears only under real congestion.

Testing

  • StreamCoreTests green (144 tests): new FrameTelemetryCounterTests, FrameTelemetryRateTests, and LiveStatsTelemetryTests cover the counters, congestion-vs-total accounting, and the rate math (elapsed-window guard, delta flooring on reset).
  • The app-target wiring (capture / publisher / HUD) isn't CI-buildable (needs the iOS 27 SDK); verified by inspection — run on a physical iOS 27 device for the live HUD.

Note: split cleanly off a working tree that also carried in-progress #22 (HEVC / low-latency) work — the diffs here are telemetry-only.

🤖 Generated with Claude Code

Instrument the four previously-silent frame-shed sites — PTS-deadline pacing,
bufferingNewest(1) backpressure, compositor pool exhaustion, and
VideoFrameAdmission — plus the encoded-frame rate, so the M3 HUD and the M1/M9
adaptive logic finally have real measured observability instead of only the
encoder's targets.

- FrameTelemetry (StreamCore): thread-safe cumulative counters
  (OSAllocatedUnfairLock, mirroring VideoFrameAdmission) and a pure, unit-tested
  achieved-fps / congestion-drops-per-second rate function.
- LiveStats gains achievedFrameRate + droppedFrames. Congestion drops =
  backpressure + admission (the frames the pipeline wanted to encode but couldn't);
  intentional pacing and overlay-only compositor drops are tracked but excluded.
- The capture output records captured/pacing/backpressure/compositor on the sample
  queue; both publishers record admission + encoded and hold the shared telemetry
  so the adaptive controller (M9) can consume the congestion signal.
- The controller folds measured fps + cumulative drops into liveStats each ~1s
  poll; the Settings HUD shows achieved fps and a "N frames dropped" notice that
  appears only under real congestion.

Tests (StreamCore, CI-testable): FrameTelemetry counters + rate math and the new
LiveStats formatting/equality.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@joeblau
joeblau merged commit 7b1e5ca into main Jul 6, 2026
1 check passed
@joeblau
joeblau deleted the feat/23-dropped-frame-telemetry branch July 6, 2026 01:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

M8 · Dropped-frame / achieved-fps telemetry

1 participant