@camstack/types 1.2.223 → 1.2.224

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.
@@ -57,6 +57,7 @@ function buildInputArgs(input, decodeHwAccel) {
57
57
  const args = [];
58
58
  if (!isSoftwareDecode(decodeHwAccel)) args.push("-hwaccel", String(decodeHwAccel));
59
59
  if (input.extraArgs?.length) args.push(...input.extraArgs);
60
+ if (input.decodeThreadCount !== void 0 && input.decodeThreadCount > 0) args.push("-threads", String(input.decodeThreadCount));
60
61
  if (input.analyzeDurationUs !== void 0) args.push("-analyzeduration", String(input.analyzeDurationUs));
61
62
  if (input.probeSizeBytes !== void 0) args.push("-probesize", String(input.probeSizeBytes));
62
63
  if (input.lowDelay === true) args.push("-flags", "low_delay");
@@ -327,7 +328,7 @@ function buildFfmpegArgs(inv) {
327
328
  ...(inv.extraInputs ?? []).flatMap((extra) => buildInputArgs(extra, inv.decodeHwAccel)),
328
329
  ...graph ? ["-filter_complex", graph.graph] : []
329
330
  ];
330
- const threadArgs = inv.threadCount > 0 ? ["-threads", String(inv.threadCount)] : [];
331
+ const threadArgs = [...inv.threadCount > 0 ? ["-threads", String(inv.threadCount)] : [], ...inv.filterThreadCount !== void 0 && inv.filterThreadCount > 0 ? ["-filter_threads", String(inv.filterThreadCount)] : []];
331
332
  const maps = resolveStreamMaps(inv);
332
333
  const videoMapArgs = maps.video ? ["-map", maps.video] : [];
333
334
  const audioMapArgs = maps.audio ? ["-map", maps.audio] : [];
@@ -57,6 +57,7 @@ function buildInputArgs(input, decodeHwAccel) {
57
57
  const args = [];
58
58
  if (!isSoftwareDecode(decodeHwAccel)) args.push("-hwaccel", String(decodeHwAccel));
59
59
  if (input.extraArgs?.length) args.push(...input.extraArgs);
60
+ if (input.decodeThreadCount !== void 0 && input.decodeThreadCount > 0) args.push("-threads", String(input.decodeThreadCount));
60
61
  if (input.analyzeDurationUs !== void 0) args.push("-analyzeduration", String(input.analyzeDurationUs));
61
62
  if (input.probeSizeBytes !== void 0) args.push("-probesize", String(input.probeSizeBytes));
62
63
  if (input.lowDelay === true) args.push("-flags", "low_delay");
@@ -327,7 +328,7 @@ function buildFfmpegArgs(inv) {
327
328
  ...(inv.extraInputs ?? []).flatMap((extra) => buildInputArgs(extra, inv.decodeHwAccel)),
328
329
  ...graph ? ["-filter_complex", graph.graph] : []
329
330
  ];
330
- const threadArgs = inv.threadCount > 0 ? ["-threads", String(inv.threadCount)] : [];
331
+ const threadArgs = [...inv.threadCount > 0 ? ["-threads", String(inv.threadCount)] : [], ...inv.filterThreadCount !== void 0 && inv.filterThreadCount > 0 ? ["-filter_threads", String(inv.filterThreadCount)] : []];
331
332
  const maps = resolveStreamMaps(inv);
332
333
  const videoMapArgs = maps.video ? ["-map", maps.video] : [];
333
334
  const audioMapArgs = maps.audio ? ["-map", maps.audio] : [];
@@ -60,6 +60,24 @@ export interface FfmpegInputPlan {
60
60
  */
61
61
  readonly analyzeDurationUs?: number;
62
62
  readonly probeSizeBytes?: number;
63
+ /**
64
+ * `-threads` for the DECODER, emitted before `-i`.
65
+ *
66
+ * Distinct from {@link FfmpegInvocation.threadCount}, which lands after the
67
+ * video args and therefore bounds the ENCODER only. Nothing bounded the
68
+ * decoder at all until 2026-09-18, and that is where the threads were: left
69
+ * at auto, libavcodec creates `min(cores, 16)` frame threads per input, on a
70
+ * 20-core hub, per child.
71
+ *
72
+ * Measured the same day: a grid tile reading a 1080p sub-stream held 72
73
+ * threads; with this set to 1 and `filterThreadCount` to 1 it holds 26. The
74
+ * container's pid cgroup counts every one against a 2048 ceiling it was
75
+ * actively refusing at.
76
+ *
77
+ * A parallel decode is still a real thing — a 4K software decode at 25 fps
78
+ * cannot keep up single-threaded — so this is a number, not a flag.
79
+ */
80
+ readonly decodeThreadCount?: number;
63
81
  /**
64
82
  * A headerless stream of raw frames — `-f rawvideo` and the three facts that
65
83
  * demuxer cannot discover for itself.
@@ -389,6 +407,21 @@ export interface FfmpegInvocation {
389
407
  readonly audio: FfmpegAudioPlan;
390
408
  /** `0` = auto (omit `-threads` and let ffmpeg decide). */
391
409
  readonly threadCount: number;
410
+ /**
411
+ * `-filter_threads` — the size of libavfilter's OWN slice pool, which
412
+ * `-threads` does not touch.
413
+ *
414
+ * A separate number because it is a separate pool: ffmpeg sizes the filter
415
+ * pool to the core count independently of the codec threads, per graph. On
416
+ * this 20-core hub that is ~15 threads per graph doing nothing measurable on
417
+ * a 320x180-class output, and the container's pid cgroup counts every one of
418
+ * them. Measured on the hub 2026-09-18: a recorder passthrough went 20 → 5
419
+ * threads, a snapshot grab 35 → 4, an egress transcode 62 → 18, with
420
+ * `-threads` and this set together.
421
+ *
422
+ * Omitted when absent, so no shipped argv changes by adding the field.
423
+ */
424
+ readonly filterThreadCount?: number;
392
425
  /** Consumer output options, emitted verbatim after the encode block. */
393
426
  readonly outputArgs: readonly string[];
394
427
  readonly sink: FfmpegSink;
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_sleep = require("./sleep-VlZxDyXq.js");
3
3
  const require_event_category = require("./event-category-BVfsrBYA.js");
4
- const require_canonical_hash = require("./canonical-hash-BS9dQmcQ.js");
4
+ const require_canonical_hash = require("./canonical-hash-DYsYm8is.js");
5
5
  const require_enums = require("./enums.js");
6
6
  const require_err_msg = require("./err-msg-COpsHMw2.js");
7
7
  let zod = require("zod");
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { $ as CAM_PROFILE_ORDER, A as DeviceType, At as isEvent, B as systemMethod, Bt as isAudioChunkFormat, C as customAction, Ct as SHARE_VIEW_KINDS, D as ChargingStatus, Dt as createDurableState, E as deviceCustomAction, Et as normalizeAddonInitResult, F as event, Ft as hydrateSchema, G as ReadinessRegistry, H as nodePin, I as expandCapMethods, It as resolveHydratedFieldValue, J as readinessKey, K as ReadinessTimeoutError, L as isDeviceConfigCap, Lt as AUDIO_CHUNK_FORMATS, M as DEFAULT_RUNTIME_STATE_DURABILITY, Mt as WELL_KNOWN_TAB_MAP, N as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Nt as collectHydratedFieldEntries, O as DeviceFeature, Ot as createEvent, P as DEVICE_STATUS_METHOD, Pt as collectHydratedFieldValues, Q as BrokerStatusSchema, R as method, Rt as audioChunkBytesPerSample, S as DEVICE_CHILDREN_BATCH_MAX, St as DATAPLANE_SECRET_HEADER, T as describeCustomActions, Tt as BaseAddon, U as readNodePin, V as CAP_NODE_PIN_CONTEXT_KEY, W as toNodeId, X as AudioChunkFormatSchema, Y as scopeKey, Z as BrokerStatsSchema, _ as createMirrorSource, _t as SubscribeFramesResultSchema, a as asJsonObject, at as DecodedFrameSchema, b as deviceOpsCapability, bt as parseProfileBrokerId, c as parseJsonArray, ct as FrameHandleSchema, d as BOOT_RECOVERY_BACKOFF_MS, dt as ProfileSlotStatusSchema, et as CamProfileSchema, f as DEVICE_SCOPED_CAPS, ft as StreamSourceEntrySchema, g as createLazyTrpcSource, gt as SubscribeFramesInputSchema, h as createEventBusSliceSource, ht as SubscribeAudioChunksResultSchema, i as asJsonArray, it as DecodedAudioChunkSchema, j as adminUiCapability, jt as WELL_KNOWN_TABS, k as DeviceRole, kt as emitReadiness, l as parseJsonObject, lt as ProfileRtspEntrySchema, m as createDeviceProxy, mt as SubscribeAudioChunksInputSchema, n as sleepCancellable, nt as CamStreamResolutionSchema, o as asNumber, ot as EncodedPacketSchema, p as isDeviceScopedCap, pt as StreamSourceSchema, q as emitDownForOwnedCaps, r as asBoolean, rt as CameraStreamSchema, s as asString, st as FrameHandleFormatSchema, t as sleep, tt as CamStreamKindSchema, u as parseJsonUnknown, ut as ProfileSlotSchema, v as createSliceHandle, vt as makeProfileBrokerId, w as defineCustomActions, wt as DisposerChain, x as viewerUiCapability, xt as selectAssignedProfileSlots, y as RawStateResultSchema, yt as makeSourceBrokerId, z as resolveCapMount, zt as expandAudioChunkToF32le } from "./sleep-GU_us3DG.mjs";
2
2
  import { t as EventCategory } from "./event-category-BVDXG4tB.mjs";
3
- import { a as buildAudioArgs, c as buildVideoArgs, d as logBannerArgs, f as pickVideoEncoder, i as audioPlanFromEncodeProfile, l as invocationFromEncodeProfile, n as Fmp4BoxSplitter, o as buildFfmpegArgs, p as resolveStreamMaps, r as AUDIO_PRESETS, s as buildInputArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-C5pB-QV1.mjs";
3
+ import { a as buildAudioArgs, c as buildVideoArgs, d as logBannerArgs, f as pickVideoEncoder, i as audioPlanFromEncodeProfile, l as invocationFromEncodeProfile, n as Fmp4BoxSplitter, o as buildFfmpegArgs, p as resolveStreamMaps, r as AUDIO_PRESETS, s as buildInputArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-CvL03d3i.mjs";
4
4
  import { EventSourceType } from "./enums.mjs";
5
5
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
6
6
  import { z } from "zod";
package/dist/node.js CHANGED
@@ -21,7 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
- const require_canonical_hash = require("./canonical-hash-BS9dQmcQ.js");
24
+ const require_canonical_hash = require("./canonical-hash-DYsYm8is.js");
25
25
  const require_err_msg = require("./err-msg-COpsHMw2.js");
26
26
  let node_crypto = require("node:crypto");
27
27
  let node_fs = require("node:fs");
package/dist/node.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Fmp4BoxSplitter, o as buildFfmpegArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-C5pB-QV1.mjs";
1
+ import { n as Fmp4BoxSplitter, o as buildFfmpegArgs, t as canonicalHash, u as isSoftwareDecode } from "./canonical-hash-CvL03d3i.mjs";
2
2
  import { t as errMsg } from "./err-msg-IQTHeDzc.mjs";
3
3
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
4
4
  import * as fs from "node:fs";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/types",
3
- "version": "1.2.223",
3
+ "version": "1.2.224",
4
4
  "description": "Shared types, interfaces, and model catalogs for the CamStack detection ecosystem",
5
5
  "keywords": [
6
6
  "camstack",