Skip to content

Conversation

@cedricve
Copy link
Member

@cedricve cedricve commented Nov 2, 2025

Description

Pull Request: feature/new-recording-fileformat

Motivation and Context

The primary motivation behind this change is to enhance the recording file format used by the Kerberos agent. By updating dependencies and incorporating additional metadata into the recording files, we aim to improve the functionality, interoperability, and user experience of the system. This update will provide more comprehensive information about the recordings, such as camera resolution, frame rate, and duration, which will be useful for both internal processing and external integrations.

Changes Overview

  1. Dependency Updates:

    • Updated various dependencies in machinery/go.mod to their latest versions to ensure better performance, security, and compatibility.
  2. Recording Metadata Enhancements:

    • Added new metadata fields to the recording files, including camera resolution, frame rate (FPS), and duration.
    • Incorporated these fields into the file naming convention to make the recordings more informative and easier to manage.
  3. Cloud Upload Adjustments:

    • Modified cloud upload functions (HandleUpload, UploadKerberosHub, and UploadKerberosVault) to include new headers that carry the additional metadata.
    • Added switch cases for different cloud providers to streamline the upload logic.
  4. Code Refactoring:

    • Refactored the handling of models by using alias modelsOld to distinguish between old and new model structures.
    • Improved readability and maintainability by cleaning up legacy code and organizing new additions logically.

Benefits to the Project

  • Enhanced Recordings:
    The new recording file format provides richer metadata, making it easier to understand and utilize the recordings for various applications, including analysis and archiving.

  • Improved Cloud Integration:
    By standardizing the metadata headers across different cloud providers, we ensure that the recordings are consistently uploaded with all relevant information, facilitating better cloud management and retrieval.

  • Dependency Management:
    Keeping dependencies up-to-date ensures that the project leverages the latest features and security patches, leading to a more robust and reliable system.

  • Code Quality:
    Refactoring and organizing the code improve the overall quality, making it easier to maintain and extend in the future.

This pull request is a significant step forward in enhancing the Kerberos agent's recording capabilities and overall system performance.

Copilot AI review requested due to automatic review settings November 2, 2025 10:47
@cedricve cedricve self-assigned this Nov 2, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the video file metadata handling and modernizes API headers for cloud uploads. The changes refactor how file information (FPS, resolution, duration) is embedded in filenames and introduce new HTTP headers for Vault uploads while maintaining backward compatibility.

  • Adds FPS and resolution to recording filenames for better metadata tracking
  • Introduces new X-Hub, X-Vault, and X-Agent HTTP headers for cloud uploads
  • Refactors if-else chains to switch statements for better code maintainability
  • Introduces new models package for structured media metadata

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
machinery/src/cloud/Vault.go Adds new HTTP headers for Hub, Vault, and Agent information; fixes retry timeout comparison; removes Content-Type header for first upload
machinery/src/cloud/Hub.go Adds blank lines for improved code readability
machinery/src/cloud/Cloud.go Refactors if-else chain to switch statement and adds comments about filename structure
machinery/src/capture/main.go Extracts camera metadata (FPS, resolution), adds new models package import, updates filename format to include FPS and resolution, creates AgentMedia objects
Comments suppressed due to low confidence (4)

machinery/src/cloud/Vault.go:94

  • The X-Agent-File-Duration header is set to 'mp4' (a format) instead of a duration value. This should contain the actual duration of the video file.
    machinery/src/cloud/Vault.go:92
  • The FPS and resolution values are hardcoded ('15' and '640x480'), but the capture/main.go file shows these values are extracted from the actual camera metadata. These headers should use the actual video file metadata instead of hardcoded values.
    machinery/src/cloud/Vault.go:193
  • Same issue as the primary storage upload: FPS and resolution values are hardcoded instead of using actual video file metadata. Additionally, the X-Agent-File-Duration header is missing entirely for the secondary storage upload, creating inconsistency between primary and secondary uploads.
    machinery/src/capture/main.go:189
  • This definition of recordingName is never used.
						recordingName := models.NewAgentMedia(

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 189 to 195
recordingName := models.NewAgentMedia(
models.WithName(s),
models.WithDuration(duration),
models.WithStartTime(startRecording),
models.WithFPS(fps),
models.WithResolution(cameraResolution),
)
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The recordingName variable is created but never used. The subsequent code still builds the filename string manually using the same 's' variable that was passed to WithName. This creates unused code and suggests incomplete refactoring.

Copilot uses AI. Check for mistakes.
startRecordingMilliseconds := startRecording % 1000 // convert to milliseconds

recordingName := models.NewAgentMedia(
models.WithName(s),
Copy link

Copilot AI Nov 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable 's' is used before it's defined. The NewAgentMedia call on line 189 uses 's' on line 190, but 's' is not defined until line 197. This will cause a compilation error.

Copilot uses AI. Check for mistakes.
Upgraded multiple dependencies to newer versions in go.mod and go.sum, including mp4ff, gortsplib, carbon, gin, webrtc, and others. Added new dependencies such as uug-ai/models and quic-go, and updated Go version to 1.24.9 for improved compatibility and security.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants