Commit Graph

1427 Commits

Author SHA1 Message Date
Cédric Verstraeten
d5de6ae271 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-12 11:55:02 +02:00
Cédric Verstraeten
2035deaa31 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-12 11:54:16 +02:00
Cédric Verstraeten
5973ba025d Add configurable tus chunking and stability fixes
Enable configurable chunked tus uploads and related robustness changes.

- Add AGENT_TUS_CHUNK_SIZE_BYTES env (default 1 MiB, 0 disables chunking) and docs in machinery/.env; ignore machinery/go.work files and set GOWORK=off in VSCode launch to avoid go.work during debugging.
- Implement tusChunkSize() and update uploadVaultResumable to send PATCHes in configurable chunk sizes, checkpoint progress after each chunk, and handle partial failures by refreshing retry budget when progress occurs.
- Change tusPatch to accept an explicit length and return the advanced offset when a PATCH is fully accepted.
- Skip uploads when the recording file no longer exists to avoid infinite retries.
- Add tests exercising chunked uploads, chunking-disabled behavior, and tusChunkSize parsing; extend fakeTus test server to record patch sizes.
- Reduce noisy info logs to debug in AAC transcoder and WebRTC audio processing.

These changes improve resumable upload reliability, allow tuning for proxy/load-balancer limits, and reduce log spam during normal operation.
2026-06-11 23:03:05 +02:00
Cédric Verstraeten
52a54fbae1 Add tus resumable upload client and MP4 analyzer
Introduce a standalone mp4analyze CLI for inspecting fragmented MP4s and add a full-featured tus resumable upload client used by Kerberos Vault uploads.

Changes:
- Add machinery/cmd/mp4analyze/main.go: CLI tool to analyze MP4 structure, fragments, keyframes, NALs and SPS/PPS differences.
- Add machinery/src/cloud/tus_client.go: implements tus 1.0.0 client with create/head/patch/delete, sidecar resume state, metadata encoding, Location resolution, backoff, and helpers (newVaultHTTPClient, setVaultTusHeaders). Resumable uploads are enabled by default and can be disabled via AGENT_DISABLE_RESUMABLE_UPLOAD. Sidecar files are stored under data/tus.
- Add machinery/src/cloud/tus_client_test.go: in-memory fake tus server and unit tests exercising happy path, unsupported servers, finalize-retry and resume-from-sidecar behavior, and helpers.
- Refactor machinery/src/cloud/kerberos_vault.go: replace inlined POST upload logic with sendToVault which attempts resumable uploads first and falls back to legacy single-POST (uploadVaultLegacy). Improve retry semantics so retry counters only advance on definitive vault responses, centralize header setup, and use new HTTP client builder honoring AGENT_TLS_INSECURE.

The change preserves backward compatibility with vaults that do not support tus by transparently falling back to the legacy upload path. Tests cover core tus behaviors and resume semantics.
2026-06-11 21:32:43 +02:00
Cédric Verstraeten
5f828262eb Merge pull request #285 from kerberos-io/fix/githubaction-version-passthrough
fix/githubaction-version-passthrough
v3.6.36
2026-06-11 20:00:19 +02:00
Cédric Verstraeten
17c1c5b04b Drop truncated GOPs at loop/restart seams
Buffer and conditionally drop a pending GOP when an upstream loop/restart emits a premature IDR. mp4.go: add gopBuffer and bufferedSample types, hold samples until the next video keyframe, detect a seam by comparing the new keyframe interval against the previous cadence (SeamGapDivisor) and drop the short/truncated tail GOP or commit buffered samples. Add commitBufferedGOP and commitSampleToTrack helpers and flush the final buffered GOP on Close. mp4_loopseam_test.go: update test descriptions, expectations and names to assert the truncated tail GOP is dropped exactly once across different GOP sizes. Dockerfile and Dockerfile.arm64: re-declare ARG VERSION inside the build stage and only derive git describe when VERSION is unset or the default 0.0.0 so build-arg values are respected. Add a binary MP4 fixture used by the tests.
2026-06-11 19:52:38 +02:00
Cédric Verstraeten
bd5df30de3 Merge pull request #284 from kerberos-io/feature/align-pps-sps-in-mp4-construct
feature/align-pps-sps-in-mp4-construct
v3.6.35
2026-06-11 18:34:45 +02:00
Cédric Verstraeten
2c063c39c6 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-11 18:33:33 +02:00
Cédric Verstraeten
2f0f29ce8c Detect and isolate upstream loop seam in MP4
Add logic to detect an upstream source loop/restart seam (premature IDR) and force a fragment flush so the seam IDR starts its own fragment. Introduces SeamGapDivisor constant and two MP4 fields (LastKeyframeRawPTS, LastKeyframeGapMs) to track recent keyframe timing; when a keyframe interval is significantly shorter than the previous interval (gap*SeamGapDivisor < previousGap) a fragment boundary is forced and a warning is logged. This approach derives the threshold from the observed GOP cadence to avoid false positives on short-GOP or all-intra streams.

Also add tests (machinery/src/video/mp4_loopseam_test.go) that synthesize loop-seam scenarios across multiple GOP sizes (15, 30, 60 frames) to verify the seam is isolated, and include a sample MP4 reproducer (machinery/thales_1781183923_3-758_2top_0-0-0-0_-1_30221.mp4).
2026-06-11 18:32:23 +02:00
Cédric Verstraeten
a05acb7fc8 Fix SPS/PPS prepend and warn on missing PS
When prepending H.264 parameter sets to keyframes, build a fresh buffer instead of appending into existing slices to avoid corrupting shared backing arrays (which could produce an invalid avcC and trigger FFmpeg "non-existing PPS 0 referenced" errors). Also add explicit error logs in mp4.Close() to surface incomplete H.264/H.265 parameter sets (avcC/hvcC) so missing VPS/SPS/PPS conditions are easier to diagnose.
2026-06-11 17:06:45 +02:00
Cédric Verstraeten
2b88c0ff93 Merge pull request #283 from kerberos-io/feature/add-bump-release-workflow
feature/add-bump-release-workflow
v3.6.34
2026-06-10 12:13:06 +02:00
Cédric Verstraeten
4aa2b6e51a Refactor release bump workflow to support multi-architecture builds and improve Docker image handling 2026-06-10 10:01:39 +00:00
Cédric Verstraeten
0c439e34c7 Merge pull request #282 from kerberos-io/feature/add-bump-release-workflow
feature/add-bump-release-workflow
v3.6.33
2026-06-10 11:25:44 +02:00
Cédric Verstraeten
d57bea3079 Add release bump workflow for semantic versioning 2026-06-10 10:37:59 +02:00
Cédric Verstraeten
46a48db080 Merge pull request #281 from kerberos-io/feature/add-backpressure-rtsp-logging
feature/add-backpressure-rtsp-logging
2026-06-10 09:49:45 +02:00
Cédric Verstraeten
b7fe9947c2 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-10 09:43:16 +02:00
Cédric Verstraeten
f214a09826 Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-10 09:42:54 +02:00
Cédric Verstraeten
7059503ac1 Expose required secrets to PR description workflow
Replace 'secrets: inherit' with an explicit secrets mapping in the PR description workflow. This exposes TOKEN and the Azure/OpenAI-related secrets (AZURE_OPENAI_API_KEY, OPENAI_MODEL, AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_VERSION) to the job so it can authenticate against the OpenAI/Azure services when generating or updating PR descriptions.
2026-06-10 09:29:10 +02:00
Cédric Verstraeten
7ee79cc063 Use reusable PR description workflow
Replace the inline OpenAI-based PR description job with a reusable workflow call (uug-ai/workflows/.github/workflows/pr-description.yml@main). Removed unused env vars and the checkout/action steps, and pass pr_number and overwrite_description inputs while inheriting repository secrets. This centralizes PR description logic and simplifies the workflow file.
2026-06-10 09:05:51 +02:00
Cédric Verstraeten
9bfbe4ee0f Add RTSP stream health and watchdog logs
Introduce streamHealth instrumentation for Golibrtsp to track per-stream metrics (write durations, gaps, lost packets, decode errors) and emit immediate warnings and periodic summaries to distinguish downstream back-pressure from upstream camera/network stalls. Wire gortsplib Client hooks (OnPacketsLost, OnDecodeError) to the health logger, label streams, and measure WritePacket blocking time around packet writes. Add packetAgeString helper and augment Kerberos ControlAgent logs with stalled counters and last-packet age to provide more context when triggering restarts.
2026-06-10 08:55:39 +02:00
Cédric Verstraeten
b8c05aa3e2 Merge pull request #280 from kerberos-io/fix/dts-pts-correction
fix/dts-pts-correction
v3.6.32
2026-06-08 18:23:19 +02:00
Cédric Verstraeten
5f7ede40ca Update CompositionTime comment for clarity on PTS-DTS calculation 2026-06-08 16:19:38 +00:00
Cédric Verstraeten
0ef84c5288 Handle composition offsets (PTS-DTS) for MP4
Compute and propagate per-sample composition time offsets (PTS - DTS) so fragmented MP4s remain decode-timestamp-monotonic while preserving presentation order for B-frame streams. Changes include:

- Add a dtsExtractor interface and compositionOffsetMs helper to extract DTS from H264/H265 access units using mediacommon extractors (safe no-op if extraction fails).
- Compute composition offsets for H264 and H265 packet handlers and store them in Packet.CompositionTime. Preserve decoded AU for H265 before Annex-B rewriting for correct DTS extraction.
- Introduce writeSampleToMP4 helper to centralize writing logic; derive DTS = PTS - compositionOffset when present and call MP4.AddSampleToTrack accordingly.
- Change MP4.AddSampleToTrack signature to accept compositionOffset and write it into sample.CompositionTimeOffset so players (MSE) can present samples in PTS order while fragments use DTS.
- Update tests to pass the new compositionOffset argument.

This ensures proper playback of streams with frame reordering (B-frames) in browsers and other fragmented-MP4 consumers.
2026-06-08 18:12:53 +02:00
Cédric Verstraeten
1a477bf42d Merge pull request #279 from kerberos-io/fix/block-config-endpoint-on-brokenstream
fix/block-config-endpoint-on-brokenstream
v3.6.31
2026-06-05 20:13:41 +02:00
Cédric Verstraeten
22c352e946 Improve /config endpoint responsiveness by adding timeout for snapshot retrieval 2026-06-05 18:08:48 +00:00
Cédric Verstraeten
55b0eb54fe Merge pull request #278 from kerberos-io/feature/support-configmaps
feature/support-configmaps
v3.6.30
2026-06-04 21:33:14 +02:00
Cédric Verstraeten
68a4ca6bb9 Update main.go 2026-06-04 21:32:31 +02:00
Cédric Verstraeten
baaa3f615a Merge pull request #277 from kerberos-io/feature/support-configmaps
feature/support-configmaps
v3.6.29
2026-06-04 18:02:23 +02:00
Cédric Verstraeten
aeb214689b Update main.go 2026-06-04 18:01:42 +02:00
Cédric Verstraeten
e353d46e73 Merge pull request #276 from kerberos-io/feature/support-configmaps
feature/support-configmaps
v3.6.28
2026-06-04 15:22:04 +02:00
Cédric Verstraeten
4d163c4b53 Update jwt_middleware.go 2026-06-04 15:14:45 +02:00
Cédric Verstraeten
014f0e312e Merge pull request #275 from kerberos-io/feature/support-configmaps
feature/support-configmaps
v3.6.27
2026-06-04 14:54:06 +02:00
Cédric Verstraeten
195750a01d Mirror env-injected Config to CustomConfig
When the agent configuration is provided via environment variables (e.g. Kubernetes ConfigMap in factory standalone/configmap mode) there is no separate custom config from MongoDB. Add logic in OverrideWithEnvironmentVariables to copy configuration.Config into configuration.CustomConfig when DEPLOYMENT is unset or set to "agent", so UI/consumers that read the per-agent custom configuration (such as the factory agent edit page) see the env-injected values instead of an empty config.
2026-06-04 14:52:12 +02:00
Cédric Verstraeten
d203321770 Merge commit from fork
fix(cloud): strip Hub credential headers on cross-host redirect
v3.6.26
2026-05-28 22:02:11 +02:00
tonghuaroot
51f1a52e17 fix(cloud): strip Hub credential headers on cross-host redirect
UploadKerberosHub used a bare http.Client with no CheckRedirect policy, so
it followed redirects automatically. net/http strips the standard sensitive
headers on a cross-host redirect but not custom-named headers, so the Hub
credentials carried in X-Kerberos-Hub-PrivateKey / X-Kerberos-Hub-PublicKey
were forwarded verbatim to any host the configured HubURI redirected to,
disclosing the private key.

Add a CheckRedirect policy that deletes the Hub credential headers when the
redirect target host differs from the original request host.

Signed-off-by: tonghuaroot <tonghuaroot@gmail.com>
2026-05-29 01:35:46 +08:00
Cédric Verstraeten
6318c61323 Merge pull request #274 from kerberos-io/feature/optimize-webrtc-support
feature/optimize-webrtc-support
v3.6.25
2026-05-27 23:49:06 +02:00
Cédric Verstraeten
5323105a60 Refactor code structure for improved readability and maintainability 2026-05-27 21:44:54 +00:00
Cédric Verstraeten
af6e75426a Refactor routing components to use Redirect instead of Navigate; update react-router-dom version and implement history for navigation 2026-05-27 07:13:17 +00:00
Cédric Verstraeten
6c2f38679b Refactor code structure for improved readability and maintainability 2026-05-26 06:39:11 +00:00
Cédric Verstraeten
9b60223300 Refactor component exports for consistency by removing unnecessary line breaks 2026-05-25 20:35:02 +00:00
Cédric Verstraeten
efdf8396ab Refactor and update dependencies for improved performance and maintainability; enhance routing and authentication components 2026-05-25 20:13:33 +00:00
Cédric Verstraeten
d0f13187a1 Refactor code structure for improved readability and maintainability 2026-05-25 19:45:32 +00:00
Cédric Verstraeten
bf46b55c92 Update sass dependency to version 1.77.8 2026-05-25 18:31:29 +00:00
Cédric Verstraeten
88edcabf98 Enhance WebRTC support by implementing session ID deduplication and increasing candidate channel buffer size 2026-05-25 09:30:19 +00:00
Cédric Verstraeten
e77af9e2c0 Merge pull request #272 from kerberos-io/revert/loopback
Revert/loopback
v3.6.24
2026-05-18 17:08:05 +02:00
Cédric Verstraeten
cc5c0253ed Revert "Clamp implausible audio/video PTS jumps"
This reverts commit 791add83f9.
2026-05-18 12:56:20 +00:00
Cédric Verstraeten
4c5a107d29 Revert "Force fragment flush on close keyframes"
This reverts commit e8fc4e674b.
2026-05-18 12:56:19 +00:00
Cédric Verstraeten
3b07c754f8 Revert "Force fragment flush on close keyframes"
This reverts commit 3d4e37dfb9.
2026-05-18 12:56:17 +00:00
Cédric Verstraeten
d151d0ce24 Revert "Track keyframe gap to prevent flush cascades"
This reverts commit 8ea84d87db.
2026-05-18 12:56:17 +00:00
Cédric Verstraeten
a32af4fe50 Revert "Adjust MinNormalGOPMs threshold to prevent false positives on loop seams"
This reverts commit d3f53e4b6b.
2026-05-18 12:56:16 +00:00