@trillboards/edge-platform-rtsp 0.2.5 → 0.2.8

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.
@@ -1,7 +1,9 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="node" />
3
3
  /// <reference types="node" />
4
+ /// <reference types="node" />
4
5
  import { spawn } from 'child_process';
6
+ import { EventEmitter } from 'events';
5
7
  import type { CameraProvider } from '@trillboards/edge-core';
6
8
  import { type CropRegion, type RTSPCameraConfig } from './RTSPCameraProvider';
7
9
  /**
@@ -64,10 +66,16 @@ import { type CropRegion, type RTSPCameraConfig } from './RTSPCameraProvider';
64
66
  * So the churn goes to zero and the process count per hour falls by ~225x. The
65
67
  * one number that goes UP is steady-state concurrent sessions (2 -> N), and
66
68
  * that is why the persistent lane is bounded per recorder and degrades rather
67
- * than fails — see ADMISSION below. It is also the honest limit of what was
68
- * measurable here: mediamtx will serve any number of readers, so the ceiling of
69
- * a real consumer NVR is NOT established by this work and the default is a
70
- * stated judgement, not a measurement.
69
+ * than fails — see ADMISSION below.
70
+ *
71
+ * That bound used to be a guess. It was validated against mediamtx, which
72
+ * serves any number of readers and therefore cannot refuse anything, so the
73
+ * only property that actually matters here was untestable on the rig. Measured
74
+ * 2026-08-19 against two real implementations, the ceiling ranges from **4**
75
+ * (Happytime ONVIF/RTSP Server, a fixed pool with no config key) to **>=160**
76
+ * (Nx Media Server 6.1.2.42921, never refused). It is a property of the
77
+ * recorder, so the lane LEARNS it — see `DEFAULT_MAX_STREAM_SESSIONS_PER_SOURCE`
78
+ * and `StreamSessionAdmission.learnCeiling`.
71
79
  *
72
80
  * ── ADMISSION: A SECOND LANE, AND IT REFUSES RATHER THAN QUEUES ────────────
73
81
  *
@@ -172,6 +180,29 @@ import { type CropRegion, type RTSPCameraConfig } from './RTSPCameraProvider';
172
180
  * written to a 0600 ffconcat file and only the temp path reaches argv, so a
173
181
  * password never appears in `ps` output; stderr is scrubbed through
174
182
  * `sanitizeStreamUrlForLog` before it can reach a log line.
183
+ *
184
+ * ── SEGMENT RECORDING: A SECOND OUTPUT ON THE SAME SESSION ────────────────
185
+ *
186
+ * `segmentRecording` adds a second ffmpeg OUTPUT to the session that is already
187
+ * running — `-map 0:v -c:v copy … -f segment` — so the camera's own H.264/HEVC
188
+ * bitstream is written to MP4 segments with no decode and no re-encode, and no
189
+ * second RTSP session is opened against the recorder. The look path's argv is
190
+ * byte-identical when it is absent, and only a crop-less persistent session
191
+ * records (a mosaic tile's crop applies to the look output, never to a copy).
192
+ *
193
+ * Closed segments are found by reading the segment muxer's own CSV list:
194
+ * ffmpeg prints a line only when it ENDS a segment, so a listed file is a
195
+ * closed one. Every listed file moves to `<dir>/closed/` with a JSON sidecar
196
+ * and is emitted as a `'segment'` event; every file still in the session's
197
+ * work directory when the session ends was never listed — the segment that
198
+ * was being written — and is deleted, so a partial file never leaves here.
199
+ * Measured on ffmpeg 6.1.1 against mediamtx: SIGTERM mid-segment leaves that
200
+ * segment unlisted and without a `moov` atom; a listed segment probes clean.
201
+ *
202
+ * Recording can never take the look path down. A session that carried the
203
+ * second output, opened its input and then produced nothing is read as the
204
+ * output's failure: the next session runs look-only and recording retries
205
+ * after a doubling cooldown (`SEGMENT_SUSPEND_BASE_MS`..`SEGMENT_SUSPEND_MAX_MS`).
175
206
  */
176
207
  /** The recorder's persistent-session lane is full. Degrade, never queue. */
177
208
  export declare class RtspStreamAdmissionError extends Error {
@@ -216,6 +247,51 @@ export type StreamDegradeReason =
216
247
  /** The caller asked for the per-grab path explicitly. */
217
248
  | 'disabled';
218
249
  export type StreamCaptureMode = 'persistent' | 'per_grab';
250
+ /**
251
+ * Our POLICY ceiling on persistent sessions to one recorder — never a claim
252
+ * about what the recorder can hold.
253
+ *
254
+ * ── THIS USED TO BE A STATED JUDGEMENT AND IT WAS WRONG IN BOTH DIRECTIONS ─
255
+ *
256
+ * It read: "A STATED JUDGEMENT, not a measurement… mediamtx serves any number
257
+ * of readers, so the rig cannot find a real NVR's ceiling." That was honest
258
+ * about its own ignorance and still shipped a number into the one place the
259
+ * ignorance mattered. Measured 2026-08-19 against two real implementations
260
+ * with `scripts/measure-rtsp-session-ceiling.mjs` (a raw RTSP client, so the
261
+ * refusal is graded by which request was refused and how, not by an ffmpeg
262
+ * exit code):
263
+ *
264
+ * Happytime ONVIF/RTSP Server V8.1 4 sessions, then the server
265
+ * CLOSES THE TCP CONNECTION with
266
+ * no RTSP status at all (0-1 ms).
267
+ * Its own log: "rtsp_listen_rx,
268
+ * rua_get_idle_rua return NULL".
269
+ * A fixed pool, with no config key.
270
+ * Nx Media Server 6.1.2.42921 >=160 sessions, never refused.
271
+ * mediamtx unbounded (the original validation target,
272
+ * which is why none of this was
273
+ * visible).
274
+ *
275
+ * 16 is 4x ABOVE the first and 10x BELOW the second, so no constant is the
276
+ * answer: the ceiling is a property of the recorder. Above it the damage is not
277
+ * merely "some feeds stay on the slow path" — measured on Happytime with the
278
+ * cap at 4, the fifth feed degraded to per-grab exactly as designed and then
279
+ * produced NO FRAMES AT ALL, because the recorder was full of our own
280
+ * persistent sessions and the fallback needs a session too.
281
+ *
282
+ * So the real limit is LEARNED per recorder — see
283
+ * `StreamSessionAdmission.learnCeiling`, which records what the recorder did
284
+ * the first time it refused and sheds our own over-quota sessions down to it,
285
+ * keeping `STREAM_SESSION_RESERVE_FOR_PER_GRAB` slots free for the fallback.
286
+ * This constant is only where the search STARTS, and the two directions are not
287
+ * symmetric: starting too low costs nothing but the latency win on some feeds
288
+ * (they run the per-grab path the connector ran before this architecture),
289
+ * while starting too high costs a round trip per feed before the lane learns.
290
+ * 16 is kept because it is above every deployment this connector is sized for
291
+ * (`connectorCadence.ts` puts a host at seven or fewer feeds) and Nx proves a
292
+ * real NVR is nowhere near bothered by it.
293
+ */
294
+ export declare const DEFAULT_MAX_STREAM_SESSIONS_PER_SOURCE = 16;
219
295
  /** A complete JPEG ends at this offset; -1 = need more bytes; -2 = malformed. */
220
296
  export declare const JPEG_NEED_MORE = -1;
221
297
  export declare const JPEG_MALFORMED = -2;
@@ -295,7 +371,173 @@ export declare function streamSessionStatsFor(streamUrl: string): {
295
371
  key: string;
296
372
  active: number;
297
373
  limit: number;
374
+ learnedCeiling: number | null;
298
375
  } | null;
376
+ /** Where and how a feed records. One directory per feed; never shared. */
377
+ export interface SegmentRecordingConfig {
378
+ /**
379
+ * The feed's own directory. Session work directories (`rec-*`) and the ring
380
+ * of closed segments (`closed/`) live beneath it.
381
+ */
382
+ dir: string;
383
+ /** `-segment_time`: a segment closes at the first keyframe after this. */
384
+ segmentSeconds: number;
385
+ /** Ring capacity, in seconds of this feed's MEASURED bytes per second. */
386
+ ringSeconds: number;
387
+ /**
388
+ * False keeps the directory (leftover recovery, the ring) but adds no
389
+ * output. Default true.
390
+ */
391
+ enabled?: boolean;
392
+ }
393
+ /** The input stream as ffmpeg described it when the session opened. */
394
+ export interface SegmentStreamInfo {
395
+ /** ffmpeg's codec name, lowercased: `h264`, `hevc`, `mjpeg`, … */
396
+ codec: string;
397
+ width: number | null;
398
+ height: number | null;
399
+ fps: number | null;
400
+ }
401
+ /** A CLOSED segment, moved into `<dir>/closed/` beside its JSON sidecar. */
402
+ export interface RecordedSegment {
403
+ /** Absolute path of the closed `.mp4`. The consumer owns it from here. */
404
+ file: string;
405
+ /** Its JSON sidecar (the fields below), deleted with it. */
406
+ metaFile: string;
407
+ /** Start and end on the session's output timeline, from the segment list. */
408
+ startSec: number;
409
+ endSec: number;
410
+ /**
411
+ * Wall clock at the session's first decoded frame, plus the segment's offset
412
+ * from the session's FIRST listed segment. See `anchorFor`.
413
+ */
414
+ captureStartMs: number;
415
+ captureEndMs: number;
416
+ bytes: number;
417
+ stream: SegmentStreamInfo | null;
418
+ /** Closed by an earlier process and found on disk when this one opened. */
419
+ recovered: boolean;
420
+ }
421
+ /** A closed segment the ring deleted before anyone delivered it. */
422
+ export interface EvictedSegment {
423
+ file: string;
424
+ metaFile: string;
425
+ bytes: number;
426
+ }
427
+ export type SegmentRecordingState =
428
+ /** No recording configured, or configured off. */
429
+ 'off'
430
+ /** A session is writing segments now. */
431
+ | 'recording'
432
+ /** Configured on; the next session will record. */
433
+ | 'waiting_for_session'
434
+ /** A mosaic tile: its crop belongs to the look output, so it never records. */
435
+ | 'cropped'
436
+ /** The feed runs the per-grab path, which has no session to record from. */
437
+ | 'per_grab'
438
+ /** The camera sends a codec the index cannot hold (not H.264 or HEVC). */
439
+ | 'unsupported_codec'
440
+ /** A session with the second output failed; retrying after a cooldown. */
441
+ | 'suspended';
442
+ export interface SegmentRecordingStats {
443
+ state: SegmentRecordingState;
444
+ dir: string | null;
445
+ segmentSeconds: number | null;
446
+ ringSeconds: number | null;
447
+ /** The input codec ffmpeg reported for the newest session, or null. */
448
+ codec: string | null;
449
+ /** Segments this process closed and emitted (recovered ones excluded). */
450
+ segmentsClosed: number;
451
+ /** Segments an earlier process left on disk, emitted at open. */
452
+ segmentsRecovered: number;
453
+ secondsClosed: number;
454
+ bytesClosed: number;
455
+ /** Never-listed files deleted from session work directories. */
456
+ partialsDeleted: number;
457
+ /** Closed segments on disk at the last ring check, and their bytes. */
458
+ ringSegments: number;
459
+ ringBytes: number;
460
+ /** min(ringSeconds x measured bytes/s, 10% of the volume's free bytes). */
461
+ ringLimitBytes: number | null;
462
+ measuredBytesPerSec: number | null;
463
+ freeBytes: number | null;
464
+ evictedSegments: number;
465
+ evictedBytes: number;
466
+ /** Session restarts taken to add, drop or change the second output. */
467
+ reconfigures: number;
468
+ /** Sessions with the second output that opened their input and produced nothing. */
469
+ outputFailures: number;
470
+ suspendedUntilMs: number | null;
471
+ /** Times the wall-clock anchor was corrected against a segment's close. */
472
+ reanchors: number;
473
+ /** Predicted minus observed close of the newest segment, in ms. */
474
+ lastAnchorDriftMs: number | null;
475
+ lastSegmentAtMs: number | null;
476
+ lastError: string | null;
477
+ }
478
+ /** Codecs `video_segment` holds. Anything else is not recorded. */
479
+ export declare const RECORDABLE_CODECS: readonly string[];
480
+ /** Closed segments, beside their sidecars, under the feed's directory. */
481
+ export declare const CLOSED_SEGMENTS_DIRNAME = "closed";
482
+ /** First recording pause after the second output failed a session. */
483
+ export declare const SEGMENT_SUSPEND_BASE_MS = 60000;
484
+ /** Ceiling on that pause: at most one look-path restart an hour on a failure that persists. */
485
+ export declare const SEGMENT_SUSPEND_MAX_MS = 3600000;
486
+ /** The ring may hold at most this fraction of the volume's free bytes. */
487
+ export declare const RING_FREE_FRACTION = 0.1;
488
+ /** A file the segment list names, with its place on the output timeline. */
489
+ export interface SegmentListEntry {
490
+ name: string;
491
+ startSec: number;
492
+ endSec: number;
493
+ }
494
+ /**
495
+ * Parse the segment muxer's CSV list (`-segment_list_type csv`): one line per
496
+ * CLOSED segment, `name,start,end`. The last line is returned as `remainder`
497
+ * when it is not yet newline-terminated, so a half-written line is never read.
498
+ */
499
+ export declare function parseSegmentListCsv(text: string): {
500
+ entries: SegmentListEntry[];
501
+ remainder: string;
502
+ };
503
+ /**
504
+ * One `Stream #0:N: Video: …` line from ffmpeg's input description, or null.
505
+ * `90k tbr`-style rates are the RTP clock, not a frame rate, so only an
506
+ * explicit `fps` is read.
507
+ */
508
+ export declare function parseInputVideoStreamLine(line: string): SegmentStreamInfo | null;
509
+ /**
510
+ * Reads ffmpeg's stderr as it arrives and stops at the first input video
511
+ * stream, or at the first output description — whichever comes first. Bounded:
512
+ * it holds at most one partial line.
513
+ */
514
+ export declare class InputStreamProbe {
515
+ private partial;
516
+ private inInput;
517
+ /** The input was opened (ffmpeg described it). */
518
+ inputOpened: boolean;
519
+ done: boolean;
520
+ info: SegmentStreamInfo | null;
521
+ push(text: string): SegmentStreamInfo | null;
522
+ }
523
+ /** The second output, exactly. Pure, so the argv can be asserted. */
524
+ export declare function buildSegmentOutputArgs(o: {
525
+ /** `-segment_list` target. */
526
+ csvPath: string;
527
+ /** The segment filename template, `%` already escaped in its directory. */
528
+ segmentPattern: string;
529
+ segmentSeconds: number;
530
+ /** `-tag:v hvc1` so an HEVC segment plays in QuickTime/Safari (ffmpeg writes hev1 otherwise). */
531
+ tagHvc1: boolean;
532
+ /**
533
+ * `-min_seg_duration`, so a cut needs at least `segmentSeconds` since the
534
+ * last one. Without it the muxer cuts at the first keyframe after each
535
+ * MULTIPLE of segment_time: a 2 s GOP at segment_time 5 gives 6 s, 4 s, 6 s…
536
+ */
537
+ minSegDuration: boolean;
538
+ }): string[];
539
+ /** The volume's free bytes, or null where the platform cannot say. */
540
+ export declare function volumeFreeBytes(dir: string): number | null;
299
541
  export interface RTSPStreamCameraConfig {
300
542
  /** RTSP stream URL. Credentials never reach argv — see the header. */
301
543
  rtspUrl: string;
@@ -359,6 +601,14 @@ export interface RTSPStreamCameraConfig {
359
601
  fallbackConfig?: Partial<RTSPCameraConfig>;
360
602
  /** DHCP recovery hook, forwarded to the per-grab fallback. */
361
603
  streamUrlResolver?: RTSPCameraConfig['streamUrlResolver'];
604
+ /**
605
+ * Record the camera's own bitstream to MP4 segments as a second output of
606
+ * the persistent session (stream copy). Applies only to a persistent session
607
+ * with no `crop`. Change it later with `setSegmentRecording`.
608
+ */
609
+ segmentRecording?: SegmentRecordingConfig;
610
+ /** Free bytes of the volume holding a directory. Injected for tests. */
611
+ freeBytesFn?: (dir: string) => number | null;
362
612
  /** Injected spawn, for tests. */
363
613
  spawnFn?: typeof spawn;
364
614
  /** Injected per-grab fallback, for tests. */
@@ -402,14 +652,23 @@ export interface RTSPStreamStats {
402
652
  /** Age of the newest frame at the moment getStats() was called, or null. */
403
653
  frameAgeMs: number | null;
404
654
  lastErrorMessage: string | null;
655
+ /**
656
+ * Segment recording on this feed. `state` is derived on every call; the ring
657
+ * figures are as of the last ring check (each segment close and session end).
658
+ */
659
+ segments: SegmentRecordingStats;
405
660
  }
406
661
  /**
407
662
  * One instance per feed. Implements the SAME `CameraProvider` interface as
408
663
  * `RTSPCameraProvider`, so every consumer is unchanged — but `getFrame()` reads
409
664
  * the newest frame out of the ring the long-lived session is filling, rather
410
665
  * than spawning a process and handshaking a stream per call.
666
+ *
667
+ * Events: `'segment'` (RecordedSegment) for every closed recording segment,
668
+ * `'segment_evicted'` (EvictedSegment) when the ring deletes one undelivered,
669
+ * and `'opening'` at the start of every `open()`.
411
670
  */
412
- export declare class RTSPStreamCameraProvider implements CameraProvider {
671
+ export declare class RTSPStreamCameraProvider extends EventEmitter implements CameraProvider {
413
672
  private readonly rtspUrl;
414
673
  private readonly width;
415
674
  private readonly height;
@@ -438,12 +697,47 @@ export declare class RTSPStreamCameraProvider implements CameraProvider {
438
697
  private mode;
439
698
  private degradedReason;
440
699
  private fallback;
441
- private proc;
700
+ /**
701
+ * Why the per-grab fallback could not open, when it could not.
702
+ *
703
+ * Kept because the alternative is what shipped: a feed whose fallback failed
704
+ * answered `getFrame()` with "Camera not opened. Call open() first." — a
705
+ * PROGRAMMING error message for a RECORDER condition, thrown from
706
+ * `RTSPCameraProvider` after this provider had already been told, in words,
707
+ * that the recorder refused. Measured on Happytime at its 4-session ceiling:
708
+ * `open()` carried "Failed reading RTSP data: End of file" and `getFrame()`
709
+ * threw the not-opened message, so the one classifiable fact was discarded
710
+ * one frame later.
711
+ */
712
+ private fallbackOpenError;
713
+ /** The live ffmpeg session, or null between sessions. */
714
+ private session;
715
+ /** This recorder's persistent-session lane, for the learned ceiling. */
716
+ private admission;
442
717
  private releaseAdmission;
443
718
  private restartTimer;
444
719
  private currentRestartDelay;
445
- private cleanupInput;
446
720
  private startingUp;
721
+ private segmentConfig;
722
+ private readonly freeBytesFn;
723
+ /** The newest input description ffmpeg gave; decides the tag and the codec gate. */
724
+ private streamInfo;
725
+ private segmentsRecoveredFor;
726
+ private segmentPollTimer;
727
+ private lastSegmentPollAtMs;
728
+ /** A session stopped to change the second output; its exit starts the next one. */
729
+ private reconfigurePendingFor;
730
+ /**
731
+ * Recording paused after the second output failed a session. Provider-wide,
732
+ * not per argv: the next plan differs only by the tag once ffmpeg has named
733
+ * the codec, and retrying it at once would spend open()'s last attempt.
734
+ */
735
+ private segmentSuspension;
736
+ private segmentSuspendTimer;
737
+ private consecutiveOutputFailures;
738
+ private measuredSegmentBytes;
739
+ private measuredSegmentSeconds;
740
+ private readonly segCounters;
447
741
  private sessionStarts;
448
742
  private restarts;
449
743
  private framesDecoded;
@@ -455,6 +749,17 @@ export declare class RTSPStreamCameraProvider implements CameraProvider {
455
749
  /** Resolvers waiting for the next frame. Woken by `admitFrame`. */
456
750
  private frameWaiters;
457
751
  constructor(config: RTSPStreamCameraConfig);
752
+ on(event: 'segment', listener: (segment: RecordedSegment) => void): this;
753
+ on(event: 'segment_evicted', listener: (evicted: EvictedSegment) => void): this;
754
+ on(event: 'opening', listener: () => void): this;
755
+ on(event: string | symbol, listener: (...args: any[]) => void): this;
756
+ /**
757
+ * Change segment recording. `null` turns it off and keeps the directory (the
758
+ * ring and any leftovers stay this provider's). A change that the running
759
+ * session's argv does not already satisfy restarts the session once — after
760
+ * its first frame, never during startup.
761
+ */
762
+ setSegmentRecording(next: SegmentRecordingConfig | null): void;
458
763
  /**
459
764
  * Take a recorder session slot and start streaming. NEVER throws because the
460
765
  * persistent path was unavailable — it degrades to the per-grab provider and
@@ -462,6 +767,19 @@ export declare class RTSPStreamCameraProvider implements CameraProvider {
462
767
  * what the connector does today, so no working camera can be broken here.
463
768
  */
464
769
  open(_deviceId?: string): Promise<void>;
770
+ /**
771
+ * Drop this feed's persistent session because the recorder's learned ceiling
772
+ * turned out to be lower than the lane believed.
773
+ *
774
+ * Synchronous and non-throwing by contract — the admission pool calls this
775
+ * while it is reconciling occupancy, and an exception or an await here would
776
+ * leave the pool's accounting mid-flight. The transition itself is the one
777
+ * this provider already implements everywhere else: stop the session, report
778
+ * `per_grab` / `session_limit`, and build the fallback. The fallback's own
779
+ * `open()` is deliberately left to run on its promise; `getFrame()` reports
780
+ * its failure rather than the generic not-opened message.
781
+ */
782
+ private shedPersistentSession;
465
783
  /**
466
784
  * The newest frame this feed has produced AND NOT YET SERVED.
467
785
  *
@@ -503,7 +821,12 @@ export declare class RTSPStreamCameraProvider implements CameraProvider {
503
821
  * file exactly as the other two providers do, so it never reaches argv.
504
822
  */
505
823
  private buildInputArgs;
506
- buildArgs(): {
824
+ /**
825
+ * The session's argv. With no `segmentOutput` it is byte-identical to the
826
+ * look-only session this provider has always run; with one, the second
827
+ * output (`buildSegmentOutputArgs`) follows `pipe:1`.
828
+ */
829
+ buildArgs(segmentOutput?: Parameters<typeof buildSegmentOutputArgs>[0] | null): {
507
830
  args: string[];
508
831
  cleanup: () => void;
509
832
  };
@@ -514,7 +837,13 @@ export declare class RTSPStreamCameraProvider implements CameraProvider {
514
837
  * loud. Rejects when the session ends before that.
515
838
  */
516
839
  private startSession;
840
+ /**
841
+ * Detach the live session and stop its ffmpeg. Its own exit later finishes
842
+ * its recording, and is never restarted: whoever called this owns what
843
+ * happens next (close, shed, or open()'s retry loop).
844
+ */
517
845
  private stopProcess;
846
+ private killSession;
518
847
  /**
519
848
  * A session ended. While the provider is open this ALWAYS schedules a restart
520
849
  * with capped exponential backoff, and it is never allowed to give up. On the
@@ -528,8 +857,87 @@ export declare class RTSPStreamCameraProvider implements CameraProvider {
528
857
  * Waiters are woken on the way out so a `getFrame()` blocked on a session
529
858
  * that just died reaches its stale error rather than sitting out the full
530
859
  * deadline for a stream that is provably not coming back.
860
+ *
861
+ * Only the LIVE session's end does any of that. A session already detached
862
+ * (stopProcess) or superseded (a reconfigure) finishes its recording and
863
+ * either stops there or, for a reconfigure, starts its replacement.
531
864
  */
532
865
  private handleSessionEnd;
866
+ /** What the NEXT session should record, or null for look-only. */
867
+ private planRecording;
868
+ /** Does a running session's second output already give what `want` asks for? */
869
+ private sessionSatisfies;
870
+ /**
871
+ * Bring the live session's second output in line with the plan — by
872
+ * restarting it once, only after its first frame, and never with a second
873
+ * reconfigure already in flight. The restart is not a fault: it is counted
874
+ * in `segments.reconfigures`, not `restarts`, and keeps the recorder slot.
875
+ */
876
+ private reconcileRecording;
877
+ private onSessionFirstFrame;
878
+ private onSessionStreamInfo;
879
+ /** The work directory for a session that will record, or null for look-only. */
880
+ private prepareSessionRecording;
881
+ /** Pause recording, doubling from SEGMENT_SUSPEND_BASE_MS, then reconcile again. */
882
+ private suspendRecording;
883
+ private clearSegmentSuspension;
884
+ private ensureSegmentPolling;
885
+ private stopSegmentPolling;
886
+ /** One read of the live session's segment list: new closes move into the ring. */
887
+ private pollSegments;
888
+ /** Read whatever the segment list gained since the last read. */
889
+ private readSegmentList;
890
+ /** Move listed segments into the ring, in list order. Returns how many moved. */
891
+ private flushPending;
892
+ private closeSegment;
893
+ /**
894
+ * The wall clock of the session's FIRST listed segment.
895
+ *
896
+ * The first decoded frame and the first copied packet are the same keyframe
897
+ * (a stream copy drops what precedes it), so the first listed segment starts
898
+ * at the first frame's wall clock and every later one at its offset from it.
899
+ * When ffmpeg starts the output timeline at 0 — measured 0.000000 for H.264
900
+ * and HEVC through mediamtx — that is exactly first frame + startSec.
901
+ */
902
+ private anchorFor;
903
+ /**
904
+ * Keep the anchor honest against the one wall-clock fact a close gives us:
905
+ * a segment cannot end after we saw it closed, and on a timely poll it ended
906
+ * at most one poll before. The camera's media clock is not the wall clock,
907
+ * and a session runs for days.
908
+ */
909
+ private guardAnchorDrift;
910
+ private persistAnchor;
911
+ /**
912
+ * Write the sidecar, then move the closed file beside it, then emit. Null
913
+ * when the move must be retried (Windows refuses to rename a file ffmpeg
914
+ * still holds; the next poll asks again).
915
+ */
916
+ private moveIntoRing;
917
+ private countSegment;
918
+ private emitSegment;
919
+ /**
920
+ * A session that recorded has ended: read its list one last time, move what
921
+ * it closed, judge the second output, and delete what it never listed.
922
+ */
923
+ private finishSessionRecording;
924
+ private removeWorkDir;
925
+ /**
926
+ * Hand out what an earlier process left: closed segments with sidecars, and
927
+ * listed segments still in a session work directory. Unlisted files are
928
+ * partials and are deleted. Runs once per directory, before the first session.
929
+ */
930
+ private recoverSegments;
931
+ private recoverWorkDir;
932
+ /**
933
+ * Hold the closed segments to min(ringSeconds x measured bytes/s, 10% of the
934
+ * volume's free bytes), deleting oldest first. A file the OS will not let us
935
+ * delete (Windows, mid-upload) is skipped, never waited on.
936
+ */
937
+ private enforceRing;
938
+ private measuredBytesPerSec;
939
+ private segmentStats;
940
+ private recordingState;
533
941
  private log;
534
942
  }
535
943
  //# sourceMappingURL=RTSPStreamCameraProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"RTSPStreamCameraProvider.d.ts","sourceRoot":"","sources":["../src/RTSPStreamCameraProvider.ts"],"names":[],"mappings":";;;AAAA,OAAO,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAIpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAQL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAG9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwKG;AAEH,4EAA4E;AAC5E,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,+BAA+B;gBAChC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAM7C;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,uBAAuB;IACpC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBACX,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAQzD;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG;IACrE,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC;AAEF,+EAA+E;AAC/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