Support up to 8 NICs in FFmpeg TX path#46
Merged
Conversation
Multi-NIC (FFmpeg avdevice mtl_st20p path): - Register up to DVLEDTX_MAX_NICS (8, MTL_PORT_MAX) NICs with the shared MTL device via p_port/r_port/p2_port..p7_port AVOptions, since mtl_init()/DPDK EAL is only initialised once per process (session 0 registers every configured NIC on first avformat_write_header()). - Set r_tx_ip on session 0's r_port slot so st20_tx_create()'s tv_ops_check() doesn't reject it with "invalid ip 0.0.0.0" (slot 1 aliases MTL_SESSION_PORT_R, so it needs a valid destination IP even though slots 2-7 are device-only registrations). - Requires a patched mtl_st20p muxer exposing p2_port..p7_port / p2_sip..p7_sip AVOptions (documented in README); the ENABLE_MTL_TX direct pipeline already supports 8 NICs without any FFmpeg patch. - Update config/tx_fullhd_multi_nic.json to an 8-NIC/8-session layout and tx_fullhd_single_session.json for this test environment. Remove PTP (hardware timing) support: - Drop ptp_enable/ptp_pi/ptp_unicast from app_context.h and config_reader.h/.c (was hardcoded, not JSON-configurable). - Remove the AVOption-setting block in ffmpeg_tx.c — these options were silently failing on every run (not exposed by the compiled mtl_st20p muxer), so this was dead/no-op code. - Remove MTL_FLAG_PTP_* setup and the mtl_tx_ptp_sync_notify_cb callback from the direct MTL TX path (mtl_tx.c). Validated end-to-end on hardware with 8 SR-IOV VFs: all 8 sessions open and transmit cleanly with no PTP-related warnings.
Guard ctx->idx against ctx->app->st20p_sessions and nic_index against nic_count before indexing session_net[]/nics[], falling back to app-level defaults / NIC 0 when out of range. Fixes a segfault in test_open_ffmpeg_tx_uses_app_defaults (pre-existing bug from upstream's Multiple NIC for Transmission commit).
dmkarthi
reviewed
Jul 21, 2026
There was a problem hiding this comment.
Pull request overview
This PR updates the FFmpeg-based TX path to support registering up to 8 NICs with the MTL device at first initialization (to accommodate the “init once per process” DPDK/MTL constraint), and removes legacy/no-op PTP wiring while updating documentation and example configs accordingly.
Changes:
- Extend FFmpeg TX multi-NIC registration logic to populate device-level port AVOptions for up to 8 NICs.
- Document the requirement for a patched
mtl_st20pmuxer to exposep2_port..p7_port/p2_sip..p7_sipAVOptions. - Update example JSON configs for an 8-NIC / 8-session test layout.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ffmpeg/ffmpeg_tx.c | Adds multi-NIC (up to 8) AVOption registration logic for the FFmpeg mtl_st20p TX path. |
| include/ffmpeg/ffmpeg_tx.h | Updates public header comments to describe the multi-NIC behavior/constraints. |
| README.md | Documents muxer patch requirements and notes the multi-NIC configuration pattern. |
| config/tx_fullhd_single_session.json | Updates single-session sample config values for the target test environment. |
| config/tx_fullhd_multi_nic.json | Updates multi-NIC sample config to an 8-NIC / 8-session layout. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use relative filenames (not absolute paths) for tx_url in example configs - Fix stale DVLEDTX_NIC_SLOTS reference in ffmpeg_tx.c comment - Minimize the multi-NIC registration comment in ffmpeg_tx.c - Fail fast with a clear error if the mtl_st20p muxer lacks p2_port when more than 2 NICs are configured, instead of continuing with only warnings - Fix README's tx_fullhd_multi_nic.json description (was '6-NIC', now '8-NIC/8-session')
dmkarthi
reviewed
Jul 23, 2026
Add an explicit "nic_index" field to every interfaces[] entry and every tx_sessions[] entry across all sample config files, matching each entry's array position. This makes the schema consistent for single-NIC and multi-NIC configs alike (tx_fullhd_multi_nic.json already used this convention for tx_sessions[]).
…json Local ad-hoc edits (swapping in an available NIC/video file for this dev environment) were accidentally included in the previous commit, breaking test_parse_3sessions_interface_fields which asserts the fixture's original interface name (0000:03:10.1) and tx_url. Restore both to their committed values; nic_index additions are unaffected.
Parsing now fails fast with a clear error if an interfaces[] entry's optional nic_index does not equal its actual position in the array, catching config authoring mistakes (reordered/duplicated entries) before they silently misroute a tx_session to the wrong NIC. Interfaces are still stored positionally; nic_index is not otherwise used to control storage.
dmkarthi
reviewed
Jul 23, 2026
Covers the new validation added in config_reader.c: - nic_index omitted (backward compatible) - nic_index matches actual array position (multi-interface) - nic_index mismatch on a non-first entry fails parsing - nic_index mismatch on the first (only) entry fails parsing
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.
Multi-NIC (FFmpeg avdevice mtl_st20p path):
Remove PTP (hardware timing) support:
Validated end-to-end on hardware with 8 SR-IOV VFs: all 8 sessions open and transmit cleanly with no PTP-related warnings.
Description
Checklist
Code Quality
Testing
Review Readiness
Documentation
Security
PR Type
What kind of change does this PR introduce?