@ksp-gonogo/sitrep-sdk 1.0.0-rc.45 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -93
- package/dist/__generated__/command-map.d.ts +247 -2
- package/dist/__generated__/command-map.d.ts.map +1 -1
- package/dist/__generated__/command-map.js +91 -19
- package/dist/__generated__/command-map.js.map +1 -1
- package/dist/__generated__/contract.d.ts +3062 -352
- package/dist/__generated__/contract.d.ts.map +1 -1
- package/dist/__generated__/contract.js +187 -3
- package/dist/__generated__/contract.js.map +1 -1
- package/dist/__generated__/delay-roles.d.ts +2 -2
- package/dist/__generated__/delay-roles.d.ts.map +1 -1
- package/dist/__generated__/delay-roles.js +12 -0
- package/dist/__generated__/delay-roles.js.map +1 -1
- package/dist/__generated__/error-codes.d.ts +11 -11
- package/dist/__generated__/error-codes.d.ts.map +1 -1
- package/dist/__generated__/error-codes.js +12 -12
- package/dist/__generated__/error-codes.js.map +1 -1
- package/dist/__generated__/frames.d.ts +40 -4
- package/dist/__generated__/frames.d.ts.map +1 -1
- package/dist/__generated__/frames.js +20 -4
- package/dist/__generated__/frames.js.map +1 -1
- package/dist/__generated__/reckonability.d.ts +3 -1
- package/dist/__generated__/reckonability.d.ts.map +1 -1
- package/dist/__generated__/reckonability.js +1 -1
- package/dist/__generated__/reckonability.js.map +1 -1
- package/dist/__generated__/sample-kinds.d.ts +18 -2
- package/dist/__generated__/sample-kinds.d.ts.map +1 -1
- package/dist/__generated__/sample-kinds.js +18 -2
- package/dist/__generated__/sample-kinds.js.map +1 -1
- package/dist/__generated__/topic-map.d.ts +41 -17
- package/dist/__generated__/topic-map.d.ts.map +1 -1
- package/dist/__generated__/topic-map.js +16 -3
- package/dist/__generated__/topic-map.js.map +1 -1
- package/dist/__generated__/units.d.ts +247 -6
- package/dist/__generated__/units.d.ts.map +1 -1
- package/dist/__generated__/units.js +949 -76
- package/dist/__generated__/units.js.map +1 -1
- package/dist/api/command-rejection.d.ts +2 -2
- package/dist/api/command-rejection.js +1 -1
- package/dist/api/contribution-slots.d.ts +122 -21
- package/dist/api/contribution-slots.d.ts.map +1 -1
- package/dist/api/contribution-slots.js +4 -4
- package/dist/api/contribution-slots.js.map +1 -1
- package/dist/api/error-codes.d.ts +3 -2
- package/dist/api/error-codes.d.ts.map +1 -1
- package/dist/api/error-codes.js +3 -2
- package/dist/api/error-codes.js.map +1 -1
- package/dist/api/framework-reads.d.ts +2 -2
- package/dist/api/framework-reads.d.ts.map +1 -1
- package/dist/api/framework-reads.js +6 -1
- package/dist/api/framework-reads.js.map +1 -1
- package/dist/api/host.d.ts +14 -6
- package/dist/api/host.d.ts.map +1 -1
- package/dist/api/host.js.map +1 -1
- package/dist/api/index.d.ts +70 -60
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +66 -54
- package/dist/api/index.js.map +1 -1
- package/dist/api/logger-contract.d.ts +2 -1
- package/dist/api/logger-contract.d.ts.map +1 -1
- package/dist/api/logger.d.ts +6 -3
- package/dist/api/logger.d.ts.map +1 -1
- package/dist/api/logger.js +6 -3
- package/dist/api/logger.js.map +1 -1
- package/dist/api/part-panels.d.ts +143 -0
- package/dist/api/part-panels.d.ts.map +1 -0
- package/dist/api/part-panels.js +104 -0
- package/dist/api/part-panels.js.map +1 -0
- package/dist/api/plot-layers.d.ts +1 -1
- package/dist/api/plot-layers.js +1 -1
- package/dist/api/registry.d.ts +4 -2
- package/dist/api/registry.d.ts.map +1 -1
- package/dist/api/registry.js +4 -2
- package/dist/api/registry.js.map +1 -1
- package/dist/api/settings/store.d.ts +1 -1
- package/dist/api/settings/store.d.ts.map +1 -1
- package/dist/api/settings/store.js +7 -2
- package/dist/api/settings/store.js.map +1 -1
- package/dist/api/slots.d.ts +150 -70
- package/dist/api/slots.d.ts.map +1 -1
- package/dist/api/station-brokers.d.ts +24 -15
- package/dist/api/station-brokers.d.ts.map +1 -1
- package/dist/api/station-brokers.js +24 -15
- package/dist/api/station-brokers.js.map +1 -1
- package/dist/api/tiny-size.d.ts +2 -1
- package/dist/api/tiny-size.d.ts.map +1 -1
- package/dist/api/tiny-size.js +2 -1
- package/dist/api/tiny-size.js.map +1 -1
- package/dist/api/tone.d.ts +1 -1
- package/dist/api/transport.d.ts +9 -0
- package/dist/api/transport.d.ts.map +1 -1
- package/dist/api/types.d.ts +356 -68
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/uplink-banner.d.ts +113 -0
- package/dist/api/uplink-banner.d.ts.map +1 -0
- package/dist/api/uplink-banner.js +69 -0
- package/dist/api/uplink-banner.js.map +1 -0
- package/dist/api/uplink-handles.d.ts +2 -12
- package/dist/api/uplink-handles.d.ts.map +1 -1
- package/dist/api/uplink-handles.js +2 -1
- package/dist/api/uplink-handles.js.map +1 -1
- package/dist/binary-frame.d.ts +4 -4
- package/dist/binary-frame.js +2 -2
- package/dist/combine-readings.d.ts +4 -3
- package/dist/combine-readings.d.ts.map +1 -1
- package/dist/combine-readings.js +4 -3
- package/dist/combine-readings.js.map +1 -1
- package/dist/command-delay.d.ts +81 -2
- package/dist/command-delay.d.ts.map +1 -1
- package/dist/command-delay.js +51 -8
- package/dist/command-delay.js.map +1 -1
- package/dist/command-value.d.ts +98 -0
- package/dist/command-value.d.ts.map +1 -0
- package/dist/command-value.js +87 -0
- package/dist/command-value.js.map +1 -0
- package/dist/commands.d.ts +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/compat-versions.d.ts +1 -1
- package/dist/compat-versions.d.ts.map +1 -1
- package/dist/compat-versions.js +3 -3
- package/dist/compat-versions.js.map +1 -1
- package/dist/contract-enum-names.d.ts +2 -2
- package/dist/contract-enum-names.js +2 -2
- package/dist/contract-tags.d.ts +33 -2
- package/dist/contract-tags.d.ts.map +1 -1
- package/dist/contract-tags.js +54 -5
- package/dist/contract-tags.js.map +1 -1
- package/dist/data-rate.d.ts +84 -0
- package/dist/data-rate.d.ts.map +1 -0
- package/dist/data-rate.js +133 -0
- package/dist/data-rate.js.map +1 -0
- package/dist/delay-roles.d.ts +14 -1
- package/dist/delay-roles.d.ts.map +1 -1
- package/dist/delay-roles.js +5 -1
- package/dist/delay-roles.js.map +1 -1
- package/dist/dock-markers.d.ts +126 -0
- package/dist/dock-markers.d.ts.map +1 -0
- package/dist/dock-markers.js +100 -0
- package/dist/dock-markers.js.map +1 -0
- package/dist/envelope.d.ts +2 -2
- package/dist/envelope.d.ts.map +1 -1
- package/dist/flight/types.d.ts +31 -2
- package/dist/flight/types.d.ts.map +1 -1
- package/dist/flight/types.js.map +1 -1
- package/dist/frames/index.d.ts +1 -4
- package/dist/frames/index.d.ts.map +1 -1
- package/dist/frames/index.js +0 -3
- package/dist/frames/index.js.map +1 -1
- package/dist/go-no-go-countdown.d.ts +65 -0
- package/dist/go-no-go-countdown.d.ts.map +1 -0
- package/dist/go-no-go-countdown.js +71 -0
- package/dist/go-no-go-countdown.js.map +1 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -4
- package/dist/index.js.map +1 -1
- package/dist/ksp-enum-names.d.ts +35 -4
- package/dist/ksp-enum-names.d.ts.map +1 -1
- package/dist/ksp-enum-names.js +31 -4
- package/dist/ksp-enum-names.js.map +1 -1
- package/dist/locked.d.ts +1 -1
- package/dist/locked.js +1 -1
- package/dist/media/delayed-playout-buffer.d.ts +29 -4
- package/dist/media/delayed-playout-buffer.d.ts.map +1 -1
- package/dist/media/delayed-playout-buffer.js +12 -5
- package/dist/media/delayed-playout-buffer.js.map +1 -1
- package/dist/media/encoded-frame-delay.d.ts +21 -16
- package/dist/media/encoded-frame-delay.d.ts.map +1 -1
- package/dist/media/encoded-frame-delay.js +21 -14
- package/dist/media/encoded-frame-delay.js.map +1 -1
- package/dist/media/frame-delay.d.ts +119 -5
- package/dist/media/frame-delay.d.ts.map +1 -1
- package/dist/media/frame-delay.js +201 -15
- package/dist/media/frame-delay.js.map +1 -1
- package/dist/media/frame-stamp-timeline.d.ts +119 -0
- package/dist/media/frame-stamp-timeline.d.ts.map +1 -0
- package/dist/media/frame-stamp-timeline.js +194 -0
- package/dist/media/frame-stamp-timeline.js.map +1 -0
- package/dist/media/index.d.ts +4 -3
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +1 -1
- package/dist/media/index.js.map +1 -1
- package/dist/media/radio-support.d.ts +8 -7
- package/dist/media/radio-support.d.ts.map +1 -1
- package/dist/media/radio-support.js +5 -6
- package/dist/media/radio-support.js.map +1 -1
- package/dist/media/worker/delay-worker-client.d.ts +27 -1
- package/dist/media/worker/delay-worker-client.d.ts.map +1 -1
- package/dist/media/worker/delay-worker-client.js +53 -5
- package/dist/media/worker/delay-worker-client.js.map +1 -1
- package/dist/media/worker/delay-worker.d.ts +45 -8
- package/dist/media/worker/delay-worker.d.ts.map +1 -1
- package/dist/media/worker/delay-worker.js +644 -56
- package/dist/media/worker/delay-worker.js.map +4 -4
- package/dist/media/worker/frame-delay-report.d.ts +25 -0
- package/dist/media/worker/frame-delay-report.d.ts.map +1 -0
- package/dist/media/worker/frame-delay-report.js +112 -0
- package/dist/media/worker/frame-delay-report.js.map +1 -0
- package/dist/media/worker/lead-limit-report.d.ts +13 -0
- package/dist/media/worker/lead-limit-report.d.ts.map +1 -0
- package/dist/media/worker/lead-limit-report.js +19 -0
- package/dist/media/worker/lead-limit-report.js.map +1 -0
- package/dist/media/worker/presentation-pacer.d.ts +70 -1
- package/dist/media/worker/presentation-pacer.d.ts.map +1 -1
- package/dist/media/worker/presentation-pacer.js +167 -9
- package/dist/media/worker/presentation-pacer.js.map +1 -1
- package/dist/media/worker/worker-delay-clock.d.ts +4 -5
- package/dist/media/worker/worker-delay-clock.d.ts.map +1 -1
- package/dist/media/worker/worker-delay-clock.js +6 -2
- package/dist/media/worker/worker-delay-clock.js.map +1 -1
- package/dist/perf/PerfBudget.d.ts +2 -2
- package/dist/perf/PerfBudget.js +2 -2
- package/dist/rail-tags.d.ts +7 -0
- package/dist/rail-tags.d.ts.map +1 -1
- package/dist/rail-tags.js.map +1 -1
- package/dist/raw-field-split.d.ts +1 -1
- package/dist/raw-field-split.js +1 -1
- package/dist/reading.d.ts +6 -6
- package/dist/reading.js +5 -5
- package/dist/reads-index.json +446 -37
- package/dist/resource-transfer.d.ts +177 -0
- package/dist/resource-transfer.d.ts.map +1 -0
- package/dist/resource-transfer.js +190 -0
- package/dist/resource-transfer.js.map +1 -0
- package/dist/runtime-topic-registry.d.ts +2 -2
- package/dist/runtime-topic-registry.d.ts.map +1 -1
- package/dist/runtime-topic-registry.js +23 -2
- package/dist/runtime-topic-registry.js.map +1 -1
- package/dist/sample-step-tracker.d.ts +17 -0
- package/dist/sample-step-tracker.d.ts.map +1 -0
- package/dist/sample-step-tracker.js +38 -0
- package/dist/sample-step-tracker.js.map +1 -0
- package/dist/sha256-fallback.d.ts +6 -0
- package/dist/sha256-fallback.d.ts.map +1 -0
- package/dist/sha256-fallback.js +68 -0
- package/dist/sha256-fallback.js.map +1 -0
- package/dist/spine/arrival-deadline.d.ts +7 -0
- package/dist/spine/arrival-deadline.d.ts.map +1 -1
- package/dist/spine/arrival-deadline.js +12 -0
- package/dist/spine/arrival-deadline.js.map +1 -1
- package/dist/spine/bound-command.d.ts +58 -0
- package/dist/spine/bound-command.d.ts.map +1 -0
- package/dist/spine/bound-command.js +162 -0
- package/dist/spine/bound-command.js.map +1 -0
- package/dist/spine/capability-lock.d.ts +6 -1
- package/dist/spine/capability-lock.d.ts.map +1 -1
- package/dist/spine/capability-lock.js +56 -5
- package/dist/spine/capability-lock.js.map +1 -1
- package/dist/spine/catalog-fallback.d.ts +28 -0
- package/dist/spine/catalog-fallback.d.ts.map +1 -0
- package/dist/spine/catalog-fallback.js +120 -0
- package/dist/spine/catalog-fallback.js.map +1 -0
- package/dist/spine/celestial-facts.d.ts.map +1 -1
- package/dist/spine/celestial-facts.js +5 -2
- package/dist/spine/celestial-facts.js.map +1 -1
- package/dist/spine/centre-commands.d.ts +84 -0
- package/dist/spine/centre-commands.d.ts.map +1 -0
- package/dist/spine/centre-commands.js +236 -0
- package/dist/spine/centre-commands.js.map +1 -0
- package/dist/spine/client-reading.js +1 -1
- package/dist/spine/client-timeline.d.ts +48 -1
- package/dist/spine/client-timeline.d.ts.map +1 -1
- package/dist/spine/client-timeline.js +151 -3
- package/dist/spine/client-timeline.js.map +1 -1
- package/dist/spine/client.d.ts +154 -4
- package/dist/spine/client.d.ts.map +1 -1
- package/dist/spine/client.js +530 -34
- package/dist/spine/client.js.map +1 -1
- package/dist/spine/command-gate.d.ts +8 -0
- package/dist/spine/command-gate.d.ts.map +1 -1
- package/dist/spine/command-gate.js +36 -3
- package/dist/spine/command-gate.js.map +1 -1
- package/dist/spine/command-outcomes.d.ts +60 -0
- package/dist/spine/command-outcomes.d.ts.map +1 -0
- package/dist/spine/command-outcomes.js +256 -0
- package/dist/spine/command-outcomes.js.map +1 -0
- package/dist/spine/connectivity-history.d.ts +5 -3
- package/dist/spine/connectivity-history.d.ts.map +1 -1
- package/dist/spine/connectivity-history.js.map +1 -1
- package/dist/spine/context.d.ts +62 -11
- package/dist/spine/context.d.ts.map +1 -1
- package/dist/spine/context.js +125 -39
- package/dist/spine/context.js.map +1 -1
- package/dist/spine/core-reckoners.d.ts.map +1 -1
- package/dist/spine/core-reckoners.js +16 -39
- package/dist/spine/core-reckoners.js.map +1 -1
- package/dist/spine/delay-authority-context.d.ts +5 -0
- package/dist/spine/delay-authority-context.d.ts.map +1 -0
- package/dist/spine/delay-authority-context.js +7 -0
- package/dist/spine/delay-authority-context.js.map +1 -0
- package/dist/spine/delay-authority.d.ts +76 -1
- package/dist/spine/delay-authority.d.ts.map +1 -1
- package/dist/spine/delay-authority.js +217 -3
- package/dist/spine/delay-authority.js.map +1 -1
- package/dist/spine/delay-estimate.d.ts +41 -0
- package/dist/spine/delay-estimate.d.ts.map +1 -0
- package/dist/spine/delay-estimate.js +70 -0
- package/dist/spine/delay-estimate.js.map +1 -0
- package/dist/spine/delta-v-budget.js +2 -2
- package/dist/spine/delta-v-budget.js.map +1 -1
- package/dist/spine/dv-stage-resources.d.ts +32 -17
- package/dist/spine/dv-stage-resources.d.ts.map +1 -1
- package/dist/spine/dv-stage-resources.js +44 -37
- package/dist/spine/dv-stage-resources.js.map +1 -1
- package/dist/spine/index.d.ts +7 -1
- package/dist/spine/index.d.ts.map +1 -1
- package/dist/spine/index.js +11 -5
- package/dist/spine/index.js.map +1 -1
- package/dist/spine/kepler-reckoning.d.ts +56 -0
- package/dist/spine/kepler-reckoning.d.ts.map +1 -1
- package/dist/spine/kepler-reckoning.js +179 -3
- package/dist/spine/kepler-reckoning.js.map +1 -1
- package/dist/spine/kepler.d.ts +1 -1
- package/dist/spine/kepler.js +1 -1
- package/dist/spine/known-holds.d.ts +8 -0
- package/dist/spine/known-holds.d.ts.map +1 -0
- package/dist/spine/known-holds.js +78 -0
- package/dist/spine/known-holds.js.map +1 -0
- package/dist/spine/lagrange.d.ts +9 -34
- package/dist/spine/lagrange.d.ts.map +1 -1
- package/dist/spine/lagrange.js +4 -24
- package/dist/spine/lagrange.js.map +1 -1
- package/dist/spine/lifecycle.d.ts +21 -0
- package/dist/spine/lifecycle.d.ts.map +1 -1
- package/dist/spine/lifecycle.js.map +1 -1
- package/dist/spine/lock-scope.d.ts +2 -2
- package/dist/spine/map-topic.d.ts +3 -3
- package/dist/spine/map-topic.js +3 -3
- package/dist/spine/never-reckonable.js +1 -1
- package/dist/spine/never-reckonable.js.map +1 -1
- package/dist/spine/orbit-patches.d.ts +6 -4
- package/dist/spine/orbit-patches.d.ts.map +1 -1
- package/dist/spine/orbit-patches.js +45 -10
- package/dist/spine/orbit-patches.js.map +1 -1
- package/dist/spine/orbital-solve.d.ts +1 -1
- package/dist/spine/orbital-solve.d.ts.map +1 -1
- package/dist/spine/orbital-solve.js +35 -0
- package/dist/spine/orbital-solve.js.map +1 -1
- package/dist/spine/powered-reckoning.d.ts +5 -0
- package/dist/spine/powered-reckoning.d.ts.map +1 -1
- package/dist/spine/powered-reckoning.js.map +1 -1
- package/dist/spine/processorEvaluator.d.ts +29 -0
- package/dist/spine/processorEvaluator.d.ts.map +1 -1
- package/dist/spine/processorEvaluator.js +94 -71
- package/dist/spine/processorEvaluator.js.map +1 -1
- package/dist/spine/processors.d.ts +56 -4
- package/dist/spine/processors.d.ts.map +1 -1
- package/dist/spine/processors.js +110 -0
- package/dist/spine/processors.js.map +1 -1
- package/dist/spine/rail-registry.d.ts +1 -1
- package/dist/spine/rail-registry.d.ts.map +1 -1
- package/dist/spine/reckoner-generation.d.ts +5 -0
- package/dist/spine/reckoner-generation.d.ts.map +1 -0
- package/dist/spine/reckoner-generation.js +10 -0
- package/dist/spine/reckoner-generation.js.map +1 -0
- package/dist/spine/reckoners.d.ts.map +1 -1
- package/dist/spine/reckoners.js +3 -0
- package/dist/spine/reckoners.js.map +1 -1
- package/dist/spine/replay-session-controller.d.ts +1 -1
- package/dist/spine/replay-session-controller.d.ts.map +1 -1
- package/dist/spine/replay-session-controller.js +4 -6
- package/dist/spine/replay-session-controller.js.map +1 -1
- package/dist/spine/resolve-tracked.d.ts +20 -2
- package/dist/spine/resolve-tracked.d.ts.map +1 -1
- package/dist/spine/resolve-tracked.js +32 -2
- package/dist/spine/resolve-tracked.js.map +1 -1
- package/dist/spine/send-status.d.ts +2 -0
- package/dist/spine/send-status.d.ts.map +1 -1
- package/dist/spine/send-status.js.map +1 -1
- package/dist/spine/settings-registry.d.ts +7 -0
- package/dist/spine/settings-registry.d.ts.map +1 -1
- package/dist/spine/settings-registry.js.map +1 -1
- package/dist/spine/slot-ids.d.ts +1 -1
- package/dist/spine/slot-ids.d.ts.map +1 -1
- package/dist/spine/slot-ids.js +6 -3
- package/dist/spine/slot-ids.js.map +1 -1
- package/dist/spine/space-center-state.d.ts +17 -9
- package/dist/spine/space-center-state.d.ts.map +1 -1
- package/dist/spine/space-center-state.js +14 -15
- package/dist/spine/space-center-state.js.map +1 -1
- package/dist/spine/stage-countdown-store.d.ts +38 -0
- package/dist/spine/stage-countdown-store.d.ts.map +1 -0
- package/dist/spine/stage-countdown-store.js +53 -0
- package/dist/spine/stage-countdown-store.js.map +1 -0
- package/dist/spine/stream-status.d.ts +3 -3
- package/dist/spine/stream-status.js +3 -3
- package/dist/spine/subscribe-read.d.ts +1 -1
- package/dist/spine/subscribe-read.js +2 -2
- package/dist/spine/system-state.d.ts +13 -13
- package/dist/spine/system-state.d.ts.map +1 -1
- package/dist/spine/system-state.js +18 -18
- package/dist/spine/system-state.js.map +1 -1
- package/dist/spine/timeline-store.d.ts +304 -113
- package/dist/spine/timeline-store.d.ts.map +1 -1
- package/dist/spine/timeline-store.js +921 -223
- package/dist/spine/timeline-store.js.map +1 -1
- package/dist/spine/uplink-clients.d.ts +32 -16
- package/dist/spine/uplink-clients.d.ts.map +1 -1
- package/dist/spine/uplink-clients.js +8 -4
- package/dist/spine/uplink-clients.js.map +1 -1
- package/dist/spine/uplink-delays.d.ts +31 -0
- package/dist/spine/uplink-delays.d.ts.map +1 -0
- package/dist/spine/uplink-delays.js +46 -0
- package/dist/spine/uplink-delays.js.map +1 -0
- package/dist/spine/uplink-health.d.ts +109 -14
- package/dist/spine/uplink-health.d.ts.map +1 -1
- package/dist/spine/uplink-health.js +21 -17
- package/dist/spine/uplink-health.js.map +1 -1
- package/dist/spine/use-action-input.d.ts.map +1 -1
- package/dist/spine/use-action-input.js +14 -9
- package/dist/spine/use-action-input.js.map +1 -1
- package/dist/spine/use-body-states.d.ts.map +1 -1
- package/dist/spine/use-body-states.js +3 -3
- package/dist/spine/use-body-states.js.map +1 -1
- package/dist/spine/use-command.d.ts +94 -31
- package/dist/spine/use-command.d.ts.map +1 -1
- package/dist/spine/use-command.js +409 -197
- package/dist/spine/use-command.js.map +1 -1
- package/dist/spine/use-last-known-path.d.ts +36 -0
- package/dist/spine/use-last-known-path.d.ts.map +1 -0
- package/dist/spine/use-last-known-path.js +46 -0
- package/dist/spine/use-last-known-path.js.map +1 -0
- package/dist/spine/use-observed-vantage.d.ts +13 -0
- package/dist/spine/use-observed-vantage.d.ts.map +1 -0
- package/dist/spine/use-observed-vantage.js +20 -0
- package/dist/spine/use-observed-vantage.js.map +1 -0
- package/dist/spine/use-orbit-trajectory.d.ts +1 -1
- package/dist/spine/use-orbit-trajectory.d.ts.map +1 -1
- package/dist/spine/use-orbit-trajectory.js +17 -3
- package/dist/spine/use-orbit-trajectory.js.map +1 -1
- package/dist/spine/use-stream-connected.d.ts +8 -0
- package/dist/spine/use-stream-connected.d.ts.map +1 -0
- package/dist/spine/use-stream-connected.js +16 -0
- package/dist/spine/use-stream-connected.js.map +1 -0
- package/dist/spine/use-stream-event.d.ts +6 -1
- package/dist/spine/use-stream-event.d.ts.map +1 -1
- package/dist/spine/use-stream-event.js +5 -1
- package/dist/spine/use-stream-event.js.map +1 -1
- package/dist/spine/use-stream.d.ts +5 -2
- package/dist/spine/use-stream.d.ts.map +1 -1
- package/dist/spine/use-stream.js +7 -4
- package/dist/spine/use-stream.js.map +1 -1
- package/dist/spine/use-telemetry.d.ts +5 -1
- package/dist/spine/use-telemetry.d.ts.map +1 -1
- package/dist/spine/use-telemetry.js.map +1 -1
- package/dist/spine/use-topic-clock.d.ts +54 -0
- package/dist/spine/use-topic-clock.d.ts.map +1 -0
- package/dist/spine/use-topic-clock.js +137 -0
- package/dist/spine/use-topic-clock.js.map +1 -0
- package/dist/spine/use-transmissions.d.ts.map +1 -1
- package/dist/spine/use-transmissions.js +9 -4
- package/dist/spine/use-transmissions.js.map +1 -1
- package/dist/spine/vantage.d.ts +6 -0
- package/dist/spine/vantage.d.ts.map +1 -1
- package/dist/spine/vantage.js +6 -0
- package/dist/spine/vantage.js.map +1 -1
- package/dist/spine/view-clock.d.ts +23 -3
- package/dist/spine/view-clock.d.ts.map +1 -1
- package/dist/spine/view-clock.js +80 -2
- package/dist/spine/view-clock.js.map +1 -1
- package/dist/testing/fake-command.d.ts +48 -0
- package/dist/testing/fake-command.d.ts.map +1 -0
- package/dist/testing/fake-command.js +63 -0
- package/dist/testing/fake-command.js.map +1 -0
- package/dist/testing/index.d.ts +5 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +6 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/install-act-gate-stretch.d.ts +1 -2
- package/dist/testing/install-act-gate-stretch.d.ts.map +1 -1
- package/dist/testing/install-act-gate-stretch.js +1 -2
- package/dist/testing/install-act-gate-stretch.js.map +1 -1
- package/dist/testing/install-dom-stubs.d.ts +2 -5
- package/dist/testing/install-dom-stubs.d.ts.map +1 -1
- package/dist/testing/install-dom-stubs.js +2 -34
- package/dist/testing/install-dom-stubs.js.map +1 -1
- package/dist/testing/install-real-test-host.d.ts.map +1 -1
- package/dist/testing/install-real-test-host.js +7 -6
- package/dist/testing/install-real-test-host.js.map +1 -1
- package/dist/testing/recorded-uplink-banners.d.ts +49 -0
- package/dist/testing/recorded-uplink-banners.d.ts.map +1 -0
- package/dist/testing/recorded-uplink-banners.js +45 -0
- package/dist/testing/recorded-uplink-banners.js.map +1 -0
- package/dist/testing/render.d.ts +16 -3
- package/dist/testing/render.d.ts.map +1 -1
- package/dist/testing/render.js +16 -3
- package/dist/testing/render.js.map +1 -1
- package/dist/testing/stream-fixture.js +3 -3
- package/dist/testing/stream-fixture.js.map +1 -1
- package/dist/testing/stub-transport.d.ts +6 -0
- package/dist/testing/stub-transport.d.ts.map +1 -1
- package/dist/testing/stub-transport.js +3 -0
- package/dist/testing/stub-transport.js.map +1 -1
- package/dist/timeline.d.ts +2 -98
- package/dist/timeline.d.ts.map +1 -1
- package/dist/topics.d.ts +68 -28
- package/dist/topics.d.ts.map +1 -1
- package/dist/topics.js +21 -18
- package/dist/topics.js.map +1 -1
- package/dist/unit-system/index.d.ts +1 -1
- package/dist/unit-system/index.d.ts.map +1 -1
- package/dist/unit-system/index.js +1 -1
- package/dist/unit-system/index.js.map +1 -1
- package/dist/unit-system/value.d.ts +26 -5
- package/dist/unit-system/value.d.ts.map +1 -1
- package/dist/unit-system/value.js +41 -21
- package/dist/unit-system/value.js.map +1 -1
- package/dist/units.d.ts.map +1 -1
- package/dist/units.js +2 -1
- package/dist/units.js.map +1 -1
- package/dist/uplink-externals.d.ts +17 -7
- package/dist/uplink-externals.d.ts.map +1 -1
- package/dist/uplink-externals.js +17 -7
- package/dist/uplink-externals.js.map +1 -1
- package/dist/uplink-load.d.ts +3 -2
- package/dist/uplink-load.d.ts.map +1 -1
- package/dist/uplink-load.js +9 -6
- package/dist/uplink-load.js.map +1 -1
- package/dist/uplink-manifest.d.ts +8 -3
- package/dist/uplink-manifest.d.ts.map +1 -1
- package/dist/uplink-manifest.js +5 -1
- package/dist/uplink-manifest.js.map +1 -1
- package/dist/wrap-units.d.ts.map +1 -1
- package/dist/wrap-units.js +3 -2
- package/dist/wrap-units.js.map +1 -1
- package/package.json +1 -1
- package/src/__generated__/command-map.ts +215 -19
- package/src/__generated__/contract.ts +3102 -330
- package/src/__generated__/delay-roles.ts +12 -0
- package/src/__generated__/error-codes.ts +13 -13
- package/src/__generated__/frames.ts +20 -4
- package/src/__generated__/reckonability.ts +3 -1
- package/src/__generated__/sample-kinds.ts +18 -2
- package/src/__generated__/topic-map.ts +68 -19
- package/src/__generated__/units.json +958 -94
- package/src/__generated__/units.ts +949 -76
- package/src/api/command-rejection.ts +2 -2
- package/src/api/contribution-slots.ts +128 -25
- package/src/api/error-codes.ts +3 -2
- package/src/api/framework-reads.ts +6 -1
- package/src/api/host.ts +14 -6
- package/src/api/index.ts +127 -67
- package/src/api/logger-contract.ts +2 -1
- package/src/api/logger.ts +6 -3
- package/src/api/part-panels.ts +221 -0
- package/src/api/plot-layers.ts +1 -1
- package/src/api/registry.ts +4 -2
- package/src/api/settings/store.ts +7 -2
- package/src/api/slots.ts +153 -70
- package/src/api/station-brokers.ts +24 -15
- package/src/api/tiny-size.ts +2 -1
- package/src/api/tone.ts +1 -1
- package/src/api/transport.ts +13 -0
- package/src/api/types.ts +388 -68
- package/src/api/uplink-banner.ts +128 -0
- package/src/api/uplink-handles.ts +4 -1
- package/src/binary-frame.ts +4 -4
- package/src/combine-readings.ts +4 -3
- package/src/command-delay.ts +144 -11
- package/src/command-value.ts +181 -0
- package/src/compat-versions.ts +3 -3
- package/src/contract-enum-names.ts +2 -2
- package/src/contract-tags.ts +67 -5
- package/src/data-rate.ts +178 -0
- package/src/delay-roles.ts +19 -2
- package/src/dock-markers.ts +182 -0
- package/src/envelope.ts +4 -0
- package/src/flight/types.ts +31 -2
- package/src/frames/index.ts +0 -4
- package/src/go-no-go-countdown.ts +116 -0
- package/src/index.ts +64 -4
- package/src/ksp-enum-names.ts +48 -3
- package/src/locked.ts +1 -1
- package/src/media/__fixtures__/hull-after-revert.json +1506 -0
- package/src/media/delayed-playout-buffer.ts +41 -9
- package/src/media/encoded-frame-delay.ts +29 -17
- package/src/media/frame-delay.ts +328 -22
- package/src/media/frame-stamp-timeline.ts +270 -0
- package/src/media/index.ts +5 -0
- package/src/media/radio-support.ts +8 -7
- package/src/media/worker/delay-worker-client.ts +104 -6
- package/src/media/worker/delay-worker.ts +228 -27
- package/src/media/worker/frame-delay-report.ts +141 -0
- package/src/media/worker/lead-limit-report.ts +27 -0
- package/src/media/worker/presentation-pacer.ts +216 -9
- package/src/media/worker/worker-delay-clock.ts +9 -6
- package/src/perf/PerfBudget.ts +2 -2
- package/src/rail-tags.ts +8 -0
- package/src/raw-field-split.ts +1 -1
- package/src/reading.ts +6 -6
- package/src/resource-transfer.ts +352 -0
- package/src/runtime-topic-registry.ts +23 -2
- package/src/sample-step-tracker.ts +38 -0
- package/src/sha256-fallback.ts +69 -0
- package/src/spine/__fixtures__/crash/crash-eva.json +224 -0
- package/src/spine/__fixtures__/crash/crash-separated-pod-pod-root.json +144 -0
- package/src/spine/__fixtures__/crash/crash-separated-pod.json +111 -0
- package/src/spine/__fixtures__/switch/back-to-craft.jsonl +101 -0
- package/src/spine/__fixtures__/switch/late-sent-frame.jsonl +16 -0
- package/src/spine/__fixtures__/switch/linked-craft.jsonl +63 -0
- package/src/spine/__fixtures__/switch/station-trim.jsonl +229 -0
- package/src/spine/__fixtures__/switch/switch-with-scene.jsonl +110 -0
- package/src/spine/__fixtures__/switch/unlinked-craft.jsonl +46 -0
- package/src/spine/arrival-deadline.ts +15 -0
- package/src/spine/bound-command.ts +243 -0
- package/src/spine/capability-lock.ts +65 -6
- package/src/spine/catalog-fallback.ts +152 -0
- package/src/spine/celestial-facts.ts +4 -2
- package/src/spine/centre-commands.ts +314 -0
- package/src/spine/client-reading.ts +1 -1
- package/src/spine/client-timeline.ts +165 -4
- package/src/spine/client.ts +615 -32
- package/src/spine/command-gate.ts +44 -3
- package/src/spine/command-outcomes.ts +303 -0
- package/src/spine/connectivity-history.ts +5 -3
- package/src/spine/context.tsx +154 -50
- package/src/spine/core-reckoners.ts +31 -50
- package/src/spine/delay-authority-context.ts +9 -0
- package/src/spine/delay-authority.ts +227 -3
- package/src/spine/delay-estimate.ts +88 -0
- package/src/spine/delta-v-budget.ts +2 -2
- package/src/spine/dv-stage-resources.ts +55 -43
- package/src/spine/index.ts +11 -5
- package/src/spine/kepler-reckoning.ts +245 -3
- package/src/spine/kepler.ts +1 -1
- package/src/spine/known-holds.ts +96 -0
- package/src/spine/lagrange.ts +10 -46
- package/src/spine/lifecycle.ts +22 -0
- package/src/spine/lock-scope.ts +2 -2
- package/src/spine/map-topic.ts +3 -3
- package/src/spine/never-reckonable.ts +1 -1
- package/src/spine/orbit-patches.ts +54 -10
- package/src/spine/orbital-solve.ts +53 -1
- package/src/spine/powered-reckoning.ts +5 -1
- package/src/spine/processorEvaluator.ts +106 -72
- package/src/spine/processors.ts +144 -4
- package/src/spine/rail-registry.ts +1 -1
- package/src/spine/reckoner-generation.ts +11 -0
- package/src/spine/reckoners.ts +3 -0
- package/src/spine/replay-session-controller.ts +4 -6
- package/src/spine/resolve-tracked.ts +50 -1
- package/src/spine/send-status.ts +2 -0
- package/src/spine/settings-registry.ts +7 -0
- package/src/spine/slot-ids.ts +6 -3
- package/src/spine/space-center-state.ts +17 -20
- package/src/spine/stage-countdown-store.ts +76 -0
- package/src/spine/stream-status.ts +4 -4
- package/src/spine/subscribe-read.ts +2 -2
- package/src/spine/system-state.ts +19 -21
- package/src/spine/timeline-store.ts +1119 -247
- package/src/spine/uplink-clients.ts +44 -22
- package/src/spine/uplink-delays.ts +57 -0
- package/src/spine/uplink-health.ts +59 -27
- package/src/spine/use-action-input.ts +13 -9
- package/src/spine/use-body-states.ts +5 -4
- package/src/spine/use-command.ts +620 -239
- package/src/spine/use-last-known-path.ts +75 -0
- package/src/spine/use-observed-vantage.ts +24 -0
- package/src/spine/use-orbit-trajectory.ts +22 -3
- package/src/spine/use-stream-connected.ts +23 -0
- package/src/spine/use-stream-event.ts +6 -2
- package/src/spine/use-stream.ts +7 -4
- package/src/spine/use-telemetry.ts +5 -1
- package/src/spine/use-topic-clock.ts +196 -0
- package/src/spine/use-transmissions.ts +37 -18
- package/src/spine/vantage.ts +7 -0
- package/src/spine/view-clock.ts +89 -3
- package/src/testing/fake-command.ts +109 -0
- package/src/testing/index.ts +12 -1
- package/src/testing/install-act-gate-stretch.ts +1 -2
- package/src/testing/install-dom-stubs.ts +2 -38
- package/src/testing/install-real-test-host.ts +10 -6
- package/src/testing/recorded-uplink-banners.ts +71 -0
- package/src/testing/render.tsx +16 -3
- package/src/testing/stream-fixture.tsx +3 -3
- package/src/testing/stub-transport.ts +9 -0
- package/src/timeline.ts +2 -103
- package/src/topics.ts +87 -26
- package/src/unit-system/index.ts +2 -0
- package/src/unit-system/value.ts +61 -21
- package/src/units.ts +2 -1
- package/src/uplink-externals.ts +17 -7
- package/src/uplink-load.ts +9 -8
- package/src/uplink-manifest.ts +8 -3
- package/src/wrap-units.ts +3 -9
- package/dist/spine/contributed-channels.d.ts +0 -56
- package/dist/spine/contributed-channels.d.ts.map +0 -1
- package/dist/spine/contributed-channels.js +0 -108
- package/dist/spine/contributed-channels.js.map +0 -1
- package/src/spine/contributed-channels.ts +0 -134
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One camera frame's capture stamp: the RTP timestamp its packets carry, the
|
|
3
|
+
* universal time it was rendered at, and the capture epoch that UT belongs to.
|
|
4
|
+
* Useful for dating a delayed video frame from the camera itself rather than
|
|
5
|
+
* from a clock sampled about once a second. Delivered by a
|
|
6
|
+
* {@link FrameStampFeed}.
|
|
7
|
+
*
|
|
8
|
+
* @category Delayed video
|
|
9
|
+
*/
|
|
10
|
+
export interface FrameStamp {
|
|
11
|
+
/** RTP timestamp (90 kHz, 32-bit, wrapping) of the frame on this connection. */
|
|
12
|
+
rtpTimestamp: number;
|
|
13
|
+
/** KSP universal time (seconds) the frame was rendered at. */
|
|
14
|
+
ut: number;
|
|
15
|
+
/** Capture epoch `ut` belongs to; it changes on a revert, quickload or scene reload. */
|
|
16
|
+
epoch: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* A source of {@link FrameStamp}s: the camera Uplink's control channel.
|
|
21
|
+
* `subscribe` calls `listener` for each stamp as it arrives and returns a
|
|
22
|
+
* function that stops it. Useful for handing a camera's per-frame stamps to the
|
|
23
|
+
* video delay. Taken by the delay pipelines through their `frameStamps` option.
|
|
24
|
+
*
|
|
25
|
+
* @category Delayed video
|
|
26
|
+
*/
|
|
27
|
+
export interface FrameStampFeed {
|
|
28
|
+
/** Calls `listener` for each stamp as it arrives. Returns the function that stops it. */
|
|
29
|
+
subscribe(listener: (stamp: FrameStamp) => void): () => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* How a frame's UT was worked out: `exact` from its own stamp, `interpolated`
|
|
34
|
+
* from the stamps either side of it, `extrapolated` from the rate of the two
|
|
35
|
+
* newest stamps when the frame is newer than every stamp so far, `held` at the
|
|
36
|
+
* newest stamp when there is no rate to go on.
|
|
37
|
+
*
|
|
38
|
+
* @category Delayed video
|
|
39
|
+
*/
|
|
40
|
+
export type FrameStampSource =
|
|
41
|
+
| "exact"
|
|
42
|
+
| "interpolated"
|
|
43
|
+
| "extrapolated"
|
|
44
|
+
| "held";
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The UT of one frame as {@link FrameStampTimeline.utFor} worked it out. Useful
|
|
48
|
+
* for stamping a delayed video frame with the time it was captured.
|
|
49
|
+
*
|
|
50
|
+
* @category Delayed video
|
|
51
|
+
*/
|
|
52
|
+
export interface FrameStampLookup {
|
|
53
|
+
/** KSP universal time (seconds) the frame was rendered at. */
|
|
54
|
+
ut: number;
|
|
55
|
+
/** Capture epoch `ut` belongs to. */
|
|
56
|
+
epoch: number;
|
|
57
|
+
/** How `ut` was worked out. */
|
|
58
|
+
source: FrameStampSource;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Furthest, in RTP ticks, a frame is dated past the newest stamp: 0.5 s. */
|
|
62
|
+
const MAX_EXTRAPOLATION_TICKS = 45000;
|
|
63
|
+
|
|
64
|
+
/** Stamps kept: about 8 s of 60 fps video, far past any jitter buffer. */
|
|
65
|
+
const HISTORY = 512;
|
|
66
|
+
|
|
67
|
+
/** Furthest, in RTP ticks, a stamp may arrive behind the newest and still be a reordered one: 5 s. */
|
|
68
|
+
const MAX_REORDER_TICKS = 450000;
|
|
69
|
+
|
|
70
|
+
/** Seconds of UT a stamp may fall behind the newest before it can only be a restart. */
|
|
71
|
+
const UT_BACKSTEP_SECONDS = 1;
|
|
72
|
+
|
|
73
|
+
/** Game seconds per video second a reordered stamp may be behind by: well above any warp a camera sees. */
|
|
74
|
+
const MAX_UT_PER_VIDEO_SECOND = 4;
|
|
75
|
+
|
|
76
|
+
const RTP_PER_SECOND = 90000;
|
|
77
|
+
|
|
78
|
+
const RTP_MODULUS = 2 ** 32;
|
|
79
|
+
const RTP_HALF = 2 ** 31;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The capture stamps of one camera's recent frames, answering "what UT was the
|
|
83
|
+
* frame with this RTP timestamp rendered at". A frame whose own stamp was
|
|
84
|
+
* dropped is dated from the stamps either side of it; one newer than every
|
|
85
|
+
* stamp so far is carried forward at the rate of the two newest, for at most
|
|
86
|
+
* half a second, then held. A stamp carrying
|
|
87
|
+
* a new epoch discards every earlier one, since their UTs belong to a timeline
|
|
88
|
+
* that no longer exists. So does one that can only come from a restarted
|
|
89
|
+
* source: its UT well behind the newest with no RTP gap to explain it, or its
|
|
90
|
+
* RTP timestamp further behind than any reordering. Useful for stamping delayed video frames in decode
|
|
91
|
+
* order, with no drift against the game's clock. Used by the delay pipelines
|
|
92
|
+
* through {@link bindFrameStamps}.
|
|
93
|
+
*
|
|
94
|
+
* @category Delayed video
|
|
95
|
+
*/
|
|
96
|
+
export class FrameStampTimeline {
|
|
97
|
+
/** Ordered by `rtp`, the RTP timestamp unwrapped onto one increasing line. */
|
|
98
|
+
private entries: { rtp: number; ut: number }[] = [];
|
|
99
|
+
private epoch: number | null = null;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Adds a stamp. Returns `true` when it opened a new epoch or came from a
|
|
103
|
+
* restarted source, which discarded every earlier stamp: the caller should
|
|
104
|
+
* empty whatever it holds that was dated against them.
|
|
105
|
+
*/
|
|
106
|
+
record(stamp: FrameStamp): boolean {
|
|
107
|
+
let epochChanged = false;
|
|
108
|
+
if (
|
|
109
|
+
this.epoch !== null &&
|
|
110
|
+
(stamp.epoch !== this.epoch || this.isRestart(stamp))
|
|
111
|
+
) {
|
|
112
|
+
this.entries = [];
|
|
113
|
+
epochChanged = true;
|
|
114
|
+
}
|
|
115
|
+
this.epoch = stamp.epoch;
|
|
116
|
+
|
|
117
|
+
const rtp = this.unwrap(stamp.rtpTimestamp);
|
|
118
|
+
const at = this.lowerBound(rtp);
|
|
119
|
+
const existing = this.entries[at];
|
|
120
|
+
if (existing && existing.rtp === rtp) existing.ut = stamp.ut;
|
|
121
|
+
else this.entries.splice(at, 0, { rtp, ut: stamp.ut });
|
|
122
|
+
if (this.entries.length > HISTORY) {
|
|
123
|
+
this.entries.splice(0, this.entries.length - HISTORY);
|
|
124
|
+
}
|
|
125
|
+
return epochChanged;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The UT of the frame carrying `rtpTimestamp`, or `null` when no stamp can
|
|
130
|
+
* date it: none has arrived in this epoch, or the frame is older than every
|
|
131
|
+
* stamp kept.
|
|
132
|
+
*/
|
|
133
|
+
utFor(rtpTimestamp: number): FrameStampLookup | null {
|
|
134
|
+
if (this.entries.length === 0 || this.epoch === null) return null;
|
|
135
|
+
const rtp = this.unwrap(rtpTimestamp);
|
|
136
|
+
const at = this.lowerBound(rtp);
|
|
137
|
+
const next = this.entries[at];
|
|
138
|
+
if (next && next.rtp === rtp) {
|
|
139
|
+
return { ut: next.ut, epoch: this.epoch, source: "exact" };
|
|
140
|
+
}
|
|
141
|
+
const prev = this.entries[at - 1];
|
|
142
|
+
if (!prev) return null;
|
|
143
|
+
if (!next) return this.past(prev, at - 1, rtp, this.epoch);
|
|
144
|
+
const t = (rtp - prev.rtp) / (next.rtp - prev.rtp);
|
|
145
|
+
return {
|
|
146
|
+
ut: prev.ut + t * (next.ut - prev.ut),
|
|
147
|
+
epoch: this.epoch,
|
|
148
|
+
source: "interpolated",
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Whether `stamp` cannot belong to the stream the stored stamps came from. */
|
|
153
|
+
private isRestart(stamp: FrameStamp): boolean {
|
|
154
|
+
const newest = this.entries[this.entries.length - 1];
|
|
155
|
+
if (!newest) return false;
|
|
156
|
+
const behindTicks = newest.rtp - this.unwrap(stamp.rtpTimestamp);
|
|
157
|
+
if (behindTicks > MAX_REORDER_TICKS) return true;
|
|
158
|
+
const utBack = newest.ut - stamp.ut;
|
|
159
|
+
if (utBack <= UT_BACKSTEP_SECONDS) return false;
|
|
160
|
+
const reorderSeconds = Math.max(0, behindTicks) / RTP_PER_SECOND;
|
|
161
|
+
return (
|
|
162
|
+
utBack > MAX_UT_PER_VIDEO_SECOND * reorderSeconds + UT_BACKSTEP_SECONDS
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** A frame newer than the newest stamp, `prev`. */
|
|
167
|
+
private past(
|
|
168
|
+
prev: { rtp: number; ut: number },
|
|
169
|
+
prevIndex: number,
|
|
170
|
+
rtp: number,
|
|
171
|
+
epoch: number,
|
|
172
|
+
): FrameStampLookup {
|
|
173
|
+
const before = this.entries[prevIndex - 1];
|
|
174
|
+
const ticks = rtp - prev.rtp;
|
|
175
|
+
if (!before || ticks > MAX_EXTRAPOLATION_TICKS) {
|
|
176
|
+
return { ut: prev.ut, epoch, source: "held" };
|
|
177
|
+
}
|
|
178
|
+
const rate = (prev.ut - before.ut) / (prev.rtp - before.rtp);
|
|
179
|
+
return { ut: prev.ut + ticks * rate, epoch, source: "extrapolated" };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** Discards every stamp and the epoch. */
|
|
183
|
+
clear(): void {
|
|
184
|
+
this.entries = [];
|
|
185
|
+
this.epoch = null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/** Puts a raw 32-bit RTP timestamp on the line the stored ones are on. */
|
|
189
|
+
private unwrap(raw: number): number {
|
|
190
|
+
const newest = this.entries[this.entries.length - 1];
|
|
191
|
+
if (!newest) return raw;
|
|
192
|
+
const newestRaw = ((newest.rtp % RTP_MODULUS) + RTP_MODULUS) % RTP_MODULUS;
|
|
193
|
+
const diff =
|
|
194
|
+
((((raw - newestRaw + RTP_HALF) % RTP_MODULUS) + RTP_MODULUS) %
|
|
195
|
+
RTP_MODULUS) -
|
|
196
|
+
RTP_HALF;
|
|
197
|
+
return newest.rtp + diff;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** Index of the first entry at or after `rtp`. */
|
|
201
|
+
private lowerBound(rtp: number): number {
|
|
202
|
+
let lo = 0;
|
|
203
|
+
let hi = this.entries.length;
|
|
204
|
+
while (lo < hi) {
|
|
205
|
+
const mid = (lo + hi) >> 1;
|
|
206
|
+
if ((this.entries[mid] as { rtp: number }).rtp < rtp) lo = mid + 1;
|
|
207
|
+
else hi = mid;
|
|
208
|
+
}
|
|
209
|
+
return lo;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The RTP timestamp of a frame as the browser reports it: a decoded
|
|
215
|
+
* `VideoFrame` through `metadata()`, an `RTCEncodedVideoFrame` through
|
|
216
|
+
* `getMetadata()`. `null` when the frame carries none.
|
|
217
|
+
*
|
|
218
|
+
* @category Delayed video
|
|
219
|
+
*/
|
|
220
|
+
export function rtpTimestampOf(frame: unknown): number | null {
|
|
221
|
+
if (typeof frame !== "object" || frame === null) return null;
|
|
222
|
+
for (const method of ["metadata", "getMetadata"]) {
|
|
223
|
+
const read: unknown = Reflect.get(frame, method);
|
|
224
|
+
if (typeof read !== "function") continue;
|
|
225
|
+
try {
|
|
226
|
+
const meta: unknown = read.call(frame);
|
|
227
|
+
if (
|
|
228
|
+
typeof meta === "object" &&
|
|
229
|
+
meta !== null &&
|
|
230
|
+
"rtpTimestamp" in meta &&
|
|
231
|
+
typeof meta.rtpTimestamp === "number"
|
|
232
|
+
) {
|
|
233
|
+
return meta.rtpTimestamp;
|
|
234
|
+
}
|
|
235
|
+
} catch {
|
|
236
|
+
return null;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Subscribes a {@link FrameStampTimeline} to `feed` and returns the function a
|
|
244
|
+
* delay pipeline stamps each frame with. A frame no stamp can date gets
|
|
245
|
+
* `Number.POSITIVE_INFINITY`, which the buffer holds and then drops once a dated
|
|
246
|
+
* frame arrives. `onEpochChange` is called when the camera starts a new epoch;
|
|
247
|
+
* empty the pipeline there. `reset` forgets every stamp, for a pipeline that is
|
|
248
|
+
* flushed from outside. Useful for stamping delayed video from the camera's
|
|
249
|
+
* own per-frame stamps. Used by the delay pipelines.
|
|
250
|
+
*
|
|
251
|
+
* @category Delayed video
|
|
252
|
+
*/
|
|
253
|
+
export function bindFrameStamps(
|
|
254
|
+
feed: FrameStampFeed,
|
|
255
|
+
onEpochChange: () => void,
|
|
256
|
+
): { captureUt(frame: unknown): number; reset(): void; dispose(): void } {
|
|
257
|
+
const timeline = new FrameStampTimeline();
|
|
258
|
+
const unsubscribe = feed.subscribe((stamp) => {
|
|
259
|
+
if (timeline.record(stamp)) onEpochChange();
|
|
260
|
+
});
|
|
261
|
+
return {
|
|
262
|
+
captureUt(frame) {
|
|
263
|
+
const rtp = rtpTimestampOf(frame);
|
|
264
|
+
const found = rtp === null ? null : timeline.utFor(rtp);
|
|
265
|
+
return found ? found.ut : Number.POSITIVE_INFINITY;
|
|
266
|
+
},
|
|
267
|
+
reset: () => timeline.clear(),
|
|
268
|
+
dispose: unsubscribe,
|
|
269
|
+
};
|
|
270
|
+
}
|
package/src/media/index.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { interpolateCaptureUt } from "./capture-clock";
|
|
|
16
16
|
export type {
|
|
17
17
|
DelayClockLike,
|
|
18
18
|
DelayedPlayoutBufferOptions,
|
|
19
|
+
DelayedPlayoutDropReason,
|
|
19
20
|
StampedFrame,
|
|
20
21
|
} from "./delayed-playout-buffer";
|
|
21
22
|
export { DelayedPlayoutBuffer } from "./delayed-playout-buffer";
|
|
@@ -32,6 +33,8 @@ export type {
|
|
|
32
33
|
CreateFrameDelayStreamOptions,
|
|
33
34
|
FrameDelayPipeline,
|
|
34
35
|
FrameDelayPipelineOptions,
|
|
36
|
+
FrameDelayStats,
|
|
37
|
+
FrameDelayStatsDetail,
|
|
35
38
|
FrameDelayStream,
|
|
36
39
|
FrameLike,
|
|
37
40
|
FrameSink,
|
|
@@ -39,10 +42,12 @@ export type {
|
|
|
39
42
|
} from "./frame-delay";
|
|
40
43
|
export {
|
|
41
44
|
createFrameDelayStream,
|
|
45
|
+
DEFAULT_PACING_MAX_LEAD_SECONDS,
|
|
42
46
|
isFrameDelaySupported,
|
|
43
47
|
runFrameDelayPipeline,
|
|
44
48
|
startPacingTicker,
|
|
45
49
|
} from "./frame-delay";
|
|
50
|
+
export type { FrameStamp, FrameStampFeed } from "./frame-stamp-timeline";
|
|
46
51
|
export type { RadioSupport, RadioUnsupportedReason } from "./radio-support";
|
|
47
52
|
export {
|
|
48
53
|
isRadioSupported,
|
|
@@ -35,7 +35,7 @@ export const RADIO_REQUIRED_GLOBALS = [
|
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* The encoder configuration the radio transmits at: 20 ms chunks of mono
|
|
38
|
-
* 48 kHz audio at
|
|
38
|
+
* 48 kHz audio at 12 kbit/s. Useful for encoding the operator's
|
|
39
39
|
* microphone audio before it is sent. Used by the app's push-to-talk radio
|
|
40
40
|
* when it encodes the operator's voice. `bitrate` is a target that some browsers exceed, so size buffers by the
|
|
41
41
|
* measured rate rather than this number.
|
|
@@ -82,7 +82,8 @@ export const RADIO_CHUNK_FRAMES = 960;
|
|
|
82
82
|
/**
|
|
83
83
|
* Why the radio cannot run here. With `insecure-context` the page is not a
|
|
84
84
|
* secure origin, which the operator can fix by opening it over https or on
|
|
85
|
-
* localhost. With `no-codec` the browser lacks the
|
|
85
|
+
* localhost. With `no-codec` the browser lacks the WebCodecs classes the radio
|
|
86
|
+
* needs, listed in {@link RadioSupport}'s `missing`,
|
|
86
87
|
* which the operator cannot fix on this browser. Useful for telling the operator
|
|
87
88
|
* which of the two applies. Carried by
|
|
88
89
|
* {@link RadioSupport}.
|
|
@@ -111,6 +112,7 @@ export type RadioSupport =
|
|
|
111
112
|
/** The names from {@link RADIO_REQUIRED_GLOBALS} that were absent.
|
|
112
113
|
* Empty for `insecure-context`, which is diagnosed before the
|
|
113
114
|
* globals are consulted at all. */
|
|
115
|
+
/** The WebCodecs constructors this browser lacks, empty for `"insecure-context"`. */
|
|
114
116
|
missing: readonly string[];
|
|
115
117
|
};
|
|
116
118
|
|
|
@@ -153,7 +155,7 @@ export function radioSupportStatus(): RadioSupport {
|
|
|
153
155
|
* @categoryDescription Radio
|
|
154
156
|
* Whether this browser can carry live push-to-talk radio, and the audio
|
|
155
157
|
* settings the radio encodes and decodes with. The radio is part of Commcast,
|
|
156
|
-
* the
|
|
158
|
+
* the Gonogo mod's group messaging and radio between command centres. This
|
|
157
159
|
* package does not send or play audio itself: it tells a client whether it may
|
|
158
160
|
* and what to encode with.
|
|
159
161
|
*
|
|
@@ -162,10 +164,9 @@ export function radioSupportStatus(): RadioSupport {
|
|
|
162
164
|
* {@link RADIO_ENCODER_CONFIG}, and send about 200 ms of packets at a time with
|
|
163
165
|
* the `commcast.radio.transmit` command, whose arguments are
|
|
164
166
|
* {@link CommcastRadioTransmitArgs}; send it as any command is sent, with
|
|
165
|
-
* {@link useCommand}. To listen, read the `commcast.radio` Topic
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* frames, read with {@link decodeBinaryFrame}, and the first segment of each is
|
|
167
|
+
* {@link useCommand}. To listen, read the `commcast.radio` Topic, which arrives
|
|
168
|
+
* as binary frames rather than through `useTelemetry`: read each with
|
|
169
|
+
* {@link decodeBinaryFrame}. The first segment of each frame is
|
|
169
170
|
* a {@link CommcastRadioBatch} describing who is speaking, followed by the Opus
|
|
170
171
|
* packets to decode with {@link RADIO_DECODER_CONFIG}.
|
|
171
172
|
*/
|
|
@@ -28,13 +28,22 @@
|
|
|
28
28
|
import type { ClockFormulaSnapshot } from "../../view-clock-formula";
|
|
29
29
|
import type { CaptureClockSample } from "../capture-clock";
|
|
30
30
|
import type { DelayClockLike } from "../delayed-playout-buffer";
|
|
31
|
-
import type { FrameDelayStream } from "../frame-delay";
|
|
32
|
-
import {
|
|
31
|
+
import type { FrameDelayStatsDetail, FrameDelayStream } from "../frame-delay";
|
|
32
|
+
import {
|
|
33
|
+
DEFAULT_PACING_MAX_LEAD_SECONDS,
|
|
34
|
+
startPacingTicker,
|
|
35
|
+
} from "../frame-delay";
|
|
36
|
+
import type { FrameStampFeed } from "../frame-stamp-timeline";
|
|
33
37
|
import type {
|
|
34
38
|
CreatePipelineMessage,
|
|
35
39
|
MainToWorkerMessage,
|
|
40
|
+
ReleaseState,
|
|
36
41
|
WorkerToMainMessage,
|
|
37
42
|
} from "./delay-worker";
|
|
43
|
+
import {
|
|
44
|
+
FRAME_DELAY_SUMMARY_INTERVAL_MS,
|
|
45
|
+
withFrameDelayReporter,
|
|
46
|
+
} from "./frame-delay-report";
|
|
38
47
|
|
|
39
48
|
/**
|
|
40
49
|
* A {@link DelayClockLike} that can also hand over its state to copy into a
|
|
@@ -65,14 +74,26 @@ export interface CreateWorkerFrameDelayStreamOptions {
|
|
|
65
74
|
* actually changed (reference inequality): the low-rate capture clock
|
|
66
75
|
* updates ~1Hz, no need to resend an unchanged sample 60x/sec. */
|
|
67
76
|
getCaptureSample(): CaptureClockSample;
|
|
77
|
+
/**
|
|
78
|
+
* The camera's per-frame capture stamps. When set, the worker dates each frame
|
|
79
|
+
* from the stamp matching its RTP timestamp and `getCaptureSample` is not
|
|
80
|
+
* used; a new capture epoch empties the delay.
|
|
81
|
+
*/
|
|
82
|
+
frameStamps?: FrameStampFeed;
|
|
68
83
|
/** The most frames the worker holds before dropping the oldest. */
|
|
69
84
|
maxBufferedFrames?: number;
|
|
70
85
|
/** The backlog past which pacing drops frames; see `DEFAULT_PACING_MAX_BACKLOG_SECONDS`. */
|
|
71
86
|
maxPacingBacklogSeconds?: number;
|
|
72
87
|
/** Called with a non-fatal pipeline error. */
|
|
73
88
|
onError?(error: unknown): void;
|
|
89
|
+
/** Called with the worker's running frame totals every `statsIntervalMs`. */
|
|
90
|
+
onStats?(stats: FrameDelayStatsDetail): void;
|
|
91
|
+
/** How often `onStats` is called, in milliseconds. Defaults to 10000. */
|
|
92
|
+
statsIntervalMs?: number;
|
|
74
93
|
}
|
|
75
94
|
|
|
95
|
+
const DEFAULT_STATS_INTERVAL_MS = FRAME_DELAY_SUMMARY_INTERVAL_MS;
|
|
96
|
+
|
|
76
97
|
const DEFAULT_MAX_PACING_BACKLOG_SECONDS = 0.5; // see frame-delay.ts's own default + rationale
|
|
77
98
|
|
|
78
99
|
let sharedWorker: Worker | null | undefined; // undefined = not attempted yet, null = attempt failed
|
|
@@ -84,6 +105,16 @@ interface PendingReady {
|
|
|
84
105
|
}
|
|
85
106
|
const pendingReady = new Map<string, PendingReady>();
|
|
86
107
|
const nonFatalErrorHandlers = new Map<string, (reason: string) => void>();
|
|
108
|
+
const statsHandlers = new Map<
|
|
109
|
+
string,
|
|
110
|
+
(stats: FrameDelayStatsDetail, release?: ReleaseState) => void
|
|
111
|
+
>();
|
|
112
|
+
const leadLimits = new Map<string, number>();
|
|
113
|
+
|
|
114
|
+
/** The interval to ask the worker for: every pipeline reports, since the summary log is always written. */
|
|
115
|
+
function statsIntervalFor(opts: { statsIntervalMs?: number }): number {
|
|
116
|
+
return opts.statsIntervalMs ?? DEFAULT_STATS_INTERVAL_MS;
|
|
117
|
+
}
|
|
87
118
|
|
|
88
119
|
function getSharedWorker(): Worker | null {
|
|
89
120
|
if (sharedWorker !== undefined) return sharedWorker;
|
|
@@ -113,6 +144,14 @@ function getSharedWorker(): Worker | null {
|
|
|
113
144
|
case "pipelineNonFatalError":
|
|
114
145
|
nonFatalErrorHandlers.get(msg.pipelineId)?.(msg.reason);
|
|
115
146
|
return;
|
|
147
|
+
case "pipelineStats":
|
|
148
|
+
statsHandlers.get(msg.pipelineId)?.(msg.stats, msg.release);
|
|
149
|
+
return;
|
|
150
|
+
case "pipelineLeadLimit":
|
|
151
|
+
if (leadLimits.has(msg.pipelineId)) {
|
|
152
|
+
leadLimits.set(msg.pipelineId, msg.seconds);
|
|
153
|
+
}
|
|
154
|
+
return;
|
|
116
155
|
}
|
|
117
156
|
};
|
|
118
157
|
/*
|
|
@@ -156,9 +195,8 @@ function post(
|
|
|
156
195
|
worker.postMessage(msg, transfer ?? []);
|
|
157
196
|
}
|
|
158
197
|
|
|
159
|
-
/** Starts the ~60Hz loop posting `clockSnapshot` (
|
|
160
|
-
*
|
|
161
|
-
* one real `ViewClock`) and `captureSample` (per-pipeline, only when the
|
|
198
|
+
/** Starts the ~60Hz loop posting `clockSnapshot` (per pipeline, so each
|
|
199
|
+
* camera is held by the clock it was given) and `captureSample` (per-pipeline, only when the
|
|
162
200
|
* sample reference actually changed) for one pipeline. Returns a stop
|
|
163
201
|
* function. Shared by both backends this file exposes, narrowed to just
|
|
164
202
|
* the two members either needs, so `AttachEncodedFrameDelayOptions`
|
|
@@ -171,7 +209,11 @@ function startPipelineTicker(
|
|
|
171
209
|
): () => void {
|
|
172
210
|
let lastSample: CaptureClockSample | null = null;
|
|
173
211
|
return startPacingTicker(() => {
|
|
174
|
-
post(worker, {
|
|
212
|
+
post(worker, {
|
|
213
|
+
type: "clockSnapshot",
|
|
214
|
+
pipelineId,
|
|
215
|
+
snapshot: opts.view.snapshot(),
|
|
216
|
+
});
|
|
175
217
|
const sample = opts.getCaptureSample();
|
|
176
218
|
if (sample !== lastSample) {
|
|
177
219
|
lastSample = sample;
|
|
@@ -180,6 +222,18 @@ function startPipelineTicker(
|
|
|
180
222
|
});
|
|
181
223
|
}
|
|
182
224
|
|
|
225
|
+
/** Posts each stamp of `feed` to the worker for `pipelineId`; returns the stop function. */
|
|
226
|
+
function forwardFrameStamps(
|
|
227
|
+
worker: Worker,
|
|
228
|
+
pipelineId: string,
|
|
229
|
+
feed: FrameStampFeed | undefined,
|
|
230
|
+
): () => void {
|
|
231
|
+
if (!feed) return () => {};
|
|
232
|
+
return feed.subscribe((stamp) => {
|
|
233
|
+
post(worker, { type: "frameStamp", pipelineId, stamp });
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
183
237
|
/**
|
|
184
238
|
* A delayed copy of the first video track of `raw`, with the delay running in
|
|
185
239
|
* a worker. Resolves `null`, and never throws, when it cannot be built,
|
|
@@ -207,6 +261,7 @@ export async function createWorkerFrameDelayStream(
|
|
|
207
261
|
pipelineCounter += 1;
|
|
208
262
|
const pipelineId = `delay-${pipelineCounter}`;
|
|
209
263
|
|
|
264
|
+
const stopStamps = forwardFrameStamps(worker, pipelineId, opts.frameStamps);
|
|
210
265
|
const readyPromise = new Promise<MediaStreamTrack>((resolve, reject) => {
|
|
211
266
|
pendingReady.set(pipelineId, { resolve, reject });
|
|
212
267
|
});
|
|
@@ -215,9 +270,11 @@ export async function createWorkerFrameDelayStream(
|
|
|
215
270
|
type: "createPipeline",
|
|
216
271
|
pipelineId,
|
|
217
272
|
track,
|
|
273
|
+
frameStamps: opts.frameStamps !== undefined,
|
|
218
274
|
maxBufferedFrames: opts.maxBufferedFrames,
|
|
219
275
|
maxPacingBacklogSeconds:
|
|
220
276
|
opts.maxPacingBacklogSeconds ?? DEFAULT_MAX_PACING_BACKLOG_SECONDS,
|
|
277
|
+
statsIntervalMs: statsIntervalFor(opts),
|
|
221
278
|
};
|
|
222
279
|
|
|
223
280
|
try {
|
|
@@ -227,6 +284,7 @@ export async function createWorkerFrameDelayStream(
|
|
|
227
284
|
worker.postMessage(createMsg, [track]);
|
|
228
285
|
} catch (err) {
|
|
229
286
|
pendingReady.delete(pipelineId);
|
|
287
|
+
stopStamps();
|
|
230
288
|
opts.onError?.(err);
|
|
231
289
|
return null;
|
|
232
290
|
}
|
|
@@ -235,6 +293,7 @@ export async function createWorkerFrameDelayStream(
|
|
|
235
293
|
try {
|
|
236
294
|
outputTrack = await readyPromise;
|
|
237
295
|
} catch (reason) {
|
|
296
|
+
stopStamps();
|
|
238
297
|
opts.onError?.(new Error(String(reason)));
|
|
239
298
|
return null;
|
|
240
299
|
}
|
|
@@ -242,18 +301,28 @@ export async function createWorkerFrameDelayStream(
|
|
|
242
301
|
nonFatalErrorHandlers.set(pipelineId, (reason) => {
|
|
243
302
|
opts.onError?.(new Error(reason));
|
|
244
303
|
});
|
|
304
|
+
statsHandlers.set(
|
|
305
|
+
pipelineId,
|
|
306
|
+
withFrameDelayReporter(pipelineId, opts.onStats),
|
|
307
|
+
);
|
|
308
|
+
leadLimits.set(pipelineId, DEFAULT_PACING_MAX_LEAD_SECONDS);
|
|
245
309
|
const stopTicker = startPipelineTicker(worker, pipelineId, opts);
|
|
246
310
|
|
|
247
311
|
return {
|
|
248
312
|
stream: new MediaStream([outputTrack]),
|
|
249
313
|
dispose: () => {
|
|
250
314
|
stopTicker();
|
|
315
|
+
stopStamps();
|
|
251
316
|
nonFatalErrorHandlers.delete(pipelineId);
|
|
317
|
+
statsHandlers.delete(pipelineId);
|
|
318
|
+
leadLimits.delete(pipelineId);
|
|
252
319
|
post(worker, { type: "dispose", pipelineId });
|
|
253
320
|
},
|
|
254
321
|
flush: () => {
|
|
255
322
|
post(worker, { type: "flush", pipelineId });
|
|
256
323
|
},
|
|
324
|
+
leadLimitSeconds: () =>
|
|
325
|
+
leadLimits.get(pipelineId) ?? DEFAULT_PACING_MAX_LEAD_SECONDS,
|
|
257
326
|
};
|
|
258
327
|
}
|
|
259
328
|
|
|
@@ -280,12 +349,18 @@ export interface AttachEncodedFrameDelayOptions {
|
|
|
280
349
|
/** Read fresh on every ~60Hz tick, same contract as
|
|
281
350
|
* `CreateWorkerFrameDelayStreamOptions.getCaptureSample`. */
|
|
282
351
|
getCaptureSample(): CaptureClockSample;
|
|
352
|
+
/** The camera's per-frame capture stamps; see `CreateWorkerFrameDelayStreamOptions.frameStamps`. */
|
|
353
|
+
frameStamps?: FrameStampFeed;
|
|
283
354
|
/** Real byte cap: see `encoded-frame-delay.ts`'s `DEFAULT_MAX_BUFFERED_BYTES`. */
|
|
284
355
|
maxBufferedBytes?: number;
|
|
285
356
|
/** The backlog past which pacing drops frames; see `DEFAULT_PACING_MAX_BACKLOG_SECONDS`. */
|
|
286
357
|
maxPacingBacklogSeconds?: number;
|
|
287
358
|
/** Called with a non-fatal pipeline error. */
|
|
288
359
|
onError?(error: unknown): void;
|
|
360
|
+
/** Called with the worker's running frame totals every `statsIntervalMs`. */
|
|
361
|
+
onStats?(stats: FrameDelayStatsDetail): void;
|
|
362
|
+
/** How often `onStats` is called, in milliseconds. Defaults to 10000. */
|
|
363
|
+
statsIntervalMs?: number;
|
|
289
364
|
}
|
|
290
365
|
|
|
291
366
|
/**
|
|
@@ -303,6 +378,15 @@ export interface EncodedFrameDelayHandle {
|
|
|
303
378
|
dispose(): void;
|
|
304
379
|
/** Drops the frames the pipeline holds. */
|
|
305
380
|
flush(): void;
|
|
381
|
+
/**
|
|
382
|
+
* How far ahead of now, in seconds, the pacer lets the newest frame be due
|
|
383
|
+
* before it jumps to it: {@link DEFAULT_PACING_MAX_LEAD_SECONDS}, raised to a
|
|
384
|
+
* quarter more than the longest recent gap between bursts. The worker reports
|
|
385
|
+
* it when it changes, so this returns the last figure reported, and never
|
|
386
|
+
* null. Useful for holding a detached feed for the signal delay plus this
|
|
387
|
+
* figure.
|
|
388
|
+
*/
|
|
389
|
+
leadLimitSeconds(): number;
|
|
306
390
|
}
|
|
307
391
|
|
|
308
392
|
/**
|
|
@@ -330,13 +414,17 @@ export function attachEncodedWorkerFrameDelay(
|
|
|
330
414
|
pipelineCounter += 1;
|
|
331
415
|
const pipelineId = `encoded-${pipelineCounter}`;
|
|
332
416
|
|
|
417
|
+
const stopStamps = forwardFrameStamps(worker, pipelineId, opts.frameStamps);
|
|
333
418
|
try {
|
|
334
419
|
receiver.transform = new RTCRtpScriptTransform(worker, {
|
|
335
420
|
pipelineId,
|
|
421
|
+
frameStamps: opts.frameStamps !== undefined,
|
|
336
422
|
maxBufferedBytes: opts.maxBufferedBytes,
|
|
337
423
|
maxPacingBacklogSeconds: opts.maxPacingBacklogSeconds,
|
|
424
|
+
statsIntervalMs: statsIntervalFor(opts),
|
|
338
425
|
});
|
|
339
426
|
} catch (err) {
|
|
427
|
+
stopStamps();
|
|
340
428
|
opts.onError?.(err);
|
|
341
429
|
return null;
|
|
342
430
|
}
|
|
@@ -344,17 +432,27 @@ export function attachEncodedWorkerFrameDelay(
|
|
|
344
432
|
nonFatalErrorHandlers.set(pipelineId, (reason) => {
|
|
345
433
|
opts.onError?.(new Error(reason));
|
|
346
434
|
});
|
|
435
|
+
statsHandlers.set(
|
|
436
|
+
pipelineId,
|
|
437
|
+
withFrameDelayReporter(pipelineId, opts.onStats),
|
|
438
|
+
);
|
|
439
|
+
leadLimits.set(pipelineId, DEFAULT_PACING_MAX_LEAD_SECONDS);
|
|
347
440
|
const stopTicker = startPipelineTicker(worker, pipelineId, opts);
|
|
348
441
|
|
|
349
442
|
return {
|
|
350
443
|
dispose: () => {
|
|
351
444
|
stopTicker();
|
|
445
|
+
stopStamps();
|
|
352
446
|
nonFatalErrorHandlers.delete(pipelineId);
|
|
447
|
+
statsHandlers.delete(pipelineId);
|
|
448
|
+
leadLimits.delete(pipelineId);
|
|
353
449
|
post(worker, { type: "dispose", pipelineId });
|
|
354
450
|
receiver.transform = null;
|
|
355
451
|
},
|
|
356
452
|
flush: () => {
|
|
357
453
|
post(worker, { type: "flush", pipelineId });
|
|
358
454
|
},
|
|
455
|
+
leadLimitSeconds: () =>
|
|
456
|
+
leadLimits.get(pipelineId) ?? DEFAULT_PACING_MAX_LEAD_SECONDS,
|
|
359
457
|
};
|
|
360
458
|
}
|