Add PTP hardware timing support to MTL and FFmpeg TX paths - #49
Open
sunilnom wants to merge 1 commit into
Open
Conversation
- 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).
There was a problem hiding this comment.
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 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 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. */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Testing
Review Readiness
Documentation
Security
PR Type
What kind of change does this PR introduce?