Skip to content

Add PTP hardware timing support to MTL and FFmpeg TX paths - #49

Open
sunilnom wants to merge 1 commit into
OpenVisualCloud:mainfrom
sunilnom:ptp
Open

Add PTP hardware timing support to MTL and FFmpeg TX paths#49
sunilnom wants to merge 1 commit into
OpenVisualCloud:mainfrom
sunilnom:ptp

Conversation

@sunilnom

Copy link
Copy Markdown
Contributor
  • Wire MTL_FLAG_PTP_ENABLE/PI/UNICAST_ADDR into both the direct MTL TX path (src/mtl/mtl_tx.c) and the FFmpeg mtl_st20p muxer path (src/ffmpeg/ffmpeg_tx.c), with a sync-notify callback logging master_utc_offset/delta.
  • app_context.h: add ptp_enable/ptp_pi/ptp_unicast fields.
  • config_reader.c/.h: hardcode PTP defaults (enable=true, pi=true, unicast=false) instead of reading them from JSON.

Verified on hardware (Intel I225-V/igc) with both enable_mtl_tx=true and enable_mtl_tx=false builds: PTP enables cleanly (tx pacing ptp, ptp_init pi controller) with no grandmaster present on the test network (sync cnt 0, as expected).

Description

Checklist

Code Quality

  • Code follows project style guidelines
  • No unnecessary debug logs or commented-out code
  • No hardcoded values / secrets

Testing

  • Unit test added/modified accordingly
  • Perform manual basic sanity testing at system level

Review Readiness

  • PR title and description are clear and meaningful
  • Story/Task IDs are linked

Documentation

  • README or relevant docs updated (if applicable)

Security

  • No sensitive data exposed (keys, passwords, tokens)
  • Input validation added where needed

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Testing
  • Other... Please describe:

- Wire MTL_FLAG_PTP_ENABLE/PI/UNICAST_ADDR into both the direct MTL TX
  path (src/mtl/mtl_tx.c) and the FFmpeg mtl_st20p muxer path
  (src/ffmpeg/ffmpeg_tx.c), with a sync-notify callback logging
  master_utc_offset/delta.
- app_context.h: add ptp_enable/ptp_pi/ptp_unicast fields.
- config_reader.c/.h: hardcode PTP defaults (enable=true, pi=true,
  unicast=false) instead of reading them from JSON.

Verified on hardware (Intel I225-V/igc) with both enable_mtl_tx=true
and enable_mtl_tx=false builds: PTP enables cleanly (tx pacing ptp,
ptp_init pi controller) with no grandmaster present on the test
network (sync cnt 0, as expected).

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds application-level support for MTL’s built-in PTP client so TX pacing can be driven by hardware timing in both the direct MTL TX pipeline and the FFmpeg mtl_st20p muxer-based TX path.

Changes:

  • Adds PTP fields to the app context and wires them into MTL initialization (flags, PTP pacing, and a sync-notify log callback).
  • Propagates PTP settings through the FFmpeg TX path by setting muxer AVOptions (ptp_enable, ptp_pi, ptp_unicast).
  • Hardcodes PTP defaults in the config reader and logs when PTP is enabled.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/util/config_reader.c Hardcodes PTP defaults and copies them into the runtime app context (with logging).
include/util/config_reader.h Adds PTP fields to the parsed config struct.
include/app_context.h Adds PTP fields to the application context shared by TX paths.
src/mtl/mtl_tx.c Enables MTL PTP flags/pacing and registers a sync-notify callback during mtl_init().
src/ffmpeg/ffmpeg_tx.c Sets PTP-related AVOptions on the mtl_st20p muxer when enabled.

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

Comment thread include/app_context.h
Comment on lines +66 to +68
/* PTP hardware timing (built-in MTL PTP client, FFmpeg mtl_st20p muxer path).
* See MTL_FLAG_PTP_* in mtl_api.h. Only used when ENABLE_MTL_TX is NOT set
* (the FFmpeg avdevice TX path); passed through as AVOptions in ffmpeg_tx.c. */
Comment on lines +49 to +51
int ptp_enable;
int ptp_pi;
int ptp_unicast;
Comment thread src/mtl/mtl_tx.c
Comment on lines +202 to +204
/* PTP hardware timing (built-in MTL PTP client, direct MTL TX path).
* See MTL_FLAG_PTP_* in mtl_api.h. Mirrors the AVOption-driven callback
* wired for the FFmpeg muxer path in the external ffmpeg_plugin repo. */
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